C# 核心 WCF SOAP1.2 与媒体类型 application/xml 绑定

问题描述 投票:0回答:1

我有一个任务要 POST 到 HTTP 服务端点,该端点以 SOAP 信封的形式接受

Content-Type: application/xml
标头和正文。响应
Content-Type
也始终是
application/xml
,包含 SOAP 信封内容。

WCF SOAP1.1消息版本指定

Content-Type
应为
text/xml
;而 WCF SOAP1.2 消息版本指定
Content-Type
应为
application/SOAP+xml

我无法控制服务端点,所以我需要以某种方式让 WCF 接受

Content-Type: application/xml
响应标头。

现在我收到一个错误:

System.ServiceModel.ProtocolException : The content type application/xml; charset=UTF-8 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. 
c# wcf soap
1个回答
0
投票

尝试使用 BasicHttpBinding 而不是 wsHttpBinding

© www.soinside.com 2019 - 2024. All rights reserved.