Hi,
I am trying to get list of data from the Java we service from the c# client.
The web service return the list of items. But through the c# client I can only capture the first element data.
How can I get the list of data from the response?
Here are the auto generated code
Reference.cs
public WindowsFormsApplication1.ServiceReference1.tAddOnDto QueryAvaiableAddOnList(WindowsFormsApplication1.ServiceReference1.tAuthHeader AuthHeader, WindowsFormsApplication1.ServiceReference1.tQueryAvaiableAddOnListBO QueryAvaiableAddOnListBO) {
WindowsFormsApplication1.ServiceReference1.QueryAvaiableAddOnListRequest inValue = new WindowsFormsApplication1.ServiceReference1.QueryAvaiableAddOnListRequest();
inValue.AuthHeader = AuthHeader;
inValue.QueryAvaiableAddOnListBO = QueryAvaiableAddOnListBO;
WindowsFormsApplication1.ServiceReference1.QueryAvaiableAddOnListResponse retVal = ((WindowsFormsApplication1.ServiceReference1.QueryPortType)(this)).QueryAvaiableAddOnList(inValue);
return retVal.AddOnDtoList;
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.17929")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://com.company.company/xsd")]
public partial class tAddOnDto : object, System.ComponentModel.INotifyPropertyChanged {
private string offerCodeField;
private string offerNameField;
private string offerTypeField;
private string effDateField;
private string expDateField;
private string autoContinueFlagField;
private string duplicateFlagField;
private string commentsField;
public string OfferCode {
get {
return this.offerCodeField;
}
set {
this.offerCodeField = value;
this.RaisePropertyChanged("OfferCode");
}
}
XML response example
<ns:QueryAvaiableAddOnListBOResponse xmlns:ns="http://com.Comapny.companu/xsd">
<AddOnDtoList>
<OfferCode>7</OfferCode>
<OfferName>默认资费计划</OfferName>
<OfferType>4</OfferType>
<EffDate>2016-08-08 09:30:35</EffDate>
<ExpDate/>
<AutoContinueFlag>N</AutoContinueFlag>
<DuplicateFlag/>
<Comments/>
</AddOnDtoList>
<AddOnDtoList>
<OfferCode>794</OfferCode>
<OfferName>AOC test</OfferName>
<OfferType>3</OfferType>
<EffDate>2016-08-30 00:00:00</EffDate>
<ExpDate/>
<AutoContinueFlag>N</AutoContinueFlag>
<DuplicateFlag/>
<Comments/>
</AddOnDtoList>
<AddOnDtoList>
<OfferCode>ROAM_VAS_CODE</OfferCode>
<OfferName>ROAM_VAS_CODE</OfferName>
<OfferType>3</OfferType>
<EffDate>2016-09-05 00:00:00</EffDate>
<ExpDate/>
<AutoContinueFlag>N</AutoContinueFlag>
<DuplicateFlag/>
<Comments/>
</AddOnDtoList>
</ns:QueryAvaiableAddOnListBOResponse>
</soapenv:Body>
</soapenv:Envelope>
What I have tried:
here is my coding
ServiceReference1.QueryPortTypeClient ServiceClient = new QueryPortTypeClient();
ServiceReference1.tAuthHeader hed = new tAuthHeader();
hed.Username = "?";
hed.Password = "?";
ServiceReference1.tQueryAvaiableAddOnListBO addBO = new tQueryAvaiableAddOnListBO();
addBO.MSISDN = "94722009580";
tAddOnDto tadd = new tAddOnDto();
tadd = ServiceClient.QueryAvaiableAddOnList(hed, addBO);
string a = tadd.OfferName.ToString();