.net – 消耗webservice的错误,内容类型“application/xop xml”
在为我公司购买的产品消费webservice时,我有一个奇怪的问题。该产品称为“运动指挥官”,由“Vision Vision”公司制造。我们正在尝试使用“数据批量更新SOAP API”。
每当我尝试调用webservice上的任何方法时,调用实际上会成功,但是当处理响应时客户端失败,并且我收到异常。 错误的细节如下,谢谢你们可以提供的任何帮助。 使用Web引用错误(旧式webservice客户端) 当作为Web引用使用该服务时,我得到一个InvalidOperationException用于我所做的任何调用,并显示以下消息: Client found response content type of 'multipart/related; type="application/xop+xml"; boundary="uuid:170e63fa-183c-4b18-9364-c62ca545a6e0"; start="<root.message@cxf.apache.org>"; start-info="text/xml"',but expected 'text/xml'. The request failed with the error message: -- --uuid:170e63fa-183c-4b18-9364-c62ca545a6e0 Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"; Content-Transfer-Encoding: binary Content-ID: <root.message@cxf.apache.org> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns2:openApiConnectionResponse xmlns:ns2="http://api.service.apibatchmember.emailvision.com/" xmlns:ns3="http://exceptions.service.apibatchmember.emailvision.com/"> <return>DpKTe-9swUeOsxhHH9t-uLPeLyg-aa2xk3-aKe9oJ5S9Yymrnuf1FxYnzpaFojsQSkSCbJsZmrZ_d3v2-7Hj</return> </ns2:openApiConnectionResponse> </soap:Body> </soap:Envelope> --uuid:170e63fa-183c-4b18-9364-c62ca545a6e0-- --. 如你所见,响应肥皂包看起来是有效的(这是一个有效的响应,并且调用成功),但客户端似乎对内容类型有问题并产生异常。 使用服务引用错误(WCF客户端) 当我将服务作为服务参考使用时,我会收到一个ProtocolException用于我所做的任何调用,并显示以下消息: The content type multipart/related; type="application/xop+xml"; boundary="uuid:af66440a-012e-4444-8814-895c843de5ec"; start="<root.message@cxf.apache.org>"; start-info="text/xml" of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder,be sure that the IsContentTypeSupported method is implemented properly. The first 648 bytes of the response were: ' --uuid:af66440a-012e-4444-8814-895c843de5ec Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"; Content-Transfer-Encoding: binary Content-ID: <root.message@cxf.apache.org> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns2:openApiConnectionResponse xmlns:ns2="http://api.service.apibatchmember.emailvision.com/" xmlns:ns3="http://exceptions.service.apibatchmember.emailvision.com/"> <return>Dqaqb-MJ9V_eplZ8fPh4tdHUbxM-ZtuZsDG6GalAGZSfSzyxgtuuIxZc3aSsnhI4b0SCbJsZmrZ_d3v2-7G8</return> </ns2:openApiConnectionResponse> </soap:Body> </soap:Envelope> --uuid:af66440a-012e-4444-8814-895c843de5ec--'. 就像前面的例子一样;我们有一个有效的soap响应,并且调用成功,但客户端似乎对内容类型有问题,并产生了异常。 有没有我可以设置的选项,所以客户端没有响应类型的问题?我已经做了一些谷歌的搜索,但我发现没有什么帮助我到目前为止。 解决方法
对于同样问题的人来说,我已经找到一个消费Web服务作为服务引用(WCF)的解决方案。
BasicHttpBinding.MessageEncoding属性需要设置为“Mtom”。
以下是所需配置设置的代码段: <configuration> <system.serviceModel> <bindings> <basicHttpBinding> <binding messageEncoding="Mtom"> </binding> </basicHttpBinding> </bindings> </system.serviceModel> </configuration> 编辑:如果您有与自定义绑定相同的问题,请参阅answer from @robmzd。 我仍然没有找到一个解决方案来消费它作为一个旧式的Web引用。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- 如何使用Angular 2在单个ts文件中编写2个表单验证
- 在angular5中使用sw预缓存时排除子网站网址
- scala – 如何将Source [ByteString,Any]转换为I
- angularjs – 如何将qrcode-generator导入角度2
- scala – 具有来自具有sbt-assembly的单个项目的
- bootstrap标签改成鼠标经过显示
- 单元测试 – 在AngularJS单元测试中模拟$modal
- scala – elastic4s:使用rawQuery得分保持在1
- bash – 添加用户脚本不工作,正在运行:read $us
- bash – 提取与“foo”匹配的文件的最后10行