Re: nuSoap client SOAP Call problem
| From: | Thijs Lensselink | Date: | Fri, 24 Aug 2007 06:56:05 +0000 |
| Subject: | Re: nuSoap client SOAP Call problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-261213@lists.php.net to get a copy of this message | ||
On Fri, 24 Aug 2007 07:57:48 +0200, Angelo Zanetti <angelo@zlogic.co.za> wrote:
> Dear all
>
> Im using nusoap to create a cleint and I am having a small issue but its a
> fairly large one because I cant get the correct XML to send.
>
> I have a scenario as follows:
>
> My client:
>
> $wsdlfile="http://xxxxxxxxxxx_WSDL.xml?wsdl";
> $client=new soapclient($wsdlfile, true); //, true);
> $client->soap_defencoding = 'utf-8';
>
> $nameSpace = "xxxxxxx";
>
> Tried this:
>
> $parameters = "<SubscriptionStatus
> xmlns='http://localhost/'>";
> $parameters .= "<ISPID>xx</ISPID>";
> $parameters .= "<ISPPassword>yy</ISPPassword>";
> $parameters .= "<ISPUserID>Angelo1</ISPUserID>";
> $parameters .= "</SubscriptionStatus>";
>
> $result = $client->call('SubscriptionStatus', $parameters,
> $nameSpace);
>
> To call the SubscriptionStatus process.
>
>
> I have also tried:
> /*$Request = array(
> array(
> 'ISPID' => 'xx',
> 'ISPPassword' => 'yy',
> 'ISPUserID'=>'Angelo1')
> );
>
>
> $result = $client->call('SubscriptionStatus', $Response,
> $nameSpace);
>
>
> The request must look like this:
>
> <?xml version="1.0" encoding="utf-8"?>
> <soap:Envelope
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"i<žœ
> ü:¸ÝˆûŒ1[„>
> <soap:Body>
> <SubscriptionStatus
> xmlns="http://localhost/">
> <ISPID>xx</ISPID>
> <ISPPassword>yy</ISPPassword>
> <ISPUserID>Angelo1</ISPUserID>
> </SubscriptionStatus>
> </soap:Body>
> </soap:Envelope>
>
>
> But in fact it looks like this:
>
> <?xml version="1.0" encoding="utf-8"?>
> <SOAP-ENV:Envelope
>
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:si="http://soapinterop.org/xsd"
> xmlns:tns="http://devbit.openbit.com/SOS/">
> <SOAP-ENV:Body>
> <SubscriptionStatus xmlns="http://...">
> <SubscriptionStatus xmlns="http://..">
> <ISPID>lighthouse</ISPID>
> <ISPPassword>***</ISPPassword>
> <ISPUserID>Angelo1</ISPUserID>
> </SubscriptionStatus>
> </SubscriptionStatus>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
>
> as you can see the
>
> <SubscriptionStatus xmlns="http://...">
>
> has been repeated. This is causing my problems. I am not sure what is
> causing it? Does it have something to do with name spaces? OR the way
> the client object is created?
>
>
> This is a straight forward call but I have been searching through so
> many posts and have not had any luck. Please any links or any ideas are
> most welcome.
>
> Thanks
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
It's probably better to ask on a NuSOAP list.
The call method needs an array with parameters as far as i remember.
But i never use the call method anyway. I always go for the send method.
First create your request XML.
$request = '<SubscriptionStatus xmlns='http://localhost/'>
<ISPID>xx</ISPID>
<ISPPassword>yy</ISPPassword>
<ISPUserID>Angelo1</ISPUserID>
</SubscriptionStatus>';
Then serialize the envelope so it looks like a SOAP request.
$msg = $client->serializeEnvelope($request, false, false, 'document',
'literal');
And use the send method to make a connection and send the request.
$action = 'location of the webservice';
$results = $client->send($msg, $action, 60, 60);