【发布时间】:2018-07-02 11:46:22
【问题描述】:
我创建了网络服务来接受这个肥皂请求。 我测试过,没有标题它工作正常 如果我添加标题仍然适用于 s:mustUnderstand="0" 但是 如果我把它改成 1 它就坏了
动作 s:mustUnderstand="1"
为了接受标头,我需要对我的 Web 服务进行哪些更改? 在此先感谢
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Header>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://www.xxxx-ccc.co.uk/Integration/SaveApplication</Action> </s:Header>
<s:Body> applicant>
<title>Mr</title>
<forename>dd</forename>
<surname>ee</surname>
<address>
<street1>ppp</street1>
<town>dd</town>
<county>cc</county>
<postcode>rtrtr</postcode>
</address>
</applicant>
</s:Body> </s:Envelope>
这是我的网络服务代码
[WebService(Namespace = "http://www.xxxx-ccc.co.uk/Integration/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class CG_ADNContact : System.Web.Services.WebService
{
[WebMethod(Description = "")]
public XmlDocument SaveApplication()
{ //Do some thing }
}
【问题讨论】:
-
您好,您知道了吗?我有确切的问题。你在 wcf 服务中做了什么更改为接受 musunderstand =1
-
2020 年 11 月,这仍然是一个问题。我可以确认 WCF 代理将自动生成您所说的 soap:header,并且它实际上是通过网络提交的(如果相信 Microsoft 提供的 MessageInspectors 基础结构)。我在客户端(就在 POST 之前)和服务器端(就在收到 POST 消息之后)都创建了 MessageInspectors。奇怪的是,如果使用标准 HTTP 发布,服务总是返回 400 错误,除非 SOAP:Header with Action MustUnderstand=1 被删除!