#40318 [Fbk->Opn]: SOAP_ENC_OBJECT does not encode object properties with namespace

From: Date: Tue, 06 Feb 2007 00:45:19 +0000
Subject: #40318 [Fbk->Opn]: SOAP_ENC_OBJECT does not encode object properties with namespace
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-108458@lists.php.net to get a copy of this message
 ID:               40318
 User updated by:  bink at eezi dot net dot au
 Reported By:      bink at eezi dot net dot au
-Status:           Feedback
+Status:           Open
 Bug Type:         SOAP related
 Operating System: Redhat
 PHP Version:      5.2.0
 Assigned To:      dmitry
 New Comment:

I'm not able to test cvs, this is being used on our development and
production servers. If there is someone else out there with a server
running cvs I coule setup a trial on it to see... Just need shell
access on a normal user....


Previous Comments:
------------------------------------------------------------------------

[2007-02-05 20:38:22] tony2001@php.net

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip



------------------------------------------------------------------------

[2007-02-02 06:31:12] bink at eezi dot net dot au

The Namespaces on the Actual result are incorrect, they should match up
with the Expected result....

------------------------------------------------------------------------

[2007-02-02 06:05:27] bink at eezi dot net dot au

Description:
------------
Possibly a documentation issue
=====================================
When using a php object to create SOAP request headers, the
SoapVAR($obj, SOAP_ENC_OBJECT....) and SoapHeader($namespace, $name,
$soapvar) does not set the namespace of the object properties to the
same as the object itself.

Reproduce code:
---------------
$client = new SOAPClient($wsdl, array('trace' => '1'));

class headers {
function __construct($val1, $val2){
$this->val1 = $val1;
$this->val2 = $val2;
}
}

$obj = new headers('val1','val2');

$svval=new SoapVar($obj,SOAP_ENC_OBJECT, NULL, NULL, "",
"http://url.com/namespace2");

$header = new SoapHeader("http://url.com/namespace2",
                           "SoapHeaderMsg",
                           $svval, false);

$client->__setSoapHeaders(array($header));

$client->ping();

print_r($client->__getLastRequest());

Expected result:
----------------
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://url.com/namespace1"
xmlns:ns2="http://url.com/namespace2">
  <SOAP-ENV:Header>
     <ns2:SoapHeaderMsg>
       <ns2:val1>val1</val1>
       <ns2:val2>val2</val2>
     </ns2:SoapHeaderMsg>
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <ns1:PingRequest/>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Actual result:
--------------
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://ow.optus.com.au/b2b/bwsgservices/schema/version/2.0/bilpm"
xmlns:ns2="http://ow.optus.com.au/b2b/xwsgservices/schema/wscommon">
  <SOAP-ENV:Header>
     <ns2:SoapHeaderMsg>
       <val1>val1</val1>
       <val2>val2</val2>
     </ns2:SoapHeaderMsg>
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <ns1:PingRequest/>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=40318&edit=1


Thread (18 messages)

« previous php.bugs (#108458) next »