I am working with an API and I am new to PHP SOAP.. I am trying to create a request to get a vehicle value and am looking to get the response value.
The following is a sample SOAP 1.1 request. The placeholders shown need to be replaced with actual values.
POST /vehicles/vehicle.asmx HTTP/1.1
Host: webservice.nada.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://webservice.nada.com/getDefaultVehicleAndValueByVin"
<?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>
<getDefaultVehicleAndValueByVin xmlns="http://webservice.nada.com/">
<vehicleRequest>
<Vin>string</Vin>
<Region>int</Region>
<Mileage>int</Mileage>
</vehicleRequest>
</getDefaultVehicleAndValueByVin>
Here is the SOAP Client URL Call -
$clientV = new soapclient('http://webservice.nada.com/vehicles/vehicle.asmx?wsdl',array(
// Stuff for development. 'trace' => 1,'exceptions' => 1, 'cache_wsdl' => 0));
This is what ive tried but get no result -
$clientV = new soapclient('http://webservice.nada.com/vehicles/vehicle.asmx?wsdl',array(// Stuff for development. 'trace' => 1,'exceptions' => 1, 'cache_wsdl' => 0));
$params = new \SoapVar("<vehicleRequest><Vin>5YFBURHE3FP331896</Vin><Region>10</Region><Mileage>100000</Mileage></vehicleRequest>", XSD_ANYXML);
$result = $client->Echo($params);
Another method I tried but get error parsing WSDL
$wsdl = '
POST /vehicles/vehicle.asmx HTTP/1.1
Host: webservice.nada.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://webservice.nada.com/getDefaultVehicleAndValueByVin"
<?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>
<getDefaultVehicleAndValueByVin xmlns="http://webservice.nada.com/">
<vehicleRequest>
<Vin>5YFBURHE3FP331896</Vin>
<Region>1</Region>
<Mileage>100</Mileage>
</vehicleRequest>
</getDefaultVehicleAndValueByVin>
</soap:Body>
</soap:Envelope>
';
try {
$clientC = #new SOAPClient($wsdl); for $wsdl
$response = $clientC->getDefaultVehicleAndValueByVin(array('key' => 'val'));
} catch (Exception $e) {
echo $e->getMessage();
}
die(var_dump($response));
Here is the error I get -
SOAP-ERROR: Parsing WSDL: Couldn't load from ' POST /vehicles/vehicle.asmx HTTP/1.1 Host: webservice.nada.com Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://webservice.nada.com/vehicles/vehicle.asmx?wsdl" 5YFBURHE3FP331896 1 100 ' : failed to load external entity " POST /vehicles/vehicle.asmx HTTP/1.1 Host: webservice.nada.com Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://webservice.nada.com/vehicles/vehicle.asmx?wsdl"
Something like this should help you get started. I am not 100% familiar with the NADA API so I don't know what valid values are for some of the parameters... you'll have to fill in the correct values (e.g. for Token, Period, VehicleType, and Region).
$clientV = new SoapClient('http://webservice.nada.com/vehicles/vehicle.asmx?wsdl',array('trace' => 1,'exceptions' => 1, 'cache_wsdl' => 0));
$params = new stdClass();
$params->Token = '';
$params->Period = 1;
$params->VehicleType = '';
$params->Vin = '5YFBURHE3FP331896';
$params->Region = 1;
$params->Mileage = 100;
$result = $clientV->getDefaultVehicleAndValueByVin(array('vehicleRequest' => $params));
Related
I'm making a SOAP call through php to an external webservice. I finally have it working. The last step is just parsing the response from the SOAP service.
When I do :
echo '{"reference": "'.$client->__getLastResponse().'", "success":"true"}';
I expect to get and I see as the HTML webpage response:
{"reference": "000002R5281191606961", "success":"true"}
However when I look in developer tools source/preview I see this:
{"reference": "<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetPaynetReferenceResponse xmlns="http://www.paynet.com.mx/"><GetPaynetReferenceResult><RespCode>0</RespCode><RespDesc /><PaynetReference>00002R5281191606961</PaynetReference></GetPaynetReferenceResult></GetPaynetReferenceResponse></soap:Body></soap:Envelope>", "success":"true"}
Pretty much the variable I need is in the middle of a ton of XML stuff! How can I just pull out the needed variable, and return it as a json?
In case it helps, here's my code:
$wsdl = 'http://201.147.99.51//PaynetCE/WSPaynetReference.asmx?WSDL';
$trace = true;
$exceptions = false;
$client = new SoapClient($wsdl, array('trace' => $trace, 'exceptions' => $exceptions));
$response = $client->__soapCall("GetPaynetReference", array($data));
echo"<pre>";
print_r($client);
echo"</pre>";
echo"<pre>";
print_r($client->__last_response);
echo"</pre>";
This all seems to work, I get the following output in the html/php page:
SoapClient Object
(
[trace] => 1
[_exceptions] =>
[_soap_version] => 1
[sdl] => Resource id #2
[__last_request] =>
3c090569-1044-48a8-9bc3-de3c8db22a80Recarga tu saldo Elepago.NUMCLIENTE528119160696
[httpsocket] => Resource id #3
[_use_proxy] => 0
[httpurl] => Resource id #4
[__last_request_headers] => POST /PaynetCE/WSPaynetReference.asmx HTTP/1.1
Host: 201.147.99.51
Connection: Keep-Alive
User-Agent: PHP-SOAP/5.4.4
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://www.paynet.com.mx/GetPaynetReference"
Content-Length: 626
[__last_response_headers] => HTTP/1.1 200 OK
Date: Wed, 07 May 2014 23:57:45 GMT
Server: Microsoft-IIS/6.0
X-UA-Compatible: IE=EmulateIE7
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Content-Length: 478
[__last_response] => 000002R5281122606961
)
000002R5281122606961
The __last_response is the code I need. I'm trying to send it as a JSON.
When I look at the developer tools at the preview/source of the page I get this:
<pre>SoapClient Object
(
[trace] => 1
[_exceptions] =>
[_soap_version] => 1
[sdl] => Resource id #2
[__last_request] => <?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.paynet.com.mx/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Body><ns1:GetPaynetReference><ns1:issuerCod>3c090569-1044-48a8-9bc3-de3c8db22a80</ns1:issuerCod><ns1:description>Recarga tu saldo Elepago.</ns1:description><ns1:params><ns1:Parameter><ns1:Name>NUMCLIENTE</ns1:Name><ns1:Value xsi:type="xsd:string">528119160696</ns1:Value></ns1:Parameter></ns1:params></ns1:GetPaynetReference></SOAP-ENV:Body></SOAP-ENV:Envelope>
[httpsocket] => Resource id #3
[_use_proxy] => 0
[httpurl] => Resource id #4
[__last_request_headers] => POST /PaynetCE/WSPaynetReference.asmx HTTP/1.1
Host: 201.147.99.51
Connection: Keep-Alive
User-Agent: PHP-SOAP/5.4.4
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://www.paynet.com.mx/GetPaynetReference"
Content-Length: 626
[__last_response_headers] => HTTP/1.1 200 OK
Date: Wed, 07 May 2014 23:57:45 GMT
Server: Microsoft-IIS/6.0
X-UA-Compatible: IE=EmulateIE7
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Content-Length: 478
[__last_response] => <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetPaynetReferenceResponse xmlns="http://www.paynet.com.mx/"><GetPaynetReferenceResult><RespCode>0</RespCode><RespDesc /><PaynetReference>00002R5281191606961</PaynetReference></GetPaynetReferenceResult></GetPaynetReferenceResponse></soap:Body></soap:Envelope>
)
</pre><pre><?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetPaynetReferenceResponse xmlns="http://www.paynet.com.mx/"><GetPaynetReferenceResult><RespCode>0</RespCode><RespDesc /><PaynetReference>00002R5281191606961</PaynetReference></GetPaynetReferenceResult></GetPaynetReferenceResponse></soap:Body></soap:Envelope></pre>
Use the SimpleXMLElement::xpath method with the following path...
/soap:Envelope/soap:Body/a:GetPaynetReferenceResponse/a:GetPaynetReferenceResult/a:PaynetReference/text()
after registering the following namespace prefixes with SimpleXMLElement::registerXPathNamespace:
Prefix Namespace
------ ---------
xsi http://www.w3.org/2001/XMLSchema-instance
xsd http://www.w3.org/2001/XMLSchema
soap http://schemas.xmlsoap.org/soap/envelope/
xml http://www.w3.org/XML/1998/namespace
a http://www.paynet.com.mx/
Taking this approach, transform...
echo '{"reference": "'.$client->__getLastResponse().'", "success":"true"}';
...as follows:
$xml = new SimpleXMLElement($client->__getLastResponse());
$xml->registerXPathNamespace('xsi', 'http://www.w3.org/2001/XMLSchema-instance');
$xml->registerXPathNamespace('xsd', 'http://www.w3.org/2001/XMLSchema');
$xml->registerXPathNamespace('soap', 'http://schemas.xmlsoap.org/soap/envelope/');
$xml->registerXPathNamespace('xml', 'http://www.w3.org/XML/1998/namespace');
$xml->registerXPathNamespace('a', 'http://www.paynet.com.mx/');
$xpath = '/soap:Envelope/soap:Body/a:GetPaynetReferenceResponse/a:GetPaynetReferenceResult/a:PaynetReference/text()';
$result = $xml->xpath($xpath);
if ($result != FALSE && count($result) > 0) {
echo '{"reference": "' . $result[0] . '", "success":"true"}';
} else {
// TODO: Whatever....
}
EDIT:
To be perfectly clear about exactly how I checked this solution, here is the PoC I sketched without being able to use $client->__getLastResponse() per se:
<html>
<head><title>PoC Page</title></head>
<body>
<?php
// FORNOW - Use $lastResponse since I can't really use $client->__getLastResponse() for a PoC.
$lastResponse = '<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetPaynetReferenceResponse xmlns="http://www.paynet.com.mx/"><GetPaynetReferenceResult><RespCode>0</RespCode><RespDesc /><PaynetReference>00002R5281191606961</PaynetReference></GetPaynetReferenceResult></GetPaynetReferenceResponse></soap:Body></soap:Envelope>';
$xml = new SimpleXMLElement($lastResponse);
//$xml = new SimpleXMLElement($client->__getLastResponse());
$xml->registerXPathNamespace('xsi', 'http://www.w3.org/2001/XMLSchema-instance');
$xml->registerXPathNamespace('xsd', 'http://www.w3.org/2001/XMLSchema');
$xml->registerXPathNamespace('soap', 'http://schemas.xmlsoap.org/soap/envelope/');
$xml->registerXPathNamespace('xml', 'http://www.w3.org/XML/1998/namespace');
$xml->registerXPathNamespace('a', 'http://www.paynet.com.mx/');
$xpath = '/soap:Envelope/soap:Body/a:GetPaynetReferenceResponse/a:GetPaynetReferenceResult/a:PaynetReference/text()';
$result = $xml->xpath($xpath);
if ($result != FALSE && count($result) > 0) {
echo '{"reference": "' . $result[0] . '", "success":"true"}';
} else {
// TODO: Whatever....
}
?>
</body>
</html>
Thanks J0e3gan for the answer! Worked perfect. I also found that this alternative works well. Basically create a new DOM, and just grab whats inside the tags.
$doc = new DOMDocument('1.0', 'utf-8');
$doc->loadXML( $soapResponse );
$XMLresults = $doc->getElementsByTagName("SearchFlightAvailability33Response");
$output = $XMLresults->item(0)->nodeValue;
Courtesy of:
How to convert SOAP response to PHP Array?
As I am pretty new to SOAP I really need some help to get started. I have been given this structur:
request:
POST /NumbriParing/NumbriParing.asmx HTTP/1.1
Host: nba.tja.ee
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://nba.sa.ee/NumriomanikuParing"
<?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>
<NumriomanikuParing xmlns="http://nba.sa.ee/">
<number>long</number>
</NumriomanikuParing>
</soap:Body>
</soap:Envelope>
Response:
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?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>
<NumriomanikuParingResponse xmlns="http://nba.sa.ee/">
<NumriomanikuParingResult>
<Number>long</Number>
<OmanikuRegNumber>string</OmanikuRegNumber>
<Omanik>string</Omanik>
<VastusKood>NumberLeitud or NumbritEiLeitud</VastusKood>
</NumriomanikuParingResult>
</NumriomanikuParingResponse>
</soap:Body>
</soap:Envelope>
I need to replace the "long" placeholder in the request with a numeric variable to get the request for that number.
The asmx is located in https://nba.tja.ee/NumbriParing/NumbriParing.asmx
How Can it be done using php?
Best regards,
Martti
Use SoapClient and WSDL of the service you need.
Something like:
try {
$client = new SoapClient('https://nba.tja.ee/NumbriParing/NumbriParing.asmx?WSDL');
$param = new stdClass();
$param->number = 123;
$result = $client->NumriomanikuParing($param);
var_dump($result);
} catch (Exception $e) {
echo "Error: " . $e->getMessage();
}
I am a Beginner of soap, How do i send soap request? i searched in google and tried different methods but sadly it didn't worked for me.
i really appreciated your help.
here's the sample request that i should send:
POST /Universal/WebService.asmx HTTP/1.1
Host: www.sample.com
Content-Type: text/xml;charset="utf-8"
Content-Length: length
SOAPAction: https://www.sample.com/Universal/WebService.asmx/Request
<?xml version=\"1.0\" encoding=\"utf-8\"?>
<soap:Envelope xmlns:xsi="http://wwww.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Request xmlns="https://www.sample.com/Universal/WebService.asmx">
<ID>CPHK01</ID>
<UID>TEST</UID>
<PWD>TEST</PWD>
<target_mpn>09183530925</target_mpn>
<amount>115</amount>
<ref_no>20060830143030112</ref_no>
<source_mpn>67720014</source_mpn>
</Request>
</soap:Body>
</soap:Envelope>
here's the response:
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version = "1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://wwww.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<RequestResponse xmlns="https://www.sample.com/Universal/WebService.asmx">
<RequestResult>
<Ref_no>20060830143030112</Ref_no>
<StatusCode>101</StatusCode>
</RequestResult>
</RequestResponse>
</soap:Body>
</soap:Envelope>
PHP has a native SoapClient class. The constructor takes the WSDL as an argument. This is preferred to cURL because the SoapClient handles all of the SOAP intricacies and it allows you to deal with native objects and arrays and removes the need to manually build the SOAP envelope and XML.
try {
$client = new SoapClient('https://www.sample.com/Universal/WebService.asmx?wsdl');
$response = $client->Request(array(
'ID' => 'xxxx',
'UID' => 'xxxx',
'PWD' => 'xxxx',
'target_mpn' => 'xxxx',
'amount' => 'xxxx',
'ref_no' => 'xxxx',
'source_mpn' => 'xxxx'
));
print_r($response); // view the full response to see what is returned
// or get the response properties:
echo $response->RequestResult->Ref_no;
echo $response->RequestResult->StatusCode;
} catch (Exception $e) {
echo $e->getMessage();
}
This is my first time with web services/SOAP...i have been trying to consume .Net web services using PHP but to no avail. I have searched and read all pages that google throws up for anything related to this but i am still lost.
The thing is the SOAP service i am trying to call has an authorization header and i can't figure out a way to authenticate my request.
I have tried the php-soapclient and NuSoap both but there is no sample code available that would help. So any help would be great.
The following is a sample SOAP 1.1 request and response.
POST /OxiWalletService/Service.asmx HTTP/1.1
Host: 172.160.0.49
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/WS_GetData"
<?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>
<AuthHeader xmlns="http://tempuri.org/">
<UserName>string</UserName>
<Password>string</Password>
</AuthHeader>
</soap:Header>
<soap:Body>
<WS_GetData xmlns="http://tempuri.org/">
<xmlString>string</xmlString>
</WS_GetData>
</soap:Body>
</soap:Envelope>
Response
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?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>
<WS_GetDataResponse xmlns="http://tempuri.org/">
<WS_GetDataResult>string</WS_GetDataResult>
</WS_GetDataResponse>
</soap:Body>
</soap:Envelope>
Can anybody please gimme a sample code on how to consume such a service.
Many thanks in advance!
This is the code that i have used to call the web service
<?php
$soap_client = new SoapClient("http://172.160.0.49/OxiWalletService/Service.asmx?WSDL");
$Uid='oxigen';
$Pwd='oxigen';
$ns = "http://tempuri.org/";
//Body of the Soap Header.
$headerbody = array('UserName' => $Uid,
'Password' => $Pwd
);
//Create Soap Header.
$header = new SOAPHeader($ns, 'AuthHeader', $headerbody);
//set the Headers of Soap Client.
$soap_client->__setSoapHeaders($header);
$par="<Wallet><SPName>AuthenticateMerchantWebVending</SPName><Parameters><Parameter><Name>#Account</Name><Size>50</Size><Value>1135600016</Value><Type>varchar</Type></Parameter><Parameter><Name>#Password</Name><Size>20</Size><Value>0OgknrdonyM=</Value><Type>varchar</Type></Parameter></Parameters><ParameterCount>2</ParameterCount><DataBase>1</DataBase></Wallet>";
$param=array('xmlString'=>$par);
$result=$soap_client->__SoapCall('WS_GetData',$param);
print_r ($result);
?>
and i am getting the following as output:
stdClass Object ( [WS_GetDataResult] => 2Unknown Error )
Ideas??
So it turns out you've to pass the second argument with parameters as the key of the array
meaning this
$result=$soap_client->__SoapCall('WS_GetData',$param);
should be
$result=$soap_client->__SoapCall('WS_GetData',array('parameters'=>$param));
This works now.
I think this should do the trick:
www.php.net/manual/en/soapclient.setsoapheaders.php
$ns = "http://tempuri.org/"
//Body of the Soap Header.
$headerbody = array('UserName' => $yourUsername,
'Password' => $yourPassword,
);
//Create Soap Header.
$header = new SOAPHeader($ns, 'AuthHeader', $headerbody);
//set the Headers of Soap Client.
$soap_client->__setSoapHeaders($header);
making a call to a web service method with nusoap returns an error
array(3) { ["faultcode"]=> string(11) "soap:Client" ["faultstring"]=> string(516) "System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: . at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest() at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message) at System.Web.Services.Protocols.SoapServerProtocol.Initialize() at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)" ["detail"]=> string(0) "" }
is the fault in my calling or with the soap server?
$response = $qes->call('GetXhtml',$url);
var_dump($response);
Above is the call to the function, which accepts 1 parameter ($url) which I have checked as valid.
-------FULL CODE-----
<?php
//include nusoap class
require 'extensions/nusoap/lib/nusoap.php';
//connect to QES
$qes = new nusoap_client("https://www.qes24.com/swindon/ppa/uat/contentserver/contentserver/contentserver.asmx");
$qes->useHTTPPersistentConnection();
$qes->soap_defencoding = 'utf-8';
//check connection
$error = $qes->getError();
//get current page
$curl = curPageURL();//function derives current URL
$furl = $curl."?Type=8AFCCCB9-93DC-421E-A617-92A990EC99A7";
$param = array('url' => $furl);
$response = $qes->call('getXhtml', $param, '','http://tempuri.org/GetXhtml', array('content-type' => 'UTF-8'), true,null,'rpc','literal');
fb::log($response);
// Display the request and response
echo '<h2>Request</h2>';
echo '<pre>' . htmlspecialchars($qes->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2>';
echo '<pre>' . htmlspecialchars($qes->response, ENT_QUOTES) . '</pre>';
//*/
The request SHOULD look like this (according to the company providing the service)
POST /swindon/ppa/uat/ContentServer/ContentServer/ContentServer.asmx HTTP/1.1
Host: www.qes24.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/GetXhtml"
<?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>
<GetXhtml xmlns="http://tempuri.org/">
<url> http://localhost/waggleb/?Type=8AFCCCB9-93DC-421E-A617-92A990EC99A7</url>
</GetXhtml>
</soap:Body>
</soap:Envelope>
?>
Actual Full Request made by Nusoap:
POST /swindon/ppa/uat/contentserver/contentserver/contentserver.asmx HTTP/1.1
Host: www.qes24.com
User-Agent: NuSOAP/0.9.5 (1.123)
Connection: close
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://tempuri.org/GetXhtml"
Content-Length: 516
<?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/"><SOAP-ENV:Header><content-type xsi:type="xsd:string">UTF-8</content-type></SOAP-ENV:Header><SOAP-ENV:Body><url xsi:type="xsd:string">http://localhost/waggleb/?Type=8AFCCCB9-93DC-421E-A617-92A990EC99A7</url></SOAP-ENV:Body></SOAP-ENV:Envelope>
Full response:
HTTP/1.1 200 OK
Date: Mon, 07 Feb 2011 10:50:25 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Content-Length: 329
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetXhtmlResponse xmlns="http://tempuri.org/"><GetXhtmlResult /></GetXhtmlResponse></soap:Body></soap:Envelope>
From the error that's being returned, I'd guess (but I can't be certain without knowing which API you're trying to use) that the problem is the method name. Perhaps it's cased incorrectly? Either way, this means that the server can't direct your SOAP request to the correct module.