Re: nuSoap client SOAP Call problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





Thijs Lensselink wrote:
Angelo Zanetti wrote:

Thijs Lensselink wrote:
On Fri, 24 Aug 2007 07:57:48 +0200, Angelo Zanetti
<angelo@xxxxxxxxxxxx> 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@xxxxxxxxxxxx <mailto:angelo@xxxxxxxxxxxx>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux