【发布时间】:2012-05-16 19:02:36
【问题描述】:
在为我的公司购买的产品使用网络服务时,我遇到了一个奇怪的问题。该产品名为 Campaign Commander,由一家名为 Email Vision 的公司制造。我们正在尝试使用“Data Mass Update SOAP API”。
每当我尝试调用 web 服务上的任何方法时,调用实际上都会成功,但客户端在处理响应时失败并且我得到一个异常。
错误的详细信息如下,感谢你们提供的任何帮助。
使用 Web Reference 时出错(旧式 Web 服务客户端)
当使用该服务作为 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--
--.
如您所见,响应SOAP信封看起来有效(这是有效响应且调用成功),但客户端似乎内容类型有问题并生成异常。
使用服务引用时出错(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响应并且调用成功了,但是客户端似乎有内容类型的问题并且产生了一个异常。
我可以设置任何选项以使客户端不会对响应类型有问题吗?我进行了一些 Google 搜索,但到目前为止,我发现没有任何帮助。
【问题讨论】:
-
我通过从一个 AppPool 更改为另一个(我的托管在 IIS 上)解决了这个问题,即使它们看起来是一样的。
标签: c# .net webservice-client wcf-client