From: moographics at gmail dot com Operating system: OSX PHP version: 5.2.10 PHP Bug Type: Unknown/Other Function Bug description: namespace in soap headers not put into nested tags
Description: ------------ This has been reported before #40318 and marked as bogus but it is not bogus - it simply fails to work as expected. When using soap classes the generated xml header does not have the namespace prefix for all the tags. When creating a soap header the soapVar is passed. The xml that is generated has the correct namespace prefix for the outer tag that is generated but the inner tags have no prefix. Bug #40318 suggests that the namespace cannot be guessed for the inner tags. I am suggesting that the namespace for the inner tags surely can be assumed from the outer tags namespace. The suggested workaround did not work for me. My workaround was to roll my own xml. Reproduce code: --------------- class AuthHeader { private $UsernameToken; public function __construct($username,$password) { $this->UsernameToken = new AuthDetails($username,$password); } } class AuthDetails { private $Username; private $Password; public function __construct($username,$password) { $this->Username = $username; $this->Password = $password; } } $auth = new AuthHeader('xxx','xxx'); $security_ns = 'http://namespace'; $authvalues = new SoapVar($auth, SOAP_ENC_OBJECT); $header = new SoapHeader($security_ns, 'Security', $authvalues); Expected result: ---------------- <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP- ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://namespace1.xsd" xmlns:ns2="http://namespace2.xsd"> <SOAP-ENV:Header> <ns2:Security> <ns2:UsernameToken> <ns2:Username>xxx</ns2:Username>' <ns2:Password>xxx</ns2:Password> </ns2:UsernameToken> </ns2:Security> </SOAP-ENV:Header> <SOAP-ENV:Body> <ns1:courseListRequest> <ns1:type>courseList</ns1:type> <ns1:origin>review</ns1:origin> <ns1:action>courseList</ns1:action> <ns1:date>2009-07-18T17:28:40</ns1:date> <ns1:staffId>XXX</ns1:staffId> </ns1:courseListRequest> </SOAP-ENV:Body> </SOAP-ENV:Envelope> Actual result: -------------- <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP- ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://namespace1.xsd" xmlns:ns2="http://namespace2.xsd"> <SOAP-ENV:Header> <ns2:Security> <UsernameToken> <Username>XXX</Username>' <Password>XXX</Password> </UsernameToken> </ns2:Security> </SOAP-ENV:Header> <SOAP-ENV:Body> <ns1:courseListRequest> <ns1:type>courseList</ns1:type> <ns1:origin>review</ns1:origin> <ns1:action>courseList</ns1:action> <ns1:date>2009-07-18T17:28:40</ns1:date> <ns1:staffId>XXX</ns1:staffId> </ns1:courseListRequest> </SOAP-ENV:Body> </SOAP-ENV:Envelope> -- Edit bug report at http://bugs.php.net/?id=48966&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48966&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48966&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48966&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=48966&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=48966&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48966&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48966&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48966&r=needscript Try newer version: http://bugs.php.net/fix.php?id=48966&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48966&r=support Expected behavior: http://bugs.php.net/fix.php?id=48966&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48966&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48966&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48966&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48966&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=48966&r=dst IIS Stability: http://bugs.php.net/fix.php?id=48966&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48966&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48966&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48966&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48966&r=mysqlcfg