Forum Discussion

tutu84's avatar
tutu84
New Contributor
13 years ago

how to enter a xml as input to a wsdl service in the tool

I have a wsdl in which I have to pass a xml as input.
Like:

<tem:ABCD> username </ABCD> ---------------------normal string input
<tem:EFGH> i have pass a xml here </EFGH>-----------a xml as input. *The input xml is of multiple nodes.

Suggest.
  • Aaronliu's avatar
    Aaronliu
    Frequent Contributor
    try to use <![CDATA[your input]]> or transform <a>Hello</a> into &lt;a&gt;Hello&lt;/a&gt;
  • tutu84's avatar
    tutu84
    New Contributor
    Aaronliu wrote:
    try to use <![CDATA[your input]]> or transform <a>Hello</a> into &lt;a&gt;Hello&lt;/a&gt;


    Hi I tried both the options.

    with the first option the request is looking as below. seems to be having syntax issue

    <![CDATA[ <Documents>

    For the both the options, below response is received:
    ................
    ..................
    <Message>The XmlReader must be on a node of type Element instead of a node of type Text.</Message>
    <StackTrace>at System.Xml.Linq.XElement.System.Xml.Serialization.IXmlSerializable.ReadXml(XmlReader reader)
    at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadIXmlSerializable(XmlSerializableReader xmlSerializableReader, XmlReaderDelegator xmlReader, XmlDataContract xmlDataContract, Boolean isMemberType)
    at System.Runtime.Serialization.XmlDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
    at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract&amp; dataContract)
    at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)
    at System.Runtime.Serialization.DataContractSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
    at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
    at System.Runtime.Serialization.XmlObjectSerializer.ReadObject(XmlDictionaryReader reader)
    at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.GetHeadersFromMessage(Message message, MessageDescription messageDescription, Object[] parameters, Boolean isRequest)
    at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeRequest(Message message, Object[] parameters)
    at System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc&amp; rpc)
    at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp; rpc)
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp; rpc)
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc&amp; rpc)
    at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace>
    <Type>System.InvalidOperationException</Type>
    .....
    ........

    Could you please help me out in resolving the issue. Thank you
  • nice information...i appreciated your effort..I would like to see more posts like this.thanks
  • Aaronliu's avatar
    Aaronliu
    Frequent Contributor
    #1,<![CDATA[Document]]>
    the <![CDATA[]]> expression is to make sure the document won't be parsed. so ensure that the format is correct in <x:ABC><![CDATA[document]]></x:ABC>
    #2,the second option is to use &lt; &gt; to replace<> in <x:ABC>&lt;test&gt;Content&lt;test&gt;</x:ABC>

    example:
    <EventType><![CDATA[<MyContext xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <A>a</A>
    <B>b</B>
    ...
    ]]></EventType>