Я пытаюсь выполнить запрос 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.
<?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>