#c# #asp.net #list #web-services #methods
#c# #asp.net #Список #веб-сервисы #методы
Вопрос:
Я хочу вызвать веб-службы и сохранить, List
но не могу добавить, я знаю, что возвращаемый тип не совпадает для обоих. Могу ли я узнать, как использовать веб-сервис и хранить в списке. У меня есть класс, который наследуется с object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged
Should I use LINQ.
Подпись GetInitiatorsListByWorkflow:
public Almarai.GiveAway.GetInitiatorList.INITIATORS_LIST GetInitiatorsListByWorkflow(string userId, string WorkflowTypeCode) {
return base.Channel.GetInitiatorsListByWorkflow(userId, WorkflowTypeCode);
}
Ссылка:
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IMasterDataService/GetInitiatorsListByWorkflow", ReplyAction="http://tempuri.org/IMasterDataService/GetInitiatorsListByWorkflowResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(Almarai.GiveAway.GetInitiatorList.CustomFaultException), Action="http://tempuri.org/IMasterDataService/GetInitiatorsListByWorkflowCustomFaultExcep"
"tionFault", Name="CustomFaultException", Namespace="http://schemas.datacontract.org/2004/07/Almarai.Web.Services.MasterData")]
Almarai.GiveAway.GetInitiatorList.INITIATORS_LIST GetInitiatorsListByWorkflow(string userId, string WorkflowTypeCode);
Мой класс :
public partial class INITIATORS_LIST : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged
{
[System.NonSerializedAttribute()]
private System.Runtime.Serialization.ExtensionDataObject extensionDataField;
[System.Runtime.Serialization.OptionalFieldAttribute()]
private Almarai.GiveAway.GetInitiatorList.ALM_COMPANY_M[] CompaniesField;
[System.Runtime.Serialization.OptionalFieldAttribute()]
private Almarai.GiveAway.GetInitiatorList.ALM_COUNTRY_M[] CountriesField;
[System.Runtime.Serialization.OptionalFieldAttribute()]
private Almarai.GiveAway.GetInitiatorList.ALM_DIVISION_M[] DivisionsField;
[System.Runtime.Serialization.OptionalFieldAttribute()]
private Almarai.GiveAway.GetInitiatorList.LOCATION[] LocationsField;
[global::System.ComponentModel.BrowsableAttribute(false)]
public System.Runtime.Serialization.ExtensionDataObject ExtensionData
{
get
{
return this.extensionDataField;
}
set
{
this.extensionDataField = value;
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public Almarai.GiveAway.GetInitiatorList.ALM_COMPANY_M[] Companies
{
get
{
return this.CompaniesField;
}
set
{
if ((object.ReferenceEquals(this.CompaniesField, value) != true))
{
this.CompaniesField = value;
this.RaisePropertyChanged("Companies");
}
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public Almarai.GiveAway.GetInitiatorList.ALM_COUNTRY_M[] Countries
{
get
{
return this.CountriesField;
}
set
{
if ((object.ReferenceEquals(this.CountriesField, value) != true))
{
this.CountriesField = value;
this.RaisePropertyChanged("Countries");
}
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public Almarai.GiveAway.GetInitiatorList.ALM_DIVISION_M[] Divisions
{
get
{
return this.DivisionsField;
}
set
{
if ((object.ReferenceEquals(this.DivisionsField, value) != true))
{
this.DivisionsField = value;
this.RaisePropertyChanged("Divisions");
}
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public Almarai.GiveAway.GetInitiatorList.LOCATION[] Locations
{
get
{
return this.LocationsField;
}
set
{
if ((object.ReferenceEquals(this.LocationsField, value) != true))
{
this.LocationsField = value;
this.RaisePropertyChanged("Locations");
}
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public Almarai.GiveAway.GetInitiatorList.REGION[] Regions
{
get
{
return this.RegionsField;
}
set
{
if ((object.ReferenceEquals(this.RegionsField, value) != true))
{
this.RegionsField = value;
this.RaisePropertyChanged("Regions");
}
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public Almarai.GiveAway.GetInitiatorList.ALM_WKFLW_TYPE_M[] WorkflowTypes
{
get
{
return this.WorkflowTypesField;
}
set
{
if ((object.ReferenceEquals(this.WorkflowTypesField, value) != true))
{
this.WorkflowTypesField = value;
this.RaisePropertyChanged("WorkflowTypes");
}
}
}
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(string propertyName)
{
System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
if ((propertyChanged != null))
{
propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
}
}
}
Мой метод:
[WebMethod]
public static List<INITIATORS_LIST> GetCountriesName(string UserID)
{
GetInitiatorList.MasterDataServiceClient oClient = new GetInitiatorList.MasterDataServiceClient();
List<INITIATORS_LIST> lst = new List<INITIATORS_LIST>();
var INITIATORS_LIST = new INITIATORS_LIST()
{
ExtensionData =
oClient.GetInitiatorsListByWorkflow("SAU", "SaudiArebia")//Error on this Line
};
return lst;
}
Комментарии:
1. Пожалуйста, отправьте
GetActiveCountries
подпись.2. @Dennis Пожалуйста, проверьте мой обновленный код