3

I am trying to perform a quick testing for a webservice created by a third party. The problem is whenever I use SoapUI, i am running in to the following error:

Element MyValue from namespace http://schemas.datacontract.org/2004/07/Services cannot have child contents to be deserialized as an object. Please use XmlNode[] to deserialize this pattern of XML.

I understood from here, that the DataMember is of type object rather than string so that the deserializer has problems in turning a string back into an object of the type Object.

One solution suggested was to change the type of DataMember back to String which obviously I cannot because it belongs to a third party.

Any other suggestions to make it work with the SoapUI testing ?

Additional Info: Solution suggested at the blog:

[DataContract] 
public class MyClass 
{ 
   [DataMember] 
   public string MyName;

   [DataMember] 
   public object MyValue; 
}

If you change your DataContract to

 [DataContract] 
 public class MyClass 
 { 
    [DataMember] 
    public string MyName;

    [DataMember] 
    public string MyValue; 
 }
Ishmaeel
  • 14,138
  • 9
  • 71
  • 83

0 Answers0