Forum Discussion

bbCincinnati's avatar
bbCincinnati
New Contributor
15 years ago

cannot have child contents to be deserialized as an object

Help for a clueless newbie?

I have a web service which allows me to create a new customer on my app server.
However, I can't seem to invoke it correctly via soapUI.
I'm guessing I'm doing something wrong in my xml?

Here is the xml request I send:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tem="http://tempuri.org/" xmlns:xxx="http://schemas.datacontract.org/2004/07/XXX.SystemLib.Interfaces">
<soap:Header/>
<soap:Body>
<tem:startProcess>
<tem:requestDetails>
<xxx:loginRequest>
<xxx:LoginID>manager</xxx:LoginID>
<xxx:Password>pretendPwd</xxx:Password>
</xxx:loginRequest>
<xxx:Command>create</xxx:Command>
<xxx:EntityName>customer</xxx:EntityName>
<xxx:KeyValue>WLMT</xxx:KeyValue>
</tem:requestDetails>
<tem:processParameters>
<xxx:Parameters>
<xxx:Key>cust_id</xxx:Key>
<xxx:Value>WLMT</xxx:Value>
</xxx:Parameters>
<xxx:Parameters>
<xxx:Key>descr</xxx:Key>
<xxx:Value>Walmart</xxx:Value>
</xxx:Parameters>
</tem:processParameters>
</tem:startProcess>
</soap:Body>
</soap:Envelope>


Here is part of the error I get:

<s:Text xml:lang="en-US">The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:boParameters. The InnerException message was 'Element Value from namespace http://schemas.datacontract.org/2004/07/XXX.SystemLib.Interfaces cannot have child contents to be deserialized as an object. Please use XmlNode[] to deserialize this pattern of XML.'. Please see InnerException for more details.</s:Text>
...
<InnerException>
<Message>End element 'Value' from namespace 'http://schemas.datacontract.org/2004/07/XXX.SystemLib.Interfaces' expected. Found text 'WLMT'.</Message>


SIDE NOTES:
1) In M.S. Visual Studio, I can use the web service successfully to create a new customer, so I'm pretty sure I'm doing something wrong in soapUI. I suspect my xml is wrong or insufficient.
2) If I remove the text between the <xxx:Value></xxx:Value> tags (WLMT, and Walmart), then I can invoke the web service via soapUI, and a new record is created in my app server, but without the values I want
3) Can someone clue me in to what this means?: "Please use XmlNode[] to deserialize this pattern of XML".

1 Reply

  • I've found a way to make the XML work in soapUI.
    Hopefully this will be helpful if anyone else runs into the same problem.
    I was able to capture the XML being sent by my Visual Studio application to the Web Service.
    (I used a handy, free tool called Fiddler: http://www.fiddler2.com/fiddler2/ ).


    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
    <startProcess xmlns="http://tempuri.org/">
    <requestDetails>
    <loginRequest xmlns="http://schemas.datacontract.org/2004/07/XXX.SystemLib.Interfaces" >
    <LoginID xmlns="http://schemas.datacontract.org/2004/07/XXX.SystemLib.Interfaces">manager</LoginID>
    <Password xmlns="http://schemas.datacontract.org/2004/07/XXX.SystemLib.Interfaces">pretendPwd</Password>
    </loginRequest>
    <Command xmlns="http://schemas.datacontract.org/2004/07/XXX.SystemLib.Interfaces">create</Command>
    <EntityName xmlns="http://schemas.datacontract.org/2004/07/XXX.SystemLib.Interfaces">customer</EntityName>
    </requestDetails>
    <processParameters>
    <Parameters xmlns="http://schemas.datacontract.org/2004/07/XXX.SystemLib.Interfaces">
    <Key>cust_id</Key>
    <Value xsi:type="xsd:string">WLMT</Value>
    </Parameters>
    <Parameters xmlns="http://schemas.datacontract.org/2004/07/XXX.SystemLib.Interfaces">
    <Key>descr</Key>
    <Value xsi:type="xsd:string">Walmart</Value>
    </Parameters>
    </processParameters>
    </startProcess>
    </soap:Body>
    </soap:Envelope>


    SIDE NOTE: One thing I especially noticed was xsi:type="xsd:string" in the <Value> tags.