android soap2 wcf,WCF SOAP 1.2服务期望SOAP 1.1内容类型

我正在构建一个需要与非WCF客户端交互的WCF Web服务(事实上,将不会有WCF客户端)。

我已经使用SOAP 1.2(as per this example)编写了一个WSDL。我已经验证了WSDL,并且使用了这个文件(而不是由WCF生成的WSDL,这在表面上是不同的)创建了一个soapUI测试项目。

我有一个要求,Web服务将支持SOAP 1.2,所以我不能只是回到SOAP 1.1(在早期的原型中工作得很好)。

我使用WSCF.blue来生成我的WCF服务,接口和数据契约类。一切都很好地编译,如果我在浏览器中点击了WCF服务,那么终端会被暴露出来。一切似乎都与世界很好。

当我尝试从soapUi调用一个方法时,我从服务器得到以下响应(从soapUI可见):

HTTP/1.1 415 Cannot process the message because the content type

'application/soap+xml;charset=UTF-8;action="http://tempuri.org/FetchMyThing"'

was not the expected type 'text/xml; charset=utf-8'.

Server: Microsoft-IIS/7.5

X-Powered-By: ASP.NET

Date: Mon, 30 Apr 2012 08:15:29 GMT

Content-Length: 0

(为了这个问题的目的,实际的方法名称和命名空间已被手动更改。命名空间中的任何拼写错误都不是我的代码中的错误 – 只是打字这个问题的一个疏漏)

我知道SOAP 1.1规定内容类型必须是text / xml。 SOAP 1.2需要application / soap xml。

我的原始请求(根据soapUI):

POST http://localhost/MyWs.svc HTTP/1.1

Accept-Encoding: gzip,deflate

Content-Type: application/soap+xml;charset=UTF-8;action="http://tempuri.org/FetchMyThing"

xmlns:ns="http://tempuri.org">

从这个响应中,它告诉我,我的请求是正确的 – 它是一个具有正确内容类型的SOAP 1.2请求。然而,我的WCF服务并不期望这种内容类型,我认为这意味着我没有正确配置它,它仍然认为它是一个SOAP 1.1 Web服务。

Minimal Web.config,根据this blog post:

服务合同的片段:

[ServiceContract(Namespace = "http://tempuri.org")]

public interface IWsPort

{

[OperationContract(Action = "http://tempuri.org/FetchMyThing")]

[FaultContract(typeof(WsFault), Action = "http://tempuri.org/FetchMyThing", Name = "fetchMyThingFault")]

[XmlSerializerFormat(SupportFaults = true)]

FetchMyThingResponse FetchMyThing(FetchMyThingRequest request);

}

我为我的WCF服务启用了服务跟踪,并看到以下异常似乎证实了我的假设:

Activity: Listen at 'http://mycomputer/MyWs.svc

System.ServiceModel.ProtocolException, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Content Type application/soap+xml;charset=UTF-8;action="http://tempuri.org/FetchMyThing" was sent to a service expecting text/xml; charset=utf-8. The client and service bindings may be mismatched.

(erroneous detail snipped)

所以,我的合同和服务绑定可能是不匹配的,如果这个消息是相信的,但是从我对WCF的了解我的配置(或至少其背后的意图)是正确的。

有没有人有任何想法,我的配置有什么问题?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值