小编Ste*_*ohr的帖子

期望SOAP 1.1内容类型的WCF SOAP 1.2服务

我正在构建一个WCF Web服务,需要与非WCF客户端互操作(实际上,没有WCF客户端).

我已经使用SOAP 1.2编写了一个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
Run Code Online (Sandbox Code Playgroud)

(出于此问题的目的,已经手动更改了实际的方法名称和命名空间.命名空间中的任何拼写错误都不是我的代码中的错误 - 只是在输入此问题时的疏忽)

我知道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"

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
               xmlns:ns="http://tempuri.org">
   <soap:Header/>
   <soap:Body>
      <ns:fetchMyThingRequest attribute1="1" attribute2="10">
      </ns:fetchMyThingRequest>
   </soap:Body>
</soap:Envelope>
Run Code Online (Sandbox Code Playgroud)

从这个响应中,它告诉我我的请求是正确形成的 - 它是一个具有正确内容类型的SOAP …

wcf

21
推荐指数
1
解决办法
5万
查看次数

标签 统计

wcf ×1