SOAP client connecting to .net webservice
| From: | Milo van der Linden | Date: | Mon, 27 Aug 2007 19:32:21 +0000 |
| Subject: | SOAP client connecting to .net webservice | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-2612@lists.php.net to get a copy of this message | ||
Hello list!
I am new to php SOAP and have an urgent question.
I am trying to connect to a webservice that is written in ASP.net.
The request I have to compose needs to be:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:itw="http://www.itworks.nl/">
<soapenv:Header>
<itw:AuthenticationHeader>
<itw:Username>milo</itw:Username>
<itw:PasswordHash>111</itw:PasswordHash>
<itw:Database>?</itw:Database>
</itw:AuthenticationHeader>
</soapenv:Header>
<soapenv:Body>
<itw:Hello>
<itw:yourName>T. Estuser</itw:yourName>
</itw:Hello>
</soapenv:Body>
</soapenv:Envelope>
And up till now I have written the following code, it includes header authentication or is supposed to..:
<?php
error_reporting(E_ALL);
$ini = ini_set("soap.wsdl_cache_enabled","0");
$client = new SoapClient("http://10.0.0.56:81/wssoilution/wsSoilution.asmx?WSDL",
array('location' => 'http://10.0.0.56:81/wssoilution/wsSoilution.asmx', 'uri' => 'itw', 'trace' => 1));
var_dump($client->__getFunctions());
var_dump($client->__getTypes());
$x["Username"]="milo";
$x["PasswordHash"]="111";
$x["Database"]="?";
$x=new SoapVar($x,SOAP_ENC_OBJECT);
$y["AuthenticationHeader"]=$x;
$y=new SoapVar($y,SOAP_ENC_OBJECT);
$header=new SoapHeader("",'AuthenticationHeader',$y);
$client->__setSoapHeaders(array($header));
$params2 = array('yourName'=> 'T.Estuser');
$result2 = $client->Hello($params2);
?>
The error I am recieving is: Fatal error SoapHeader:SoapHeader(): Invalid parameters. Invalid namespace in soaptest.php on line 20
I cannot figure out how to set the namespace parameters!
Any help is appreciated.
Kind regards!
Milo