我正在尝试创建第三方应该消费的服务。
使用者与SOAP 1.1兼容,这就是为什么我使用basicHttpBinding作为服务器的原因。当发出实际的请求时,服务器预期的内容类型似乎出了问题。使用basicHttpBinding我不明白为什么服务器仍然期望'application/soap + xml',据我所知,这只是SOAP 1.2所必需的。
我已经使用wireshark来弄清楚这两个人正在沟通什么。请参阅下面的tcp流和设置。
任何帮助表示赞赏。
WCF和肥皂1.1
第三方应用程序请求
POST/HTTP/1.1
的SOAPAction: http://tempuri.org/ITestService/Hello
内容类型:文本/ XML;字符集= UTF-8
主机:shdesktop:8000
的Content-Length:297
期望值:100继续
连接:关闭
WCF服务器响应
HTTP/1.1 415无法处理 消息,因为内容类型 'text/xml; charset = utf-8'不是 预期的类型'application/soap + xml; charset = utf-8'。
的Content-Length:0
服务器:HTTPAPI/2.0
日期:星期二,2010 09 2 14时03分19秒GMT
连接:关闭
服务配置
<system.serviceModel>
<services>
<service behaviorConfiguration="behTestService" name="ConsoleApplication1.TestService">
<endpoint address="" binding="mexHttpBinding" contract="IMetadataExchange" />
<endpoint address="TestService" binding="basicHttpBinding"
contract="ConsoleApplication1.ITestService" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8000" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="behTestService">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
哦,SOAP 1.1会使用'application/soap + xml'?我明天会测试webHttpBinding,谢谢!我知道一个事实,即当我创建一个简单的asmx服务时,它会起作用,如果它有所作为。 – 2010-02-09 17:35:47
@Silas:“老式”ASP.NET webservices(ASMX)**和** WCF basicHttpBinding使用SOAP 1.1 - 所以应该没问题,真的。您需要检查您的客户端是向您发送SOAP请求,还是仅仅尝试向您的URL发布XML – 2010-02-09 19:46:37
我打电话给http://,而不需要拨打http:// /TestService。我愚蠢的错误。感谢所有的帮助! –
2010-02-16 14:19:54