PHP SoapClient - How to Structure Soap Header -
using soapclient in php 5.3.28 create soap header looks like:
<soap:header> <ns:requestparams size="large" color="blue" brand="xyz"> </soap:header>
if construct header this:
$params = array('requestparams' => array('size' => 'large', 'color' => 'blue', 'brand' => 'xyz'); $header = new soapheader(namespace, 'requestparams', $params); $client = new soapclient(null, array("location" => "https://endpoint-url", "uri" => "http://namespace-uri", "soap_version" => soap_1_2, "trace" => 1)); $client->__setsoapheaders($header); $result = $client->__soapcall(some soap call here); echo $client->__getlastrequest() . "\n";
the header is:
<env:header> <ns2:requestparams> <item><key>requestparams</key><value> <item><key>size</key><value>large</value></item> <item><key>color</key><value>blue</value></item> <item><key>lastname</key><value>xyz</value></item></value> </item> </ns2:requestparams> </env:header>
and response server telling me it's invalid header. i've searched around , there doesn't appear info on how php soapclient creates headers data strctures. idea how can header format want using soapclient? pointers appreciated.
use can use array this
$parm = array( 'properties' => array( 'size' => 'large', 'color' => 'blue', 'brand' => 'xyz' ), );
will create this
<properties size="large" color="blue" brand="xyz">
Comments
Post a Comment