Submitted by william.skellor... on December 1, 2011 - 04:03
I have set-up wso2 PHP WS 2.1.0 framework on a centos server (PHP 5.2.10, apache/2.2.3) with the native PHP SOAP extension active. The sample WS clients work fine. The only difference in my WS installation to the default is that the wsf files are in the path structure /usr/lib64/php/modules/wsf_c/ instead of /var/lib/.
I am having trouble generating a complete SOAP request using the following client script -
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
$reqPayloadString = <<<XML
<soap:Envelope xmlns:soap=”http://www.w3.org/2003/05/soap-envelope” xmlns:typ=”http://service.dataxmldistribution.argos.cls.fr/types”>
<soap:Header/>
<soap:Body>
<typ:xmlRequest>
<typ:username>user</typ:username>
<typ:password>password</typ:password>
<typ:platformId>'1,2,3,4,5'</typ:platformId>
<typ:nbDaysFromNow>10</typ:nbDaysFromNow>
</typ:xmlRequest>
</soap:Body>
</soap:Envelope>
XML;
$reqMessage = new WSMessage($reqPayloadString);
try {
$client = new WSClient(array(
"wsdl" => "http://ws-argos.cls.fr/argosDws/services/DixService?wsdl",
"to" => "http://ws-argos.cls.fr/argosDws/services/DixService",
"useSOAP" => 1.2,
"action"=>"getXml"
));
$resMessage = $client->request($reqPayloadString);
printf("Response = %s <br/>\n", htmlspecialchars($resMessage->str));
} catch (Exception $e) {
if ($e instanceof WSFault) {
printf("Soap Fault: %s\n", $e->code);
} else {
printf("Message = %s\n",$e->getMessage());
}
}
printf("<br/> Request = %s </br>",
htmlspecialchars($client->getLastRequest()));
printf("<br/> Response = %s </br>",
htmlspecialchars($client->getLastResponse()));
?>
The script returns the following -
Message = Invalid Input Message
Request = <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body></soapenv:Body></soapenv:Envelope>
Response = <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Body><soap:Fault><soap:Code><soap:Value>soap:Receiver</soap:Value></soap:Code><soap:Reason><soap:Text xmlns:xml="http://www.w3.org/XML/1998/namespace" xml:lang="en">Fault occurred while processing.</soap:Text></soap:Reason></soap:Fault></soap:Body></soap:Envelope>
I've also attached the client log, which shows one error - 'om_document.c(102) Unable to get root node'.
I assume that the fact that the xml request is missing from within the body element in the print-out from getLastRequest that I need to format the package xml differently - possibly with namespaces? I am usure how this should look, so would be extremely gratefully of any advice, if this is the issue. I have tried this request with and without the 'wsdl' referenced in the WSClient array, and tried defining the payload as an array instead of an XML string (as you might with a native SOAP request).
Thank you, William
Hi William, Your payload
Martin - Thanks for the
Martin,1. From reading the
Hi William, Your payload
Alternate option - WSDL and proxy