Hi
I have writen a web service. this web service has a method that returnes a Table as XML format
and I need to use it as a table.
how can i use this web service as a table.
is any way to convert XML format to Table format
Thank you

Can you show the code that is returning the XML?

Yes of course
this is my code in Delphi prism

namespace;

interface

uses
  System,
  System.Web,
  System.Collections,
  System.Web.Services,
  System.Web.Services.Protocols,
  System.Data,
  System.Data.SqlClient,
  Microsoft.SqlServer.Server,
  System.Data.SqlTypes;

type
  [WebService(&Namespace := 'http://***.***.***.***')]
  [WebServiceBinding(ConformsTo := WsiProfiles.BasicProfile1_1)]
  Service = public class(System.Web.Services.WebService)
  public        
    method HelloWorld: string;
    method SUM(a,b:Integer):Integer;
    method GetData :DataTable;
  end;

implementation

[WebMethod]
method Service.HelloWorld: string;
begin
  result := 'Hello World';
end;

[WebMethod]
method Service.SUM(a,b:Integer): Integer;
begin
  result := a+b;
end;

[WebMethod]
method Service.GetData: DataTable;
Var
  StrCon:String;
  Con:SqlConnection;
  DS:DataSet;
  Da:SqlDataAdapter;
begin
  Con:= New SqlConnection;
  Con.ConnectionString:='Data Source=***.***.***.***;Initial Catalog=Data_Transform;Persist Security Info=True;User ID=*****;Password=****';
  Con.Open;
  Da:= new SqlDataAdapter('Select * From ADAM1_In_Data',Con);
  DS:= new DataSet;
  Da.Fill(DS,'Table1');
  Con.Close;
  result:=DS.Tables[0];
  //.Rows[0].Item[7].ToString;
end;

end.

and its output in IE is attached as XML File

IIRC a DataSet has a LoadFromFile method which you can use to read the returned XML.

I Dont want to read XML File To a Dataset. I want to get the result of webservice methode as a Table;

On the outher hand
TClientDataset hase LoadFromFile method but it raise a run time error when I Try to load XML File

I want to get the result of webservice methode as a Table;

Not sure how to put XML in a Table component.

but it raise a run time error

What's the error?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.