locked
Received Error : Error in deserializing body of reply message for operation when called 3rd Party web Service's Web Method RRS feed

  • Question

  • User-529861215 posted

    HI, 

    My Problem is i have to add 3rd party web service as service reference in my project. It will return string. When I call one of the web method, it throw an error :

    System.ServiceModel.CommunicationException: Error in deserializing body of reply message for operation 'Refund'. OperationFormatter encountered an invalid Message body. Expected to find node type 'Element' with name 'RefundResponse' and namespace 'http://tempuri.org/wsdl/'. Found node type 'Element' with name 'RefundResponse' and namespace 'http://tempuri.org/message/' ---> System.Runtime.Serialization.SerializationException: OperationFormatter encountered an invalid Message body. Expected to find node type 'Element' with name 'RefundResponse' and namespace 'http://tempuri.org/wsdl/'. Found node type 'Element' with name 'RefundResponse' and namespace 'http://tempuri.org/message/' 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.DeserializeReply(Message message, Object[] parameters) --- End of inner exception stack trace --- Server stack trace: at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply(Message message, Object[] parameters) at System.ServiceModel.Dispatcher.ProxyOperationRuntime.AfterReply(ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) 

    May I know how to solve this problem?

    Wednesday, February 13, 2013 10:33 PM

Answers

  • User-1000095884 posted

    My Problem is i have to add 3rd party web service as service reference in my project. It will return string. When I call one of the web method, it throw an error :

    Hi,

    From the exception, the issue may related to MaxStringContentLength property in the binding configuration, check a blog below for detail.

    #WCF maxStringContentLength, maxBufferSize, and MaxReceivedMessageSize

    http://geekswithblogs.net/niemguy/archive/2007/12/11/wcf-maxstringcontentlength-maxbuffersize-and-maxreceivedmessagesize.aspx

    If the issue still exists, I'd suggest you use fiddler to help you to find the actual issue, and since the issue is related to a 3rd party web service, I would like to suggest you contact them who created the service to get better help. Thanks.

    Best Regards.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, February 20, 2013 5:08 AM