PHP/.NET Web Services. My Battles
I am working on a project, coding in PHP (a language I am still relatively new in) and I have to consume a web service written in ASP.NET. And yes, I had to provide support in writing the web service, so I know quite a bit about how it works, internally.
My headaches started with consuming the results in PHP. All I got was a response “Array”. Nothing more. New to PHP, it took me a while to figure that I could display the results using the print_r function. Also, I could access some part of the array. Fine.
I am using the NuSOAP library as I learnt that .NET Web Services tend largely to SOAP.
I then noticed that the web service could not read my input. Blast. Long story short, I fund out that I had to wrap the parameters in a parameters array.
require_once('libs/nusoap.php');
/* Initialize parameter */
$PayerID = $_POST['PayerID'];
$param = array('sortOrder'=>$PayerID);
/* create the client for my rpc/encoded web service */
$wsdl = "http://192.168.200.187/PayTesting.asmx?WSDL";
$client = new soapclient($wsdl,true);
$err = $client->getError();
// Let NuSoap extract the correct target namespace from the WSDL!
$result = $client->call('FetchData', array('parameters' =>$param));
I hope this helps someone.
If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.
Comments
FDNY firefighter killed by boy’s…
… night after battling the blaze in Brooklyn’s Crown Heights area. Fire department officials said he was found unconscious…
Looks perfectly straight to me. Of course, I’m also the type of person who allegedly [ahem! allegedly] agree with everything.

Heeling touch - Pretoria News…
NG: It sounds like you’re stuck in the ’80s. EA: [Laughs] I probably am! But I think I’ve done a…