WCF Service
Posted: Sat Apr 03, 2010 8:39 pm
Hello,
I am hoping someone can hold my hand through this... I have had not experience with web services calls until a recent project has required it.
I spent probably a good 6 hours going through the php.net documentation site for the SoapClient::__soapCall function but all the examples I have tried from that have not worked out..
I have also looked here and this thread is pretty much my exact question but the response from someone is to go look at the php.net site.
viewtopic.php?f=1&t=106716&p=568888&hilit=wcf#p568888
here is the email section where the developer sent me the quick info on the service... Not sure if those are named parameters or if they are just place holder examples????
I essentially need to call this service and parse the value from the keys
right now it is returning empty values in the var_dump so I dont know if I am sending th call correctly.
I also dont know how to handle the error at the end of the output and what process I would take to parse the value from each key once it is returned succesfully.
Here is the php client call
Here is the output....
Thanks Much!
I am hoping someone can hold my hand through this... I have had not experience with web services calls until a recent project has required it.
I spent probably a good 6 hours going through the php.net documentation site for the SoapClient::__soapCall function but all the examples I have tried from that have not worked out..
I have also looked here and this thread is pretty much my exact question but the response from someone is to go look at the php.net site.
viewtopic.php?f=1&t=106716&p=568888&hilit=wcf#p568888
here is the email section where the developer sent me the quick info on the service... Not sure if those are named parameters or if they are just place holder examples????
I unfortunatly best learn from a problem I have and someone showing me where I might be going wrong as apposed to trying to interperet someone elses code structure to my own.
The method you will call GetSPSOrderData(this.txtOrderNumber.Text,string.Empty,
string.Empty,string.Empty) which will return an array of key/value pairs.
I essentially need to call this service and parse the value from the keys
right now it is returning empty values in the var_dump so I dont know if I am sending th call correctly.
I also dont know how to handle the error at the end of the output and what process I would take to parse the value from each key once it is returned succesfully.
Here is the php client call
Code: Select all
<?php
header('Content-Type: text/plain');
$ordernumber = "XAT10000119";
try
{
$client = new SoapClient("http://someserver.domain.local/eReetWCFService/eReetService.svc?wsdl");
echo("<br />Dumping client object:<br />");
var_dump($client);
echo("<br /><br />");
echo("Dumping client functions:<br />");
var_dump($client->__getFunctions());
echo("<br /><br />");
$parameters = array("this.txtOrderNumber.Text" => $ordernumber, "string.Empty" => "", "string.Empty" => "", "string.Empty" => "");
echo("Calling SOAP function with params $ordernumber<br /><br />");
$objresult = $client->GetSPSOrderData($parameters);
if( is_soap_fault($objresult) == true )
{
echo "There was an error.<br /><br />";
}
else
{
var_dump($objresult);
$simpleresult = $objresult->GetSPSOrderDataResult;
echo("Result: ". $simpleresult."<br /><br />");
}
}
catch(Exception $e)
{
echo "Exception: ". $e->getMessage(). "\n";
}
?>
Here is the output....
Any help would be great otherwise a whole lot of trial and error.Dumping client object:
object(SoapClient)#1 (2) { ["_soap_version"]=> int(1) ["sdl"]=> resource(12) of type (Unknown) }
Dumping client functions:
array(1) { [0]=> string(68) "GetSPSOrderDataResponse GetSPSOrderData(GetSPSOrderData $parameters)" }
Calling SOAP Add function with params XAT10000119
object(stdClass)#2 (1) { ["GetSPSOrderDataResult"]=> object(stdClass)#3 (1) { ["KeyValueOfstringstring"]=> array(102) { [0]=> object(stdClass)#4 (2) { ["Key"]=> string(38) "order.Buyer[0].CurrentAddress1Address2" ["Value"]=> string(0) "" } [1]=> object(stdClass)#5 (2) { ["Key"]=> string(26) "order.Buyer[0].CurrentCity" ["Value"]=> string(0) "" } [2]=> object(stdClass)#6 (2) { ["Key"]=> string(34) "order.Buyer[0].CurrentCityStateZip" ["Value"]=> string(0) "" } [3]=> object(stdClass)#7 (2) { ["Key"]=> string(27) "order.Buyer[0].CurrentPhone" ["Value"]=>
---- Lots more here ---
" ["Value"]=> string(0) "" } [97]=> object(stdClass)#101 (2) { ["Key"]=> string(29) "order.Seller[0].ForwardingZip" ["Value"]=> string(0) "" } [98]=> object(stdClass)#102 (2) { ["Key"]=> string(30) "order.Seller[0].Person[0].Name" ["Value"]=> string(0) "" } [99]=> object(stdClass)#103 (2) { ["Key"]=> string(30) "order.SellerAllNamesWithCommas" ["Value"]=> string(0) "" } [100]=> object(stdClass)#104 (2) { ["Key"]=> string(45) "order.SettlementAgent[0].Person[0].LookupCode" ["Value"]=> string(0) "" } [101]=> object(stdClass)#105 (2) { ["Key"]=> string(39) "order.SettlementAgent[0].Person[0].Name" ["Value"]=> string(0) "" } } } }
Catchable fatal error: Object of class stdClass could not be converted to string in C:\Inetpub\wwwroot\ereet\ereet-form-mobilehome.php on line 106
Thanks Much!