Hi All
i am facing in an error when i want call a list with a soap request in C# . I have the code auto-generated from a service with Visual Studio as follows :
public partial class list_response : response { private list_cell[][] rowField; /// <remarks/> [System.Xml.Serialization.XmlArrayAttribute(Order=0)] [System.Xml.Serialization.XmlArrayItemAttribute("cell", typeof(list_cell), IsNullable=false)] public list_cell[][] row { get { return this.rowField; } set { this.rowField = value; this.RaisePropertyChanged("row"); } } } public partial class list_request : request { private string list_typeField; private string list_constraint_valueField; /// <remarks/> [System.Xml.Serialization.XmlElementAttribute(Order=0)] public string list_type { get { return this.list_typeField; } set { this.list_typeField = value; this.RaisePropertyChanged("list_type"); } } /// <remarks/> [System.Xml.Serialization.XmlElementAttribute(Order=1)] public string list_constraint_value { get { return this.list_constraint_valueField; } set { this.list_constraint_valueField = value; this.RaisePropertyChanged("list_constraint_value"); } } } public partial class list_cell : object, System.ComponentModel.INotifyPropertyChanged { private string nameField; private string typeField; private string codeField; private long idField; private bool idFieldSpecified; /// <remarks/> [System.Xml.Serialization.XmlElementAttribute(Order=0)] public string name { get { return this.nameField; } set { this.nameField = value; this.RaisePropertyChanged("name"); } } /// <remarks/> [System.Xml.Serialization.XmlElementAttribute(Order=1)] public string type { get { return this.typeField; } set { this.typeField = value; this.RaisePropertyChanged("type"); } } /// <remarks/> [System.Xml.Serialization.XmlAttributeAttribute()] public string code { get { return this.codeField; } set { this.codeField = value; this.RaisePropertyChanged("code"); } } /// <remarks/> [System.Xml.Serialization.XmlAttributeAttribute()] public long id { get { return this.idField; } set { this.idField = value; this.RaisePropertyChanged("id"); } } /// <remarks/> [System.Xml.Serialization.XmlIgnoreAttribute()] public bool idSpecified { get { return this.idFieldSpecified; } set { this.idFieldSpecified = value; this.RaisePropertyChanged("idSpecified"); } } 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)); } } }
and here there is the code behind to use to call a list :
MyService.list_request listRequ = new MyService.list_request( MyService.list_response listResp = new MyService.list_response(); MyService.MyServiceServiceClient client = new MyService.MyServiceServiceClient(); MyService.list param = new MyService.list(); MyService.list_cell cell = new MyService.list_cell(); listRequ.uuid = "bd9cdf64-427e-4840-a509-f7504e31bd8a"; listRequ.module_code = "TEST_MODULE"; listRequ.list_type = "COUNTRY"; listResp = client.list(listRequ); //HERE I GOT ERROR
to the last row of the code i got an error as follows :
[System.InvalidOperationException] {"Unable to generate a temporary class (result=1).\r\n error CS0030: Cannot convert type 'HotelMask.MyService.list_cell[]' to' HotelMask.MyService.list_cell'\r\n error CS0029: Cannot implicitly convert type 'HotelMask.MyService.list_cell' to 'HotelMask.MyService.list_cell[]'\r\n"} System.InvalidOperationException StackTrace " at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence)\r\n at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies)\r\n at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence)\r\n at System.Xml.Serialization.XmlSerializer.GetSerializersFromCache(XmlMapping[] mappings, Type type)\r\n at System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[] mappings, Type type)\r\n at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.SerializerGenerationContext.GenerateSerializers()\r\n at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.SerializerGenerationContext.GetSerializer(Int32 handle)\r\n at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.MessageInfo.get_BodySerializer()\r\n at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.SerializeBody(XmlDictionaryWriter writer, MessageVersion version, String action, MessageDescription messageDescription, Object returnValue, Object[] parameters, Boolean isRequest)" string
truly is the fist time i work with multidimesional array as if i try to call this list with the software SOAP UI the result is ok :
//THE REQUEST <jes:list> <jes:list_request> <base:uuid>bd9cdf64-427e-4840-a509-f7504e31bd8a</base:uuid> <base:module_code>TEST_MODULE/base:module_code> <jes:list_type>COUNTRY</jes:list_type> </jes:list_request> </jes:list> //THE RESPONSE <js:listResponse> <return> <bd:uuid>bd9cdf64-427e-4840-a509-f7504e31bd8a</bd:uuid> <bd:result_code>0</bd:result_code> <bd:result_msg>LIST returns [114] elements for LIST_TYPE [COUNTRY]</bd:result_msg> <js:row> <js:cell code="AF" id="53"> <js:name>AFGHANISTAN</js:name> <js:type>COUNTRY</js:type> </js:cell> </js:row> <js:row> <js:cell code="AL" id="109"> <js:name>ALBANIA</js:name> <js:type>COUNTRY</js:type> </js:cell> </js:row> <js:row>
Kindly do you have any idea or suggestion to get store this list in the right way?
- Merged by Xavier EoroMicrosoft contingent staff 2 hours 0 minutes ago C# related