My contemplations and diurnal novelties are publicized here


Consuming a dotnet web service that return dataset can be a nightmare to consume. I tried to consume it and Google several time to find a solution due to inappropriate/incomplete  solution i am writing one.

Here is a subset list of my useful search which you can use as a per-requisite:-

  1. http://stackoverflow.com/questions/279220/how-to-invoke-a-c-sharp-web-service-through-php
  2. http://php.net/manual/en/soapclient.soapcall.php
  3. http://superdotnet.codeplex.com/
  4. http://stackoverflow.com/questions/2749954/asmx-web-service-returning-xml-instead-of-json-in-net-4-0
  5. http://metrix.fcny.org/wiki/display/tips/How+to+Create+a+PHP+Client+for+a+.NET+and+SOAP-based+Web+Service+API
  6. http://stackoverflow.com/questions/5282930/consuming-net-web-services-with-complex-types-in-php

And here comes my solution:-

require_once(‘Zend/Soap/Client.php’);

$url = ‘http://mywebservice/Service.asmx?wsdl’;
$options = array
(    “soap_version” => SOAP_1_1,
“encoding” => “UTF-8”,
);
$client = new Zend_Soap_Client($url,$options);

$response = $client->GetBalanceSummary(
array(
“AccessKey”=>”13264”,
“AccountNo”=>”4546”,
“CustomerId”=>”4654”,
“Channel”=>”acb”,
“FundCode”=>”aadd”,
)
)->GetBalanceSummaryResult;

$xml = simplexml_load_string($response->any);
$testArray = $xml->xpath(“NewDataSet”);

$testArray2 = $testArray[0];
var_dump($testArray2[0]->Table1);

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: