我正在使用第三方Duplex服务(假设这是因为实施了回调合同)。以下是配置部分。该服务抛出异常,说它无法理解请求XML中的标记“a:To mustUnderstand =”1“。
<endpoint address="http://vmsvalservice-uat.rpdata.com:80/vms-valuation/soap/soapws"
binding="customBinding" bindingConfiguration="VMSSSO_CustomBinding" behaviorConfiguration="VMSSSOHeader"
contract="VMSSSOService.VmsPort" name="VmsPortSoap11">
</endpoint>
<binding name="CustomBinding" receiveTimeout="00:10:00" sendTimeout="00:01:00">
<security authenticationMode="UserNameOverTransport" enableUnsecuredResponse="true" allowInsecureTransport="true"/>
<compositeDuplex clientBaseAddress="http://localhost:8080"/>
<oneWay maxAcceptedChannels ="2"></oneWay>
<textMessageEncoding messageVersion="Soap11WSAddressing10" writeEncoding="utf-8" />
<httpTransport maxBufferPoolSize="524288" maxBufferSize="524288" maxReceivedMessageSize="524288"/>
</binding>
请求XML:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<a:MessageID>urn:uuid:76901ce5-0bab-42e2-ac76-18eddf367d25</a:MessageID>
<a:To s:mustUnderstand="1">http://vmsvalservice-uat.rpdata.com/vms-valuation/soap/soapws</a:To>
<o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
我尝试了两种方法来修复它。
我已经尝试过BeforeSendRequest来控制行为,但是在调用此事件后,此标记会添加到Soap信封中。
尝试通过编写一个类并覆盖MustUnderstand属性将mustUnderstand重置为0,然后接受XML。
无论如何我可以阻止这个标签出去或重置MustUnderstand。
非常感谢任何建议。
答案 0 :(得分:0)
我验证了xml,发现架构需要a。您应该按如下方式验证整个XML:从VS菜单:项目:添加新项:XML文件。将XML粘贴到窗口中,确保只有一个标识行。任何错误都会在错误列表中显示,就像编译错误一样。
<?xml version="1.0" encoding="utf-8" ?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<a:MessageID>urn:uuid:76901ce5-0bab-42e2-ac76-18eddf367d25</a:MessageID>
<a:To s:mustUnderstand="1">http://vmsvalservice-uat.rpdata.com/vms-valuation/soap/soapws</a:To>
<o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
</o:Security>
</s:Header>
<s:Body>
</s:Body>
</s:Envelope>
答案 1 :(得分:0)
实际上通过明确删除给定的标头并在之后重新插入它来解决这个问题:
#buttonAtt {
-moz-box-shadow:inset 0px 1px 0px 0px #cccccc;
-webkit-box-shadow:inset 0px 1px 0px 0px #cccccc;
box-shadow:inset 0px 1px 0px 0px #cccccc;
background-color:transparent;
-webkit-border-top-left-radius:0px;
-moz-border-radius-top-left:0px;
border-top-left-radius:0px;
-webkit-border-top-right-radius:0px;
-moz-border-radius-topright:0px;
border-top-right-radius:0px;
-webkit-border-bottom-right-radius:0px;
-moz-border-radius-bottomright:0px;
border-bottom-right-radius:0px;
-webkit-border-bottom-left-radius:0px;
-moz-border-radius-bottomleft:0px;
border-bottom-left-radius:0px;
text-indent:0;
border:2px solid #cccccc;
display:inline-block;
}