积极答复者
未处理 System.ServiceModel.CommunicationException

问题
-
引用 WEB服务一下代码
Dim api As StreamsterApi = New StreamsterApi
Dim o As Order = New Order
o.Instrument = "EUR/USD"
o.Desk = "Virtual Forex"
o.Quantity = 10
o.QuantitySpecified = True
api.SendOrder(o)中
api.SendOrder(o)
代码出错!
错误提示如下
这个是错误提示什么意思怎么读不明白怎么解决哪!
未处理 System.ServiceModel.CommunicationException
Message=反序列化操作“SendOrder”的响应消息的正文时出现错误。所需的命名空间“http://schemas.xmlsoap.org/soap/envelope/”中的结尾元素“Body”。找到 命名空间“http://www.novativa.com/ws/streamsterapi”中的元素“result”。 行 1,位置 190。
Source=mscorlib
StackTrace:
Server stack trace:
在 System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply(Message message, Object[] parameters)
在 System.ServiceModel.Dispatcher.ProxyOperationRuntime.AfterReply(ProxyRpc& rpc)
在 System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
在 System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
在 System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
在 System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
在 ConsoleApplication1.streamsterapi.StreamsterApiInterface.SendOrder(SendOrderRequest request)
在 ConsoleApplication1.streamsterapi.StreamsterApiInterfaceClient.streamsterapi_StreamsterApiInterface_SendOrder(SendOrderRequest request) 位置 C:\Documents and Settings\Administrator\Local Settings\Application Data\Temporary Projects\ConsoleApplication1\Service References\streamsterapi\Reference.vb:行号 2122
在 ConsoleApplication1.streamsterapi.StreamsterApiInterfaceClient.SendOrder(Order Order) 位置 C:\Documents and Settings\Administrator\Local Settings\Application Data\Temporary Projects\ConsoleApplication1\Service References\streamsterapi\Reference.vb:行号 2128
在 ConsoleApplication1.Module1.Main() 位置 C:\Documents and Settings\Administrator\Local Settings\Application Data\Temporary Projects\ConsoleApplication1\Module1.vb:行号 15
在 System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
在 System.Threading.ThreadHelper.ThreadStart()
InnerException: System.Xml.XmlException
LineNumber=0
LinePosition=0
Message=所需的命名空间“http://schemas.xmlsoap.org/soap/envelope/”中的结尾元素“Body”。找到 命名空间“http://www.novativa.com/ws/streamsterapi”中的元素“result”。 行 1,位置 190。
Source=System.Runtime.Serialization
StackTrace:
在 System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3)
在 System.Xml.XmlBaseReader.ReadEndElement()
在 System.ServiceModel.Channels.Message.ReadFromBodyContentsToEnd(XmlDictionaryReader reader, EnvelopeVersion envelopeVersion)
在 System.ServiceModel.Channels.Message.ReadFromBodyContentsToEnd(XmlDictionaryReader reader)
在 System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)
在 System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply(Message message, Object[] parameters)
InnerException:- 已移动 Frank Xu LeiModerator 2011年5月6日 1:44 WCF (发件人:XML 与 Web Services 讨论区)
答案
-
你这个是通过 客户端代理 来调用WCF服务?
问个问题,
你有修改消息的命名空间吗?
这里提到个东西。
http://www.novativa.com/ws/streamsterapi”
Frank Xu Lei--谦卑若愚,好学若饥
专注于.NET平台下分布式应用系统开发和企业应用系统集成
Focus on Distributed Applications Development and EAI based on .NET
【老徐的网站】:http://www.frankxulei.com/
- 已标记为答案 dazles 2011年8月14日 2:23
-
Hi,
1, 必须保证消息的命名空间一致。
2,检查服务端数据契约与客户端生成的代理类是否一致。
3,通过Fiddler或WcfTestClient.exe(服务是WCF Service)查看请求与响应消息。还有SendOrder方法的参数及返回值类型是可序列化的
Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework- 已标记为答案 dazles 2011年8月14日 2:23
全部回复
-
你这个是通过 客户端代理 来调用WCF服务?
问个问题,
你有修改消息的命名空间吗?
这里提到个东西。
http://www.novativa.com/ws/streamsterapi”
Frank Xu Lei--谦卑若愚,好学若饥
专注于.NET平台下分布式应用系统开发和企业应用系统集成
Focus on Distributed Applications Development and EAI based on .NET
【老徐的网站】:http://www.frankxulei.com/
- 已标记为答案 dazles 2011年8月14日 2:23
-
Hi,
1, 必须保证消息的命名空间一致。
2,检查服务端数据契约与客户端生成的代理类是否一致。
3,通过Fiddler或WcfTestClient.exe(服务是WCF Service)查看请求与响应消息。还有SendOrder方法的参数及返回值类型是可序列化的
Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework- 已标记为答案 dazles 2011年8月14日 2:23