|
Posted by fragmonster on 10/07/02 12:00
Hi,
I have a .NET Web Service.
I must write a client in PHP5. I've got a problem with the formatting
of my SoapHeader. In fact, the prefix of the namespace does not apply
to the entire header node and child nodes:
Here is my PHP Soap message :
===========================
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
xmlns:ns1="http://www.toto.com/">
<env:Header>
<ns1:AuthHeaderUidSite>
<UID>xxx</UID>
<Site>102</Site>
</ns1:AuthHeaderUidSite>
</env:Header>
<env:Body>
<ns1:HelloWorld>
<ns1:nom>LI</ns1:nom>
<ns1:day>2008-01-17T14:46:37</ns1:day>
</ns1:HelloWorld>
</env:Body>
</env:Envelope>
===========================
As you can see, the ns1 prefix which appears in <AuthHeaderUidSite>
does not be inherited in UID and Site. Thats why my .NET web method
cannot get the UID and Site values.
Here is my PHP code :
===========================
class AuthHeaderGuidSite {
private $UID;
private $Site;
public function __construct($uid,$site) {
$this->UID=$uid;
$this->Site=$site;
}
}
$ns = "http://www.toto.com/";
$client = new SOAPClient($wsdl,$options);
$GUID = "xxx";
$site = 102;
$Auth1 = new AuthHeaderUidSite($GUID,$site);
$headerBody = new SOAPVar($Auth1,SOAP_ENC_OBJECT);
$header = new SoapHeader($ns,'AuthHeaderUidSite',$headerBody,false);
$day = date('Y-m-d\TH:i:s');
$params = array("nom"=>"LI", "day"=>$day);
$s = $client -
>__soapCall("HelloWorld",array($params),NULL,array($header));
============================
How can I do to make this namespace appears in the entire Header tag
like this :
<ns1:AuthHeaderUidSite>
<ns1:UID>xxx</ns1:UID>
<ns1:Site>102</ns1:Site>
</ns1:AuthHeaderUidSite>
(I test this envelop with an external tool and it works)
Thank you
Navigation:
[Reply to this message]
|