我正在尝试执行SOAP请求,这主要要求对请求正文和标头应借助服务提供商提供的某些证书进行数字签名和加密。
我已经尝试过,但总是从肥皂服务器中获取以下错误
These policy alternatives can not be satisfied:
{http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}AsymmetricBinding: Received Timestamp does not match the requirements
{http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}InitiatorToken
{http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}X509Token: The received token does not match the token inclusion requirement
{http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}RecipientToken
{http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}IncludeTimestamp
{http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}OnlySignEntireHeadersAndBody
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}UsernameToken: The received token does not match the token inclusion requirement
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}SignedParts: {http://schemas.xmlsoap.org/soap/envelope/}Body not SIGNED
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}EncryptedParts: {http://schemas.xmlsoap.org/soap/envelope/}Body not ENCRYPTED</faultstring>
我被这些错误困扰。有人可以帮我解决此问题。我需要在请求中更新什么。我为此使用PHP soap客户端。请让我知道是否有用于SOAP服务的更好的库。
<?xml version="1.0"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mit="http://someurl.com/mitsecws" xmlns:wsse="http://someurl.com/mitsecws/wsse" xmlns:wsu="http://someurl.com/mitsecws/wsu" xmlns:req="http://someurl.com/mitsecws/request">
<soapenv:Header>
<wsse:Security xmlns:wsse="http://someurl.com/mitsecws/wsse">
<wsse:UsernameToken wsu:Id="`enter code here`5d25d9567d18e">
<wsse:Username>RVJJQWSwMDY5MA==</wsse:Username>
<wsse:Password type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">JUSDSSVQwMDA2NDV==</wsse:Password>
<wsu:Created>2019-07-10T17:55:58Z</wsu:Created>
</wsse:UsernameToken>
<wsse:Timestamp Id="2019-07-10T17:55:58Z">
<wsu:Created>2019-07-10T17:55:58Z</wsu:Created>
<wsu:Expires>2019-07-10T18:00:58Z</wsu:Expires>
</wsse:Timestamp>
<dsig:Signature xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
<dsig:SignedInfo>
<dsig:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
<dsig:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha512"/>
<dsig:Reference URI="#object">
<dsig:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha512"/>
<dsig:DigestValue>IOwoF7dG5z+Kc//iZXw/JKSLjkldsdklshkDHKHDKLSDLKSDlsmLKDNSDSDSD>==</dsig:DigestValue>
</dsig:Reference>
</dsig:SignedInfo>
<dsig:SignatureValue>BmeuZjvZVL9VC7ZPGpOK/4+tq5uJKZBiLcYxLixcBaXOxqJQpAIwGL5Hihlx1Vh/ZRnObSstP8zgmmETi0==</dsig:SignatureValue>
<dsig:KeyInfo>
<dsig:KeyValue/>
</dsig:KeyInfo>
<dsig:Object Id="object">f7sPCSsQEQm9l+/baIpkMZR4W8Ty6nFoLxPHHClAOXc0S5eNte+yVr+zMxJBAbk1VNOsDdZ0JHG7wbwg+gtV6Q==</dsig:Object>
</dsig:Signature>
<xenc:EncryptedData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" Type="http://www.w3.org/2001/04/xmlenc#Content">
<xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" />
<xenc:CipherData>
<xenc:CipherValue>kux3QNnekBQNjBez2X8VK2owA2/HOBBcVYBSphjHKM/XtME1iQBH==</xenc:CipherValue>
</xenc:CipherData>
</xenc:EncryptedData>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<mit:getDetails>
<mit:Request Id="EDUIDND8790761558">
<req:attr>678687668689</req:attr>
</mit:Request>
</mit:getDetails>
<dsig:Signature xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
<dsig:SignedInfo>
<dsig:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
<dsig:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha512"/>
<dsig:Reference URI="#object">
<dsig:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha512"/>
<dsig:DigestValue>jRmoTYakN87lWRB2bYn9LUoBafGeJvJG0h/gHCIbomT9bkOQONvLlbZkClYuTa/at/geGfnlf71oddlntniupg==</dsig:DigestValue>
</dsig:Reference>
</dsig:SignedInfo>
<dsig:SignatureValue>Tnz/+zalV5878vDKWdY+bTqvVgj8ZsMs1jdMxMe+bOTyPaLvVp2ldUds7ZQNpwxroVgS/eSU71JA/2VXqnFkzZnxECWHBA==</dsig:SignatureValue>
<dsig:KeyInfo>
<dsig:KeyValue/>
</dsig:KeyInfo>
<dsig:Object Id="object">6INdQRCiFp7ooheaEmqwb7MW9zVk0HdK3nmSCjUfzzhegFVzMSaTp6HZu6uj80voYAy1wnth7JKj+fTkqlXDWw==</dsig:Object>
</dsig:Signature>
<xenc:EncryptedData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" Type="http://www.w3.org/2001/04/xmlenc#Content">
<xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" />
<xenc:CipherData>
<xenc:CipherValue>Y5kWq1v12g7ljLSGsnpwH3J9bCMJcgSIY2H+EuxV/6ik3Km230yMWbCTGjnXYbFr4i9xcdUwesk3r26tKVZbtEFHrpNCTxT86vkfdQ==</xenc:CipherValue>
</xenc:CipherData>
</xenc:EncryptedData>
</soapenv:Body>
</soapenv:Envelope>