none
Error in deserializing body of reply message for operation RRS feed

  • Question

  • Hello experts:

    I'm creating a WCF web service using 3rd party's wsdl/xsd, when 3rd party make a request,
    It throw an error:

     System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest)
     System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)
     System.ServiceModel.Dispatcher.OperationFormatter.DeserializeRequest(Message message, Object[] parameters)
     System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc& rpc)
     System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
     System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
     System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc)
     System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)
     System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)
     System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc)
     System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc)
     System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)
     System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)
     System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
     System.ServiceModel.Dispatcher.ChannelHandler.DispatchAndReleasePump(RequestContext request, Boolean cleanThread, OperationContext currentOperationContext)
     System.ServiceModel.Dispatcher.ChannelHandler.HandleRequest(RequestContext request, OperationContext currentOperationContext)
     System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(IAsyncResult result)
     System.ServiceModel.Dispatcher.ChannelHandler.OnAsyncReceiveComplete(IAsyncResult result)
     System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
     System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
     System.ServiceModel.Channels.SecurityChannelListener`1.ReceiveRequestAndVerifySecurityAsyncResult.ReceiveMessage(Object state)
     System.Runtime.ActionItem.DefaultActionItem.Invoke()
     System.Runtime.ActionItem.CallbackHelper.InvokeWithoutContext(Object state)
     System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
     System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
     System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

    The generated reference.vb code is:

    <System.Web.Services.Protocols.SoapDocumentMethodAttribute("urn:retrieveTicket", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Bare)>  _
            Public Function retrieveTicket(<System.Xml.Serialization.XmlElementAttribute([Namespace]:="http://service.resadapter.myidtravel.lhsystems.com")> ByVal retrieveTicketRequest As MyIDTravelResAdapterRetrieveTicketRequest) As <System.Xml.Serialization.XmlElementAttribute("retrieveTicketResponse", [Namespace]:="http://service.resadapter.myidtravel.lhsystems.com")> MyIDTravelResAdapterRetrieveTicketResponse
                Dim results() As Object = Me.Invoke("retrieveTicket", New Object() {retrieveTicketRequest})
                Return CType(results(0),MyIDTravelResAdapterRetrieveTicketResponse)
            End Function
            
            '''<remarks/>
            Public Overloads Sub retrieveTicketAsync(ByVal retrieveTicketRequest As MyIDTravelResAdapterRetrieveTicketRequest)
                Me.retrieveTicketAsync(retrieveTicketRequest, Nothing)
            End Sub
            
            '''<remarks/>
            Public Overloads Sub retrieveTicketAsync(ByVal retrieveTicketRequest As MyIDTravelResAdapterRetrieveTicketRequest, ByVal userState As Object)
                If (Me.retrieveTicketOperationCompleted Is Nothing) Then
                    Me.retrieveTicketOperationCompleted = AddressOf Me.OnretrieveTicketOperationCompleted
                End If
                Me.InvokeAsync("retrieveTicket", New Object() {retrieveTicketRequest}, Me.retrieveTicketOperationCompleted, userState)
            End Sub
            
            Private Sub OnretrieveTicketOperationCompleted(ByVal arg As Object)
                If (Not (Me.retrieveTicketCompletedEvent) Is Nothing) Then
                    Dim invokeArgs As System.Web.Services.Protocols.InvokeCompletedEventArgs = CType(arg,System.Web.Services.Protocols.InvokeCompletedEventArgs)
                    RaiseEvent retrieveTicketCompleted(Me, New retrieveTicketCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState))
                End If
            End Sub

    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.1009"), _
         System.SerializableAttribute(), _
         System.Diagnostics.DebuggerStepThroughAttribute(), _
         System.ComponentModel.DesignerCategoryAttribute("code"), _
         System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://bos.service.resadapter.myidtravel.lhsystems.com")> _
            Partial Public Class MyIDTravelResAdapterRetrieveTicketRequest

            Private employeeDataField As MyIdTravelEmployeeData

            Private oTA_ReadRQField As OTA_ReadRQ

            '''<remarks/>
            Public Property employeeData() As MyIdTravelEmployeeData
                Get
                    Return Me.employeeDataField
                End Get
                Set(ByVal value As MyIdTravelEmployeeData)
                    Me.employeeDataField = value
                End Set
            End Property

            '''<remarks/>
            <System.Xml.Serialization.XmlElementAttribute([Namespace]:="http://www.opentravel.org/OTA/2003/05")> _
            Public Property OTA_ReadRQ() As OTA_ReadRQ
                Get
                    Return Me.oTA_ReadRQField
                End Get
                Set(ByVal value As OTA_ReadRQ)
                    Me.oTA_ReadRQField = value
                End Set
            End Property
        End Class

    My operation contract is:
    <OperationContract(Name:="retrieveTicketRequest", Action:="urn:retrieveTicket", ReplyAction:="urn:retrieveTicket")> _
        Function retriveTKTA(ByVal ARequest As MyIDTravelResAdapterRetrieveTicketRequest) As MyIDTravelResAdapterRetrieveTicketResponse

    Thank you!
    Wednesday, August 14, 2013 7:53 AM

Answers

  • Hi CIRICHARD,

    Based on your description, I understand that you've built a WCF service through some given XSD and WSDL documents and the service is consumed by some non-WCF client (like .NET ASMX webservice client), correct?

    The error message indicate that the WCF service failed to deserialize the soap body content (from the request message) into the corresponding WCF runtime objects. Have you tried creating a WCF client (by using Visual Studio Add ServiceReference) to see if it works well? If a WCF client works, you can use some HTTP debugging tools (like Fiddler or Wireshark) to capture the request message sent by ASMX webservice client (which report the error) and WCF client and compare them to find out the difference. After got the difference, we can further look into the generated ASMX webservice client proxy code to see how we should adjust it to meet the WCF server-side expectation.

    #Fiddler
    http://fiddler2.com/get-fiddler

    #Wireshark
    http://www.wireshark.org/


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, August 15, 2013 2:29 AM
    Moderator