Hello Everyone,
I am trying to make use of the base64string data that was returned from a web service (RenderResponse). The return response definition from it's wsdl is below:
<s:element name="RenderResponse">
<s:complexType>
<s:sequence>
<s:element name="Result" type="s:base64Binary" maxOccurs="1" minOccurs="0"/>
<s:element name="Extension" type="s:string" maxOccurs="1" minOccurs="0"/>
<s:element name="MimeType" type="s:string" maxOccurs="1" minOccurs="0"/>
<s:element name="Encoding" type="s:string" maxOccurs="1" minOccurs="0"/>
<s:element name="Warnings" type="tns:ArrayOfWarning" maxOccurs="1" minOccurs="0"/>
<s:element name="StreamIds" type="tns:ArrayOfString" maxOccurs="1" minOccurs="0"/>
</s:sequence>
</s:complexType>
</s:element>
I am interested in getting the "Result" base64Binary value converted into a character string that I can display.
Currently I have the value returned from the web service call saved in a MEMPTR variable.
Does anyone know how I convert the base64Binary data to a character string?
Thank you,
Terry
Currently I have the value returned from the web service call saved in a
MEMPTR variable.
>
The whole XML document or the element value?
Does anyone know how I convert the base64Binary data to a character
string?
>
In general terms, you use the BASE64-DECODE() function to go from the element value in the xml document to a RAW or MEMPTR value.
mptrValue = base64-decode(cCurrentFieldValue).
If you're sure there's character data in that memptr, you can then use the get-string function to get a character value from the memptr.
cStringValue = get-string (mptrValue, 1).
-- peter
Thanks Peter,
Yes, it's an element of the XML returned from the web service.
As you indicated - I did find the BASE64-DECODE() function and was able to use it, but I had to convert the MEMPTR variable I used for the NODE-VALUE-TO-MEMPTR to a LONGCHAR before I could use the BASE64-DECODE.
I used COPY-LOB for this.
Now I have a MEMPTR that the BASE64-DECODE passed back and it is ASCII text I can read now.
I seem to have it working now.
I'm quite new to working with XML and Web Services so it has been presenting some challenges and I might be making it more complicated than it needs to be.
Thanks for your feed back.
Terry