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>';
Thank you very much.