【发布时间】:2011-01-14 20:17:10
【问题描述】:
我正在尝试创建第 3 方应该使用的服务。
消费者与 SOAP 1.1 兼容,这就是我在服务器上使用 basicHttpBinding 的原因。当发出实际请求时,服务器预期的内容类型似乎出现了问题。使用 basicHttpBinding 我不明白为什么服务器仍然需要“application/soap+xml”,据我所知,只有 SOAP 1.2 才需要它。
我已经使用wireshark 来弄清楚这两个人在交流什么。请参阅下面的 tcp 流和设置。
任何帮助表示赞赏。
第三方应用请求
POST / HTTP/1.1
SOAP 动作: http://tempuri.org/ITestService/Hello
内容类型:文本/xml;字符集=utf-8
主机:shdesktop:8000
内容长度:297
期望:100-继续
连接:关闭
WCF 服务器响应
HTTP/1.1 415 无法处理 消息,因为内容类型 '文本/xml; charset=utf-8' 不是 预期类型'应用程序/soap+xml; charset=utf-8'。
内容长度:0
服务器:Microsoft-HTTPAPI/2.0
日期:格林威治标准时间 2010 年 2 月 9 日星期二 14:03:19
连接:关闭
服务配置
<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>
【问题讨论】:
标签: c# .net wcf web-services soap