Quantcast
Viewing latest article 7
Browse Latest Browse All 11

PHP SOAP returning SOAP Fault: Server was unable to process

I am having difficulty in getting a SOAP request working properly , which requires XML string as input.
It’s throwing
“SOAP Fault: Server was unable to process request. —> Value cannot be null. Parameter name: s”
no matter what input i send , i have used nusoap but to no avail , PHP soap library. The code i am using is:

$aOptions = array(
‘location’ => ‘http://webserviceurl.asmx’,
‘uri’ => ‘http://tempuri.org/’,
“style” => SOAP_RPC,
“use” => SOAP_ENCODED
);
$client = new SOAPClient(null, $aOptions);

$request =’


description
department
brand
lastsold
lastupdated
quantityonhand
weight


quantityonhand
greaterthan
20


lastsold
greaterthan
01-01-2005




lastsold
ascending


quantityonhand
descending


‘;

//$result = $client->__soapCall(‘getAllInfo’,array(‘infoRequestXml’=>(string)($request),’errorMessage’=>”) ,array(‘soapaction’ => ‘http://webserviceurl/getAllInfo’));

$soapvar = new SoapVar($request , XSD_ANYXML);

$params = array(“infoRequestXml” => $soapvar);

//print_r($params);
//$result = $this->soapclient->__soapCall(“SaveItem”, array(“parameters”=>$params), null, $this->soapheaders);
try
{
$result=$client->__soapCall(‘getAllInfo’,array(“parameters”=>$params),array(‘soapaction’ => ‘http://webserviceurl/getAllInfo’));
}
catch (SoapFault $e) {
echo “SOAP Fault: “.$e->getMessage().”
\n”;
}
echo “

\n";
echo htmlspecialchars($client->__getLastRequest())."\n";
echo "Response:\n".htmlspecialchars($client->__getLastResponse())."\n";
echo "

“;

var_dump($result);

?>I am banging my head against a wall from last two days, searched google for this problem but got no answer that solves or guide me through.
Anyone who can throw some light on this will be highly appreciated. Thanks in advance.
…………………………………….

Don’t run the XML through SOAPVar, and take advantage of the WSDL option of your web service if you can:

$client = new SOAPClient(
‘http://webserviceurl.asmx?WSDL’,
array(
‘location’ => ‘http://webserviceurl.asmx’,
‘trace’ => 1,
‘style’ => SOAP_RPC,
‘use’ => SOAP_ENCODED,
)
);

$request = ‘


description
department
brand
lastsold
lastupdated
quantityonhand
weight


quantityonhand
greaterthan
20


lastsold
greaterthan
01-01-2005




lastsold
ascending


quantityonhand
descending


‘;

$result = array();

$params = array(“infoRequestXml” => $request);

try {
$result = $client->__soapCall(‘getAllInfo’, array(“parameters”=>$params));
} catch (SoapFault $e) {
echo “SOAP Fault: “.$e->getMessage().”
\n”;
}

echo “

";
echo htmlspecialchars($client->__getLastRequestHeaders())."\n";
echo htmlspecialchars($client->__getLastRequest())."\n";
echo "Response:\n".htmlspecialchars($client->__getLastResponseHeaders())."\n";
echo htmlspecialchars($client->__getLastResponse())."\n";
echo "

“;

var_dump($result);

?>


Viewing latest article 7
Browse Latest Browse All 11

Trending Articles