Re: nuSoap client SOAP Call problem

From: Date: Fri, 24 Aug 2007 10:20:01 +0000
Subject: Re: nuSoap client SOAP Call problem
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-261224@lists.php.net to get a copy of this message
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 -- ------------------------------------------------------------------------ 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>

« previous php.general (#261224) next »