.net SoapHeaderException:使用WSE3无法理解SOAP标头安全性

.net SoapHeaderException:使用WSE3无法理解SOAP标头安全性,.net,web-services,soap,soapheader,wse,.net,Web Services,Soap,Soapheader,Wse,我正在使用.Net中的WSE3连接到第三方Java Web服务。Fiddler中捕获的SOAP请求和响应表明通信工作良好 答复: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header> <wsse:Security SOAP-ENV:mustUnderstand="1" xmlns:wsse="http:/

我正在使用.Net中的WSE3连接到第三方Java Web服务。Fiddler中捕获的SOAP请求和响应表明通信工作良好

答复:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header>
        <wsse:Security SOAP-ENV:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
            <wsu:Timestamp wsu:Id="XWSSGID-1508410623170-1719544205" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
                <wsu:Created>2017-10-19T10:57:03.170Z</wsu:Created>
                <wsu:Expires>2017-10-19T11:02:03.170Z</wsu:Expires>
            </wsu:Timestamp>
            <wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" wsu:Id="XWSSGID-15084106231701759910641" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">XXX</wsse:BinarySecurityToken>
            <ds:Signature Id="XWSSGID-15084106231701266839262" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
                <ds:SignedInfo>
                    <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                        <InclusiveNamespaces PrefixList="wsse SOAP-ENV" xmlns="http://www.w3.org/2001/10/xml-exc-c14n#"/>
                    </ds:CanonicalizationMethod>
                    <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
                    <ds:Reference URI="#XWSSGID-15084106231711433609101">
                        <ds:Transforms>
                            <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                                <InclusiveNamespaces PrefixList="SOAP-ENV dss ds" xmlns="http://www.w3.org/2001/10/xml-exc-c14n#"/>
                            </ds:Transform>
                        </ds:Transforms>
                        <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
                        <ds:DigestValue>bBWZxXap0n3oD/jodYRkD4J32Uk=</ds:DigestValue>
                    </ds:Reference>
                    <ds:Reference URI="#XWSSGID-1508410623170-1719544205">
                        <ds:Transforms>
                            <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                                <InclusiveNamespaces PrefixList="wsu wsse SOAP-ENV" xmlns="http://www.w3.org/2001/10/xml-exc-c14n#"/>
                            </ds:Transform>
                        </ds:Transforms>
                        <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
                        <ds:DigestValue>cwRM0nhUrQZ7J18qpE8pYsEryJU=</ds:DigestValue>
                    </ds:Reference>
                </ds:SignedInfo>
                <ds:SignatureValue>xxx</ds:SignatureValue>
                <ds:KeyInfo>
                    <wsse:SecurityTokenReference wsu:Id="XWSSGID-1508410623170704353769" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
                        <wsse:Reference URI="#XWSSGID-15084106231701759910641" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"/>
                    </wsse:SecurityTokenReference>
                </ds:KeyInfo>
            </ds:Signature>
        </wsse:Security>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body wsu:Id="XWSSGID-15084106231711433609101" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <dss:SignResponse Profile="urn:oasis:names:tc:dss:1.0:profiles:timestamping" RequestID="Id-eba85779-cb45-46ae-afac-01eb3e2bee3e" xmlns:dss="urn:oasis:names:tc:dss:1.0:core:schema">
            <dss:Result>
                <dss:ResultMajor>urn:oasis:names:tc:dss:1.0:resultmajor:Success</dss:ResultMajor>
            </dss:Result>
            <dss:SignatureObject>
                <dss:Timestamp>
                    <ds:Signature Id="Id-cde5fcd8-1c04-4210-871a-1bb97cfa7a42" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
                        <ds:SignedInfo Id="Id-f42a6e7f-b33d-4428-bc6a-40b059aed56f">
                            <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
                            <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
                            <ds:Reference Id="Id-8e6406fd-1f65-4bf3-bf38-3d19be32f128">
                                <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
                                <ds:DigestValue>nGnDhLgyV9QPz/Q6Ojkmo6W7oWqAxQS1oZR+sqA7z8g=</ds:DigestValue>
                            </ds:Reference>
                            <ds:Reference Id="Id-4a2243c5-f9b0-45a3-b80a-eac691800ec1" Type="urn:oasis:names:tc:dss:1.0:core:schema:XMLTimeStampToken" URI="#TSTInfo-Id-20bbc349-cd32-48c2-82c2-67f136af87e6">
                                <ds:Transforms>
                                    <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
                                </ds:Transforms>
                                <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
                                <ds:DigestValue>ziq2t3aNBb5Myk0DM41uW7tfkxP7BCNIvXMLGCX1f9o=</ds:DigestValue>
                            </ds:Reference>
                        </ds:SignedInfo>
                        <ds:SignatureValue>xxx</ds:SignatureValue>
                        <ds:KeyInfo>
                            <ds:X509Data>
                                <ds:X509Certificate>xxx</ds:X509Certificate>
                            </ds:X509Data>
                        </ds:KeyInfo>
                        <ds:Object Id="TSTInfo-Id-20bbc349-cd32-48c2-82c2-67f136af87e6" MimeType="application/xml">
                            <dss:TstInfo>
                                <dss:SerialNumber>150840777629299685</dss:SerialNumber>
                                <dss:CreationTime>2017-10-19T12:57:03.102+02:00</dss:CreationTime>
                                <dss:Policy>urn:oid:1.3.4.6.1.3.4.6</dss:Policy>
                                <dss:ErrorBound>PT1.001002S</dss:ErrorBound>
                                <dss:Ordered>true</dss:Ordered>
                                <dss:TSA Format="urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName">CN=Politica2,O=MDEF,OU=PKI,ST=Madrid,C=ES</dss:TSA>
                            </dss:TstInfo>
                        </ds:Object>
                    </ds:Signature>
                </dss:Timestamp>
            </dss:SignatureObject>
        </dss:SignResponse>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
我尝试了一些类似这样的解决方案:

但它不起作用。有什么想法吗

System.Web.Services.Protocols.SoapHeaderException: SOAP header Security was not understood.
   at System.Web.Services.Protocols.SoapHeaderHandling.SetHeaderMembers(SoapHeaderCollection headers, Object target, SoapHeaderMapping[] mappings, SoapHeaderDirection direction, Boolean client)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)