nuSoap client SOAP Call problem

This is a discussion on nuSoap client SOAP Call problem within the PHP General forums, part of the PHP Programming Forums category; Angelo Zanetti wrote: > > > Thijs Lensselink wrote: >> On Fri, 24 Aug 2007 07:57:48 +0200, ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #11 (permalink)  
Old 08-24-2007
Thijs Lensselink
 
Posts: n/a
Default Re: [PHP] nuSoap client SOAP Call problem

Angelo Zanetti wrote:

>
>
> Thijs Lensselink wrote:
>> 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/">
>>> <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);
>>
>>

>
> Seems to make the XML request correctly but now the response from the
> server is the WSDL file? strange even though my request is correct.
>
> Im not 100% sure about the $action parameter? What must be entered
> here? Also mustn't I specify the Element that is being consumed in the
> webservice IE: "SubscriptionStatus"?
>
> THanks again
>

The action parameter is something like: http://domain.com/webservice
From the WSDL file you can get the soapAction. This is where the
requests go.

I think you are sending the XML correctly. But to the wrong endpoint.
(https://netshop.openbit.com/SOS/SOSServlet)
Reply With Quote
  #12 (permalink)  
Old 08-25-2007
Angelo Zanetti
 
Posts: n/a
Default Re: [PHP] nuSoap client SOAP Call problem



Thijs Lensselink wrote:
> On Fri, 24 Aug 2007 13:55:29 +0200, Angelo Zanetti <angelo@zlogic.co.za> wrote:
>
>> Thijs Lensselink wrote:
>>
>>> On Fri, 24 Aug 2007 12:39:06 +0200, Angelo Zanetti <angelo@zlogic.co.za>
>>>

>> wrote:
>>
>>>> Thijs Lensselink wrote:
>>>>
>>>>
>>>>> On Fri, 24 Aug 2007 11:53:12 +0200, Angelo Zanetti
>>>>>

>> <angelo@zlogic.co.za>
>>
>>>> wrote:
>>>>
>>>>
>>>>>>> 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';
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> The action variable is that the URL of the WSDL?
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>> $results = $client->send($msg, $action, 60, 60);
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> Why do you have 60 twice? As far as I can see in the API the send
>>>>>> document is only receiving 3 parameters?
>>>>>>
>>>>>> I have posted to many SOAP forums and the mailing list. No luck what
>>>>>>

>> so
>>
>>>>>> ever. Your the first to reply thanks, I think this could work.
>>>>>>
>>>>>> Your help is very much appreciated.
>>>>>>
>>>>>> regards
>>>>>> Angelo
>>>>>>
>>>>>>
>>>>>>
>>>>> Hey Angelo,
>>>>>
>>>>> I know getting info for NuSOAP is a b*tch. Maybe switch to PHP5 and
>>>>>

>> the
>>
>>>> SOAP extension?
>>>>
>>>>
>>>>> The $action variable is not the WSDL url. I missed that part in your
>>>>>
>>>>>
>>>> first post.
>>>>
>>>>
>>>>> The $action var is actually build up from two parts. The first part
>>>>>
>>>>>
>>>> being the webservice
>>>>
>>>>
>>>>> location. And the second part is /webserviceAction
>>>>>
>>>>> The reason i have two 60's in the method call is because in the
>>>>>
>>>>>
>>>> soapclient
>>>>
>>>>
>>>>> class the method looks like this:
>>>>>
>>>>> function send($msg, $soapaction = '', $timeout=0,
>>>>>

>> $response_timeout=30)
>>
>>>> {
>>>>
>>>>
>>>>> But in the meantime i've been trying some other things with NuSOAP.
>>>>>

>> And
>>
>>>> got this to work with WSDL.
>>>>
>>>>
>>>>> $request = '<SubscriptionStatus xmlns='http://localhost/'>
>>>>> <ISPID>xx</ISPID>
>>>>> <ISPPassword>yy</ISPPassword>
>>>>> <ISPUserID>Angelo1</ISPUserID>
>>>>> </SubscriptionStatus>';
>>>>>
>>>>> $params = array('request' => $request);
>>>>>
>>>>> $operation = 'WebserviceAction';
>>>>> $result = $client->call($operation, $params, $namespace);
>>>>>
>>>>> Hope this helps.
>>>>>
>>>>>
>>>>>
>>>>>
>>>> Hi, yes I have done it as you have specified with the call method
>>>> unfortunately for some weird reason that creates the duplication.
>>>> However I have almost got your previous mail working. But in the XML
>>>> request I have:
>>>> Now I see this is present: xmlns:0="" --> its an error thats making
>>>>

>> the
>>
>>>> XML invalid any reason why its making that?
>>>>
>>>> <?xml version="1.0" encoding="utf-8"?>
>>>> <SOAP-ENV:Envelope
>>>> SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>>>> 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:0="">
>>>>
>>>>
>>>>
>>>> Another thing i that I have made the action variable to :
>>>> "wsdlURL/SubscriptionStatus" where wsdlURL is the URL of wsdl.
>>>> This also doesnt work but it might have to do with the above invalid
>>>>

>> XML
>>
>>>> so perhaps this is the correct way to create the action parameter?
>>>>
>>>> Thanks again very much.
>>>>
>>>>
>>> The empy xmlns means there is no namespace set.
>>> I guess you didn't provide a namespace in the serializeEnvelope method.
>>> The 3rd parameter is set to false in the example. But that's where you
>>>

>> should
>>
>>> set the $namspace.
>>>
>>> The WSDL url should work if you take of the ?wsdl part.
>>>
>>>

>> Thanks again.
>> I have specified the namespace but the problem is that its creating the
>> weird characters:
>>
>> xmlns:0=""
>>
>> :0 Im not sure where they come from and I'm not sure I need the name
>> space anyway
>>
>> Any idea why its causing this character?
>> thank
>>
>>
>>

>
> try this:
> $msg = $client->serializeEnvelope($request, '', array(), 'document', 'literal');
>
>

That worked! I assume that it was send it as an array element therefore
the 0 appeared causing the XML page to be invalid.

Thanks

--
------------------------------------------------------------------------
Angelo Zanetti
Systems developer
------------------------------------------------------------------------

*Telephone:* +27 (021) 552 9799
*Mobile:* +27 (0) 72 441 3355
*Fax:* +27 (0) 86 681 5885
*
Web:* http://www.zlogic.co.za
*E-Mail:* angelo@zlogic.co.za <mailto:angelo@zlogic.co.za>
Reply With Quote
  #13 (permalink)  
Old 08-25-2007
Angelo Zanetti
 
Posts: n/a
Default Re: [PHP] nuSoap client SOAP Call problem



Thijs Lensselink wrote:
> Angelo Zanetti wrote:
>
>
>> Thijs Lensselink wrote:
>>
>>> 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/">
>>>> <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);
>>>
>>>
>>>

>> Seems to make the XML request correctly but now the response from the
>> server is the WSDL file? strange even though my request is correct.
>>
>> Im not 100% sure about the $action parameter? What must be entered
>> here? Also mustn't I specify the Element that is being consumed in the
>> webservice IE: "SubscriptionStatus"?
>>
>> THanks again
>>
>>

> The action parameter is something like: http://domain.com/webservice
> >From the WSDL file you can get the soapAction. This is where the

> requests go.
>
> I think you are sending the XML correctly. But to the wrong endpoint.
> (https://netshop.openbit.com/SOS/SOSServlet)
>
>
>
>

Thanks once again. I think its working nicely but I don't get anything
from my send command but I can see the response and its not the WSDL now
but the response from the server.

Will have to check that its working 100% but is there any reason why
there is no result from the send command?

$result = $client->send($msg, $wsdlfile, 60, 60);

thanks again
--
------------------------------------------------------------------------
Angelo Zanetti
Systems developer
------------------------------------------------------------------------

*Telephone:* +27 (021) 552 9799
*Mobile:* +27 (0) 72 441 3355
*Fax:* +27 (0) 86 681 5885
*
Web:* http://www.zlogic.co.za
*E-Mail:* angelo@zlogic.co.za <mailto:angelo@zlogic.co.za>
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 04:51 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0