Ask a Question

DeserializationFailed Error when Submitted the SOAP Request

SOLVED
ravinderreddy
Occasional Contributor

DeserializationFailed Error when Submitted the SOAP Request

Hi,

Can anyone solve this issue?
When Submitted the SOAP Request there is a Deserialization error "Deserialized object with reference id '?' not found in stream." I am not able to understand why I am getting this exception.When I did the same thing from another tool ,it is working fine .I am able to get the response.

The XML which is generated in SOAP UI contains "<tas:request ser:Id="?" ser:Ref="?">". what are these? What should I pass over here.?

The error details are below

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <s:Fault>
         <faultcode xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:DeserializationFailed</faultcode>
         <faultstring xml:lang="en-GB">The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter .The InnerException message was 'Deserialized object with reference id '?' not found in stream.'.  Please see InnerException for more details.</faultstring>
         <detail>
            <ExceptionDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
               <HelpLink i:nil="true"/>
               <InnerException>
                  <HelpLink i:nil="true"/>
                  <InnerException i:nil="true"/>
                  <Message>Deserialized object with reference id '?' not found in stream.</Message>
                  <StackTrace>at System.Runtime.Serialization.XmlObjectSerializerReadContext.GetExistingObject(String id, Type type, String name, String ns)
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.TryHandleNullOrRef(XmlReaderDelegator reader, Type declaredType, String name, String ns, Object&amp; retObj)
   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.DataContractSerializer.ReadObject(XmlDictionaryReader reader, Boolean verifyObjectName)
   at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.PartInfo.ReadObject(XmlDictionaryReader reader, XmlObjectSerializer serializer)
   at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameterPart(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)</StackTrace>
                  <Type>System.Runtime.Serialization.SerializationException</Type>
               </InnerException>
               <Message>The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter .The InnerException message was 'Deserialized object with reference id '?' not found in stream.'.  Please see InnerException for more details.</Message>
               <StackTrace>at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameterPart(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)
   at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameters(XmlDictionaryReader reader, PartInfo[] parts, Object[] parameters, Boolean isRequest)
   at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest)
   at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, 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.ServiceModel.Dispatcher.NetDispatcherFaultException</Type>
            </ExceptionDetail>
         </detail>
      </s:Fault>
   </s:Body>
</s:Envelope>

 

6 REPLIES 6
nmrao
Champion Level 2

You mean in the request that it was showing some '?' marks? Try with a valid request and see what is happening on the server side to see why such response coming.


Regards,
Rao.
ravinderreddy
Occasional Contributor

I am giving the proper input .But the thing is that there is an xml tag <tas:request ser:Id="?" ser:Ref="?"> which consists ser:ID and Ref .Dont know what values I need to pass over here.So I have given ser:Id="0" and removed ser:Ref and now I am getting another error "The value '?' cannot be parsed as the type 'DateTime'."

at System.Xml.XmlConverter.ToDateTime(String value)    at System.Xml.XmlConverter.ToDateTime(Byte[] buffer, Int32 offset, Int32 count)    at System.Xml.XmlBaseReader.ReadContentAsDateTime()    at System.Xml.XmlDictionaryReader.ReadElementContentAsDateTime()    at ReadOrderPayPalFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )    at System.Runtime.Serialization.ClassDataContract.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, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns)    at ReadOrderPayPalRequestFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )    at System.Runtime.Serialization.ClassDataContract.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)

There is a tag with CreateDateTime which is not mandatory.So I don't need to give any input for this.When I place the same request thru WCF Storm it is giving the proper response and not giving any parsing error.There is a default value 01:01:0001 00:00:00 in WCF Storm but in SOAP UI there is no default value like this. How can I solve this? When the same thing is working with another then why not with SOAP UI?

In this case, one way would be to connect to the service provide to see why the application showing exception in first place instead of showing right message to end user so that he/she can understand what went wrong.


Regards,
Rao.
ravinderreddy
Occasional Contributor

Thank You @nmrao ,

It's working now. I need to pass so many input values which is unlike the tool that I have used earlier. That took only two input values to give the response but whereas SOAP UI took near about 12-15 input values which are even optional. Is there any option SOAP UI avoid this.

1. First of all, you can validate your request in soapui by using alt+v in the request editor.
2. You may also look at the preferences or while creating the request itself whether to have optional elements in the request or not.

3. At times, if an optional element is not present which ok, but the element is present value presented like ?, then it may not be valid.

Hope the above can help you.


Regards,
Rao.
ravinderreddy
Occasional Contributor

Hi,

@nmrao

According to your 3rd point
3. At times, if an optional element is not present which ok, but the element is present value presented like ?, then it may not be valid.
 


in the xml with the previous tool I used to pass only 2 values(Branch and Order). But with SOAP UI ,I need to pass inputs for all the optional elements. When I pass only two mandatory values and validate then it is giving errors like "invalid decimal value","invalid date value" etc .
Even I have changed the preferences .But nothing is worked.

cancel
Showing results for 
Search instead for 
Did you mean: