How to get web service returned XML in a array formatted way


#1

I have made a web service using c# which return a datattable and the XML i got is the following:
[php]
<xs:schema xmlns="" xmlns:xs=“http://www.w3.org/2001/XMLSchema” xmlns:msdata=“urn:schemas-microsoft-com:xml-msdata” id=“NewDataSet”>
<xs:element name=“NewDataSet” msdata:IsDataSet=“true” msdata:UseCurrentLocale=“true”>
xs:complexType
<xs:choice minOccurs=“0” maxOccurs=“unbounded”>
<xs:element name=“SacMaster”>
xs:complexType
xs:sequence
<xs:element name=“slno” type=“xs:int” minOccurs=“0”/>
<xs:element name=“serviceName” type=“xs:string” minOccurs=“0”/>
<xs:element name=“sacNo” type=“xs:string” minOccurs=“0”/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<diffgr:diffgram xmlns:msdata=“urn:schemas-microsoft-com:xml-msdata” xmlns:diffgr=“urn:schemas-microsoft-com:xml-diffgram-v1”>


1
HOUSEKEEPING/PANTRY BOY
998533


2
SECURITY GUARD
998525


3
Other Employment
998519


</diffgr:diffgram>
[/php]

And i use the following code for consuming the web service:
[php]<?php
$client = new SoapClient(“http://localhost:49439/Service1.asmx?WSDL”);
$params1 = array( ‘k’ => ‘202’);
$result2 = $client->Get_SAC($params1)->Get_SACResult;
print_r($result2);
?>[/php]

The output i got from this code is:
[php]stdClass Object ( [schema] => [any] => 1HOUSEKEEPING/PANTRY BOY9985332SECURITY GUARD9985253Other Employment998519 )[/php]

But i want the output in such way by which i can make a table that will look like:

slno |Description |Code

1 |HOUSEKEEPING/PANTRY BOY |998533
2 |SECURITY GUARD |998525
3 |Other Employment |998519

Please help me to solve the problem and i am new in this web service field so please correct me where i have done mistake.
Thank you.


#2

Where is the function Get_SAC coming from? It isn’t part of the SoapClient class.

And use SOAP? Just a question, I deal with it every day, just not in PHP.