Hello!
Please help us with canonization of XML ( http://www.w3.org/2001/10/xml-exc-c14n# - Canonicalization of XML) of the following type:
<?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:ws="http://ws.unisoft/" xmlns:rev="http://smev.gosuslugi.ru/rev120315" xmlns:rq1="http://ws.unisoft/CPSubPercent/Rq1" xmlns:inc="http://www.w3.org/2004/08/xop/include"> <soapenv:Header> <wsse:Security soapenv:actor="http://smev.gosuslugi.ru/actors/smev"> <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> <ds:KeyInfo> <wsse:SecurityTokenReference> <wsse:Reference URI="#SenderCertificate" /> </wsse:SecurityTokenReference> </ds:KeyInfo> </ds:Signature> <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="SenderCertificate" /> </wsse:Security> </soapenv:Header> <soapenv:Body wsu:Id="body"> <ws:async_getId_SendRequest_Tyrim_Pyrim> <rev:Message> <rev:Sender> <rev:Code>CODE63544</rev:Code> <rev:Name>ТутИмя</rev:Name> </rev:Sender> <rev:Recipient> <rev:Code>CODE2</rev:Code> <rev:Name>Тест</rev:Name> </rev:Recipient> <rev:Originator> <rev:Code>CODE3</rev:Code> <rev:Name>Тест</rev:Name> </rev:Originator> <rev:ServiceName>ТестВебСервис</rev:ServiceName> <rev:TypeCode>GSRV</rev:TypeCode> <rev:Status>REQUEST</rev:Status> <rev:Date>2012-03-13T12:12:12Z</rev:Date> <rev:ExchangeType>1</rev:ExchangeType> <rev:RequestIdRef /> <rev:OriginRequestIdRef /> <rev:ServiceCode /> <rev:CaseNumber /> <rev:TestMsg /> </rev:Message> <rev:MessageData> <rev:AppData> <rq1:Документ ВерсияФормата="1.0" UIDЗапроса="4832bdef-bef7-459a-8397-dc28793f59d4"> <РегНомер>1</РегНомер> </rq1:Документ> </rev:AppData> <rev:AppDocument> <rev:RequestCode>req_4832bdef-bef7-459a-8397-dc28793f59d4</rev:RequestCode> <rev:BinaryData>UEsDBBQAAAAIABm=</rev:BinaryData> </rev:AppDocument> </rev:MessageData> </ws:async_getId_SendRequest_Tyrim_Pyrim> </soapenv:Body> </soapenv:Envelope>
That is, it is an XML SOAP request.
The problem is that I don’t know how to bring XML to a canonical form (canonicalize) and therefore I can’t do it manually, and I need to program it (at least, if not canonicalization of arbitrary XML, then at least XML generation is already in canonicalized form).
Of course, I read the recommendations ( http://www.w3.org/TR/xml-c14n ), but I didn’t really understand what I need to do with XML ...
Perhaps the only thing that is clear is that there should be no extra spaces in the tags, the tags "<tag />" should be turned into "<tag>".
But this is clearly not enough.
I ask the help of those who have already encountered this ...
PS Answering the question “Why this is necessary” is ideal for this , but a simple understanding of what kind of XML should be in the end will come down ...
<rq1:Документ ВерсияФормата="1.0" UIDЗапроса="4832bdef-bef7-459a-8397-dc28793f59d4"> <РегНомер>1</РегНомер> </rq1:Документ>
- Barmaley