SOAP Header with php5
| From: | Nils Sowen | Date: | Thu, 04 Nov 2004 07:34:14 +0000 |
| Subject: | SOAP Header with php5 | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-1644@lists.php.net to get a copy of this message | ||
Hi,
with PEAR SOAP I was able to generate a SOAP-Header with
the following code:
$auth_header = new SOAP_Header('authenticate','Struct',array('username'=>'testuser','password'=>'test12345'),0);
And then use addHeader() to put it into the SOAP-Client object,
so the result is more or less something like:
<SOAP-ENV:Header>
<authenticate SOAP-ENV:mustUnderstand="0"
SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next">
<password xsi:type="xsd:string">test12345</password>
<username xsi:type="xsd:string">testuser</username>
</authenticate>
</SOAP-ENV:Header>
With php5 I wasn't that successfull. In the manual it says:
SoapVar::SoapVar ( mixed data, int encoding [, string type_name [, string type_namespace [, string node_name [, string node_namespace]]]])
$auth_header=new SoapHeader(null,"authenticate",
array(
new SoapVar("testuser",XSD_STRING,"username"),
new SoapVar("test12345",XSD_STRING,"password")),
false,
"http://schemas.xmlsoap.org/soap/actor/next");
But the result is:
<SOAP-ENV:Header>
<ns2:authenticate
SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next">
<item>testuser</item>
<item>test12345</item>
</ns2:authenticate>
</SOAP-ENV:Header>
Whenever I put more parameters into SoapVar, it doesn't change anything.
What do I have to change in the auth_header to make it look behave
like the constructor in the PEAR implementation?
--
Nils Sowen
Softwareengineer
KOMPLEX.NET GmbH
Bismarckstrasse 120
D-47057 Duisburg
Fon: 0203 3094 428
Fax: 0203 3094 110
http://www.freecity.de
http://www.kontent.de
http://www.komplex.net
http://www.kon.de