我应该创建.NET WCF客户端,该客户端应在SOAP请求以下生成。我花了很多时间,但没有成功。
有没有人可以从c#WCF客户端与SignOnly Java Web服务通信的解决方案?
<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<wsse:Security s:mustUnderstand="true" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<ds:Signature Id="SIG-A5D35D54DC66D15E331549966453968141" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
<ec:InclusiveNamespaces PrefixList="a s u" xmlns:ec="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="#id-A5D35D54DC66D15E331549965933641125">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
<ec:InclusiveNamespaces PrefixList="a" xmlns:ec="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>LXih7cFZ0xbS7kvta191sVPJDTQ=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>I5wyj9Yc3rZ+lXegr2KuPdT3phqZrGWhUMTdictlmUUyXw+7OsKNS0AkaJm+WMX2LbhoLLzvr3Ux
A+xHcSlWzvCnq9zxkVFMXAusw8fcbf6zlwKejXnuxOnl0CimusQS6RqiaBOuTxwRTdM/ltTTVUMk
hQs3ta0sG/3s7r0NyNE=</ds:SignatureValue>
<ds:KeyInfo Id="KI-A5D35D54DC66D15E331549966453923139">
<wsse:SecurityTokenReference u:Id="STR-A5D35D54DC66D15E331549966453923140">
<ds:X509Data>
<ds:X509IssuerSerial>
<ds:X509IssuerName>CN=Sample Client,OU=Rampart,O=Apache,L=Colombo,ST=Western,C=LK</ds:X509IssuerName>
<ds:X509SerialNumber>1261391591</ds:X509SerialNumber>
</ds:X509IssuerSerial>
</ds:X509Data>
</wsse:SecurityTokenReference>
</ds:KeyInfo>
</ds:Signature>
<u:Timestamp u:Id="TS-A5D35D54DC66D15E331549966453921137">
<u:Created>2019-02-12T10:14:13.920Z</u:Created>
<u:Expires>2019-02-12T10:14:43.920Z</u:Expires>
</u:Timestamp>
</wsse:Security>
</s:Header>
<s:Body u:Id="id-A5D35D54DC66D15E331549965933641125" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<CheckVoucherRequestType xmlns="http://blabla/bean/Voucher">
<voucherId xmlns="">80010</voucherId>
</CheckVoucherRequestType>
</s:Body>
</s:Envelope>
这是我使用customBinding创建的,但未被Web服务接受,并显示“ 必须对皂体进行签名”
<?xml version="1.0"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/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:Action s:mustUnderstand="1">urn:checkVoucher</a:Action>
<a:MessageID>urn:uuid:25ed0a2d-ce11-4bef-b013-b139c50f8517</a:MessageID>
<a:ReplyTo>
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
<a:To s:mustUnderstand="1" u:Id="_1">https://server:8443/axis2/services/VoucherService</a:To>
<o:Security xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" s:mustUnderstand="1">
<u:Timestamp u:Id="_0">
<u:Created>2019-02-12T13:31:42.759Z</u:Created>
<u:Expires>2019-02-12T13:36:42.759Z</u:Expires>
</u:Timestamp>
<o:BinarySecurityToken u:Id="uuid-3fa3a7be-8300-4a1d-b40c-79c944f6ed56-1" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">MIICTzCCAbigAwIBAgIESy9O5zANBgkqhkiG9w0BAQUFADBsMQswCQYDVQQGEwJMSzEQMA4GA1UECBMHV2VzdGVybjEQMA4GA1UEBxMHQ29sb21ibzEPMA0GA1UEChMGQXBhY2hlMRAwDgYDVQQLEwdSYW1wYXJ0MRYwFAYDVQQDEw1TYW1wbGUgQ2xpZW50MB4XDTA5MTIyMTEwMzMxMVoXDTM3MDUwNzEwMzMxMVowbDELMAkGA1UEBhMCTEsxEDAOBgNVBAgTB1dlc3Rlcm4xEDAOBgNVBAcTB0NvbG9tYm8xDzANBgNVBAoTBkFwYWNoZTEQMA4GA1UECxMHUmFtcGFydDEWMBQGA1UEAxMNU2FtcGxlIENsaWVudDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAjBQM+kgC0Wm9hk9v4pjLSg5yK0Em2ulyDmODckWv4mZJ8YwJPVgqEIzwRiOnNBH3s+wFCw297zDsnEgDKSQrsPf1smVUOK/slyDPbqZ47Ewcs07nCPfNigncmpbcaluO3bMw9Oqj9VIYjrUHu5xCp2Fe39ZPbwOzLtAmT8b6iucCAwEAATANBgkqhkiG9w0BAQUFAAOBgQAnjPanrVjFVkxnhsj83RJA2tK//v99KpPf3do9VUI2yEgvBZUzH3q2jk3widwEcsJMHgbRr3VTFL7dNVdCYBcI1KiBY9SMa1XZ4RIHmw7gkJt1JTgjKBzfrout2z614KixRf4w7qkDacGxkNspXG/PSlh03Lfm5sb0vzH1aqBl3g==</o:BinarySecurityToken>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<Reference URI="#_0">
<Transforms>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue>0IgkKJMbmxPHMXVdYAc1+CcNMIM=</DigestValue>
</Reference>
<Reference URI="#_1">
<Transforms>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue>jZ4CUdzEsLYM7T3a96RcNYVsxYo=</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>Tar9/ZJ/0HXcK7wHgMUPVJ+DhmIUrj24fO8wbFGyScUz6pZ60ivudlEtZqq5hcTyDooq/R+rDEHre9NYyA5JSNXukQiv140IEI9syPk4L5BMjE8QI1rgXiFmVD9egxSh6HV5XH9h0NpxaoYIcvOpAelYR0SVUmGgvltTVa2Vbrg=</SignatureValue>
<KeyInfo>
<o:SecurityTokenReference>
<o:Reference ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" URI="#uuid-3fa3a7be-8300-4a1d-b40c-79c944f6ed56-1"/>
</o:SecurityTokenReference>
</KeyInfo>
</Signature>
</o:Security>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<CheckVoucherRequestType xmlns="http://blabla/bean/Voucher">
<voucherId xmlns="">80010</voucherId>
</s:Body>
</s:Envelope>