Page 1 of 1

Doubt with NuSoap call

Posted: Tue Feb 05, 2008 10:05 am
by guarriman
Hi.

I want to make a SOAP call via NuSoap. This is the call sample provided by the webservice:

Code: Select all

 
POST /foo/getinfo.asp HTTP/1.1
Host: webservice.domain.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://www.domain.com/webservices/getInfo"
 
<?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:Header>
    <UserCredentials xmlns="http://www.domain.com/webservices/">
      <UserName>string</UserName>
      <Password>string</Password>
    </UserCredentials>
  </soap:Header>
  <soap:Body>
    <GetInfo xmlns="http://www.domain.com/webservices/" />
  </soap:Body>
</soap:Envelope>
 

I tried with this PHP code

Code: Select all

 
$soapaction = "http://www.domain.com/webservices/getInfo";
$wsdl = "https://webservice.domain.com/foo/getInfo";
$client = new soapclient($wsdl);
 
$mysoapmsg = $client->serializeEnvelope('<UserCredentials xmlns="http://www.domain.com/webservices/">
<UserName>John</UserName>
<Password>xxxx</Password>
</UserCredentials>','',array(),'document', 'literal');   
 
$response = $client->send($mysoapmsg, $soapaction);
echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
 
But I received a "not valid user" response. Is this a valid request similar to the one suggested by the webservice?

Thank you very much.

Re: Doubt with NuSoap call

Posted: Sat Feb 09, 2008 10:54 am
by hannnndy
use nosoapClient object to call the mthod of the web service method over the wsdl

e.g.

Code: Select all

 
$nosoapClient  = new nusoap_client($wsdl);
$ret = $nosoapClient->__call('methodName','args');
echo($ret);
i think it does not matter you soap packet is it is important to call a valid method name