AnsweredAssumed Answered

How to encode SOAP-request content to base64

Question asked by a.palm on Dec 29, 2014
I have been trying to encode UTF-8 content to Base64 without any luck. I have also copied the encoding part from an example I saw on the Alfresco forum, which seems to work for the other users, but does not work for me.

 <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">8HQHL+lL/qwxfwYN92u28g==</wsse:Nonce> 


Source: https://forums.alfresco.com/forum/developer-discussions/other-apis/soap-request-example-createdocument-soapui-11282011-1635

Here is my SOAP request:

<blockcode>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://docs.oasis-open.org/ns/cmis/messaging/200908/" xmlns:ns1="http://docs.oasis-open.org/ns/cmis/core/200908/">
   <soapenv:Header>
      <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
         <wsse:UsernameToken
      wsu:Id="UsernameToken-666"
      xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
            <wsse:Username>admin</wsse:Username>
            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">0101</wsse:Password>
            <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">8HQHL+lL/qwxfwYN92u28g==</wsse:Nonce>
         </wsse:UsernameToken>
      </wsse:Security>
   </soapenv:Header>
   <soapenv:Body>
      <ns:createDocument>
         <ns:repositoryId>a178a092-c119-4df2-8b98-aeae2582c889</ns:repositoryId>
         <ns:properties>
            <!–You have a CHOICE of the next 8 items at this level–>
            <ns1:propertyId propertyDefinitionId="cmis:objectTypeId">
               <!–Zero or more repetitions:–>
               <ns1:value>cmis:document</ns1:value>
               <!–You may enter ANY elements at this point–>
            </ns1:propertyId>
            <ns1:propertyString propertyDefinitionId="cmis:name">
               <!–Zero or more repetitions:–>
               <ns1:value>newDocument.doc</ns1:value>
               <!–You may enter ANY elements at this point–>
            </ns1:propertyString>
            <!–You may enter ANY elements at this point–>
         </ns:properties>
         <!–Optional:–>
         <ns:folderId>efdb0591-8060-4285-9ed8-0f1442f2007a</ns:folderId>
         <!–Optional:–>
         <ns:contentStream>
            <!–Optional:–>
            <ns:mimeType>application/msword; charset=UTF-8</ns:mimeType>
            <!–Optional:–>
            <ns:filename>newDocument.doc</ns:filename>
            <ns:stream>HELLO "SOAP Protocol" World!</ns:stream> <!– Plain text: HELLO "SOAP Protocol" World! //// BASE64 encoded message: SEVMTE8gIlNPQVAgUHJvdG9jb2wiIFdvcmxkIQ==  –>
            <!–You may enter ANY elements at this point–>
         </ns:contentStream>
      </ns:createDocument>
   </soapenv:Body>
</soapenv:Envelope>
</blockcode>

When I use the example above, the content of the new document is this:  " BË9#€<ú趇(•j+ ". It should be" HELLO "SOAP Protocol" World! ", just like I wrote in the stream tag.
Does anyone know how to fix this problem?

Thanks In Advance!

Outcomes