XML serialization to return an array of String

  • Thread starter Thread starter Keshav21
  • Start date Start date
K

Keshav21

Guest
My current XML response is as shown below(only important parts are shown).I have added service reference which have generated some proxy classes for me which unfortunately are not returning the output as needed.The c# code below only return the last "values" data. What i eventually want is to have arrays of "values" that i will display in a gridview.

<return>
<fields></fields>
<fields></fields>
<fields></fields>
<values>
<value></value>
<value></value>
<value></value>
</values>
<values>
<value></value>
<value></value>
<value></value>
</values>


//proxy class
private string[] valuesField;

[System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true, Order=1)]
[System.Xml.Serialization.XmlArrayItemAttribute("value", typeof(string), Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string[] values {
get {
return this.valuesField;
}
set {
this.valuesField = value;
this.RaisePropertyChanged("values");
}
}

//code use to call soap request
SoapService.queryWebServiceSoapPortClient client = new
SoapService.queryWebServiceSoapPortClient();
client.ClientCredentials.UserName.UserName = userID;
client.ClientCredentials.UserName.Password = Password;

SoapService.qwsInput query1 = new SoapService.qwsInput();
SoapService.queryResponse response = new
SoapService.queryResponse();

query1.userId = userID;
query1.pass = Password;
query1.queryId = queryId;
query1.qwsInputParams = InputParam;

query a = new query();

a.queryInput = query1;

try
{
response = client.query(a);
}
catch (Exception error)
{

var b = error.ToString();
}




K.T

Continue reading...
 
Back
Top