Multidimensional Array in soap method request

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?

August 23rd, 2015 4:14am

This isn't a wpf question.

You should have posted in the c# forum, for better support.

.

I suggest you insert a break point and see what you're getting.

Clearly, it doesn't match what you're trying to set it to.

Looking at that, the two types seem to be different.

listresponse is presumably a different type.

But the fact you have this:

 error CS0030: Cannot convert type 'HotelMask.MyService.list_cell[]' to'HotelMask.MyService.list_cell'\r\n
Makes me wonder whether the field types match.

Free Windows Admin Tool Kit Click here and download it now
August 23rd, 2015 4:45am

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?


August 23rd, 2015 5:27am

This isn't a wpf question.

You should have posted in the c# forum, for better support.

.

I suggest you insert a break point and see what you're getting.

Clearly, it doesn't match what you're trying to set it to.

Looking at that, the two types seem to be different.

listresponse is presumably a different type.

But the fact you have this:

 error CS0030: Cannot convert type 'HotelMask.MyService.list_cell[]' to'HotelMask.MyService.list_cell'\r\n
Makes me wonder whether the field types match.
Free Windows Admin Tool Kit Click here and download it now
August 23rd, 2015 5:31am

You don't use breakpoints to stop errors.

The idea is to explore what you have.

You can step through, hover over fields and see values or right click and add a quickwatch.

August 23rd, 2015 5:40am

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 :

SOAP UI is just a testing framework. I doubt that it is doing anything for real. If it was doing something for real, it would have blown-up just like your real program blew up. Maybe you should think about sending a straight XML response, loading it into a XML.Document and using Linq-2-XML or XPath to manipulate the XML in the document.

Free Windows Admin Tool Kit Click here and download it now
August 23rd, 2015 3:27pm

Hi Jonny,

This forum is for C# code issues in specific. Based on your code, your case more related to Web Services, I would suggest you repost this issue in Web Services forum. Here is the link:

http://forums.asp.net/28.aspx/1?WCF+ASMX+and+other+Web+Services 

Thanks for your understanding.
 

Best regards,

Kristin

August 24th, 2015 3:30am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics