Tuesday 15 January 2013

c# - xml output from asp.net webservice -


I want to see the format as the output of my webservice, but it is empty, do you think of me How will this figure be?

I am using asp.net2

I would like to exit like:

  & lt ; Customer list & gt; & Lt; CustomerData & gt; & Lt; V_CUST_CODE value = "C1" /> & Lt; V_CUST_NAME value = "customer1" /> & Lt; / CustomerData & gt; & Lt; CustomerData & gt; & Lt; V_CUST_CODE value = "C2" /> & Lt; V_CUST_NAME value = "customer2" /> & Lt; / CustomerData & gt; & Lt; CustomerData & gt; & Lt; V_CUST_CODE value = "C2" /> & Lt; V_CUST_NAME value = "customer2" /> & Lt; / CustomerData & gt; & Lt; Customer list / & gt;   

Put my current status:

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; ArrayOfCustomerData xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns: xsd = "http://www.w3.org/2001/XMLSchema" xmlns = "http: // 123.23. 45.34 / sms / "/>   

My web service

  [WebShit] public list & lt; Customer Data & gt; GetFMSCustomerName () {string [] cols = {"V_CUST_CODE", "V_CUST_NAME"}; ArrayList Customer List = (ArrayList) db Select (Column, "Table 1", "", "Order by V_CUST_NAME"); & Lt; CustomerData & gt; Cd = new list & lt; Customer Data & gt; (); Foreign Currency (Detarro Dr. in Customer List) CD. Add (New Customer Data (Dr. ["V_CUST_CODE"]. ToString (), Dr. ["V_CUST_NAME"]. ToString ()); Return cd; } Public class customer data {Private string _V_CUST_CODE; Private string _V_CUST_NAME; Public string V_CUST_CODE {receive {this._V_CUST_CODE return; } Set {this._V_CUST_CODE = value; }} Public string V_CUST_NAME {get this._V_CUST_NAME; } Set {this._V_CUST_NAME = value; }} Public Client Data (string V_CUST_CODE, string V_CUST_NAME) {this.V_CUST_CODE = V_CUST_CODE; this. V_CUST_NAME = V_CUST_NAME; } Public Customer Data () {}}    

I use my code below code Resolve:

  public string getFMSCustomerName () {string [] cols = {"V_CUST_CODE", "V_CUST_NAME"}; ArrayList Customer List = (ArrayList) db Select (Column, "Table 1", "V_STATUS = 'A'", "Order by V_CUST_NAME"); // from the list & lt; CustomerData & gt; Cd = new list & lt; Customer Data & gt; (); XmlDocument Document = New XmlDocument (); XMLNode CustomerNode = Doctor Crelet Element ("Customer"); Doc.AppendChild (CustomersNode); Foreign Currency (DataRow dr in CustomerList) {// cd.Add (New Customer Data (Dr. ["V_CUST_CODE"]. ToString (), Dr. ["V_CUST_NAME"] ToString ()); XMLNode CustomerNode = Doctor Crelet Element ("Customer"); XMLNode V_CUST_CODENode = doc.CreateElement ("V_CUST_CODE"); V_CUST_CODENode.AppendChild (doc.CreateTextNode (Dr. ["V_CUST_CODE"] ToString ()).); CustomerNode.AppendChild (V_CUST_CODENode); XMLNode V_CUST_NAMENode = doc.CreateElement ("V_CUST_NAME"); V_CUST_NAMENode.AppendChild (doc.CreateTextNode (Dr. ["V_CUST_NAME"] ToString ()).); CustomerNode.AppendChild (V_CUST_NAMENode); CustomersNode.AppendChild (customerNode); } Return doc.OuterXml; }    

No comments:

Post a Comment