Click here to Skip to main content
15,909,445 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
Dear All,

Anybody please tell me, How to read XML in PHP. Actually I have used web service in my PHP client. My web service was written in C# and ASP.Net which returning me data in the from of XML. Now, Since I am very much new to PHP, I don't know how to get that data and how I can show it in form of table.

Here I want to check whether my service is platform independent or not, and that's why I am trying to consume it in PHP.

Here I am giving my web service code for your reference.

C#
[WebMethod(Description = "web service to get Data in Xmlformat")]
   public System.Xml.XmlElement getData()
   {
       string conn = WebConfigurationManager.ConnectionStrings["mycon"].ConnectionString;
           OleDbConnection cn = new OleDbConnection(conn);


               cn.Open();
               OleDbCommand cmd = new OleDbCommand("SELECT * FROM [Sheet1$]", cn);
               OleDbDataAdapter da = new OleDbDataAdapter();
               da.SelectCommand = cmd;

               DataSet ds = new DataSet();
               da.Fill(ds, "test");

               //DataTable dt = ds.Tables[0];

               //System.Xml.XmlDocument xd = new System.Xml.XmlDocument(ds);
               System.Xml.XmlDataDocument xdd = new System.Xml.XmlDataDocument(ds);

               System.Xml.XmlElement docEle = xdd.DocumentElement;

               return docEle;



   }

I want to consume the service using nusoap client. How to do it?

Thanks in Advance..
Posted
Updated 12-Feb-12 23:41pm
v2

 
Share this answer
 
v2
PHP
<?php <br mode="hold" /?>
require_once('../lib/nusoap.php');

$wsdl = "http://www.abc.com/excelserver/xmlserver.asmx?wsdl";

$mynamespace = "http://www.abc.com/excelserver/";

$s = new nusoap_client($wsdl,true);

//$xml = new xmlschema($wsdl);

/*$theVarible = array('i'=>'2');*/

$result = $s->call('getData');

echo "<h1> "; print_r($result); print "</h1>";

?>


but it returns me in the form of string. I want to show it in form of xmlElement only. :P
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900