diff options
author | wei <> | 2007-01-19 07:47:59 +0000 |
---|---|---|
committer | wei <> | 2007-01-19 07:47:59 +0000 |
commit | e3ea3400bd54336be58caef9efd0d0ac9c189054 (patch) | |
tree | 535a1c9b7bc4b8b93198639ce72a84aa7901ed57 /framework/3rdParty | |
parent | 88f239a7af4de3d2a6beca21674b8ff9887c9c13 (diff) |
Enforce encoding of wsdl and soap service headers and <xml>
Diffstat (limited to 'framework/3rdParty')
-rw-r--r-- | framework/3rdParty/WsdlGen/Wsdl.php | 10 | ||||
-rw-r--r-- | framework/3rdParty/WsdlGen/WsdlGenerator.php | 10 |
2 files changed, 14 insertions, 6 deletions
diff --git a/framework/3rdParty/WsdlGen/Wsdl.php b/framework/3rdParty/WsdlGen/Wsdl.php index eb41049f..eaf95ef1 100644 --- a/framework/3rdParty/WsdlGen/Wsdl.php +++ b/framework/3rdParty/WsdlGen/Wsdl.php @@ -76,13 +76,17 @@ class Wsdl */ private $bindingTransport = 'http://schemas.xmlsoap.org/soap/http'; + private $_encoding=''; + /** * Creates a new Wsdl thing * @param string $name the name of the service. * @param string $serviceUri The URI of the service that handles this WSDL + * @param string character encoding */ - public function __construct($name, $serviceUri='') + public function __construct($name, $serviceUri='', $encoding='') { + $this->_encoding = $encoding; $this->serviceName = $name; if ($serviceUri == '') $serviceUri = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']; $this->serviceUri = str_replace('&', '&', $serviceUri); @@ -101,7 +105,9 @@ class Wsdl */ protected function buildWsdl() { - $xml = '<?xml version="1.0" ?> + $encoding = $this->_encoding==='' ? '' : 'encoding="'.$this->_encoding.'"'; + + $xml = '<?xml version="1.0" '.$encoding.'?> <definitions name="'.$this->serviceName.'" targetNamespace="'.$this->targetNamespace.'" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="'.$this->targetNamespace.'" diff --git a/framework/3rdParty/WsdlGen/WsdlGenerator.php b/framework/3rdParty/WsdlGen/WsdlGenerator.php index 4d6b5686..f2a6b380 100644 --- a/framework/3rdParty/WsdlGen/WsdlGenerator.php +++ b/framework/3rdParty/WsdlGen/WsdlGenerator.php @@ -89,11 +89,12 @@ class WsdlGenerator * WSDL can then be retrieved by calling * @param string $className The name of the class to generate for * @param string $serviceUri The URI of the service that handles this WSDL + * @param string $encoding character encoding. * @return void */ - public function generateWsdl($className, $serviceUri='') + public function generateWsdl($className, $serviceUri='',$encoding='') { - $this->wsdlDocument = new Wsdl($className, $serviceUri); + $this->wsdlDocument = new Wsdl($className, $serviceUri, $encoding); $classReflect = new ReflectionClass($className); $methods = $classReflect->getMethods(); @@ -116,11 +117,12 @@ class WsdlGenerator * Static method that generates and outputs the generated wsdl * @param string $className The name of the class to export * @param string $serviceUri The URI of the service that handles this WSDL + * @param string $encoding character encoding. */ - public static function generate($className, $serviceUri='') + public static function generate($className, $serviceUri='', $encoding='') { $generator = WsdlGenerator::getInstance(); - $generator->generateWsdl($className, $serviceUri); + $generator->generateWsdl($className, $serviceUri,$encoding); //header('Content-type: text/xml'); return $generator->getWsdl(); //exit(); |