hi all!
I am running behind an issues for a couple of days [SOAP is killing me]
Please find the code attached here - which is used to call data from a .NET
server. [I got this code from another site]
Some modifications have been done.- but am getting a result -
*"Server was unable to process request. ---> Object reference not set to
an instance of an object."*
The code follows -
require_once('nusoap/lib/nusoap.php');
// define the soapaction as found in the wsdl
$soapaction = "http://XXXXXX";
// endpoint address
$wsdl = "http://xxxx.asmx?WSDL";
$namespace = "http://XXXXX//";
$client = new nusoap_client($wsdl, true);
// you will find the serializeEnvelope() prototype by making a
search in nusoap.php
$mysoapmsg = $client->serializeEnvelope('<Search xmlns="http://XXXXX/">
<arrDate>23/10/2008</arrDate>
<depDate>29/10/2008</depDate>
<location>DOWNTOWN BURJ DUBAI</location>
<persons>2</persons>
<currency>AED</currency>
<agentid>xxxx</agentid>
<lngCode>xxxx</lngCode>
</Search>','',array(),'document', 'literal');
/* Send the SOAP message and specify the soapaction */
$response = $client->send($mysoapmsg, $soapaction);
if ($client->fault) {
echo '<h3>Fault</h3><pre>';
print_r($response);
echo '</pre>';
}
echo "<p>SOAP query</p>";
echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) .
'</pre>';
echo "<p>SOAP response</p>";
echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) .
'</pre>';
// start to use the result by following the structure of the SOAP
response
// first extract the SearchResult
$searchresult = $response["SearchResult"];
// then you can access the Status message
echo "Status message: ".$searchresult["Status"];
// continue with the Result level
$result = $searchresult["Result"];
// wich allow access to NumRecs (number of record found)
echo "<br>Record found: ".$result["NumRecs"];
// extract the collection of record (object collRecord)
$collrecord = $result["collRecord"];
foreach ($collrecord["CRecord"] as $record){
echo "<br>Property: ".$record["Property"];
echo "<br>Place: ".$record["Place"];
}
Can any one help? My skill level in SOAP is almost 0 :D
thanks!
--
-Sathish Menon
To accomplish great things, we must dream as well as act.