[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: consuming web service with large base64 encoded value of embedded XML



Frances,

What release do you have on your System i and what specific problems do you have to process the Base64 encoded data?

It is hard to help you without knowing your environment but basically you can:

a) Use Scott Klements Base64 Encoder/Decoder to decode the Base64 data.

      lenDecoded = base64_decode(pInpData: inpSize: pOutData: outSize)

b) Use my modified version of Scott's Encoder/Decoder which lets you also decode the data to a stream file:

      lenDecoded = base64_decodeBufferToStream(
                         ptrInpData: inpSize: writeFD: pWrite)

pInpData   = Pointer to Base64 encoded input data
inpSize    = size of input data
pOutData   = Pointer to decoded output data
outSize    = maximum size of output buffer
lenDecoded = actual size of decoded output data
writeFD    = file descriptor of stream file
             Sample: fd = open('pathName': ...)
pWrite     = procedure pointer of 'write' procedure
             Sample: %paddr('write')

It may also be required to translate the decoded data if the original CCSID is different from your local CCSID. Maybe it is worth to read my FAQ "How to Send Base64 Encoded Passwords". It describes when and why character translation is required.

http://tools400.de/Downloads/Freeware/Tools/FAQ/wsdl2rpg/FAQ_How_to_Send_Base64_Encoded_Passwords_v1.0.pdf

Thomas.

Am 24.10.2013 21:51, schrieb Frances Knott:
    I am accessing a web service and the response is an XML response with a
    large (49000 character) data field that contains XML that is base64
    encoded.


    At this point, I am able to receive the response into a file in the
    IFS, but I'm having problems processing that large data field.

    This is the beginning portion of the response:


    <service-response><service-id>XMLRating</service-id>

    <request-id>0000100</request-id>

    <status><code>SUCCESS</code>

    <message>XML Rating
    Successful</message>

    </status>

    <error/><data>PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxSYXRlUmVzdWx0cz4KPFN0YXR1c
    0NvZGU+MDwvU3RhdHVzQ29kZT4KPFN0YXR1c01lc3NhZ2U+UmF0aW5nIHByb2

    1vZGVsPSJOT1JNQUxJWkVEX1NNQyIgaXNTZWxlY3RlZD0iZmFsc2UiIGlzQWxsb2NhdGVkP
    SJmYWxzZSIgY3VycmVuY3lDb2RlPSJVU0QiIGNyZWF0ZURhdGU9IjEwLzI0Lz

    43MjwvVG90YWw+CjxOb3JtYWxpemVkVG90YWwgY3VycmVuY3lDb2RlPSJVU0QiPjk4LjcyP
    C9Ob3JtYWxpemVkVG90YWw+CjxDb250cmFjdElkPigyMzY2NzU4NDAwMywzMD

    k8L0NhcnJpZXJJZD4KPENhcnJpZXJOYW1lPkFCRiBGcmVpZ2h0IFN5c3RlbSwgSW5jPC9DY
    XJyaWVyTmFtZT4KPFNDQUM+QUJGUzwvU0NBQz4KPE1vZGU+TFRMPC9Nb2RlPg

    w+MzIuNTQ8L0FjY2Vzc29yaWFsVG90YWw+CjxTdWJUb3RhbD44MC4wMDwvU3ViVG90YWw+C
    jxUb3RhbD4xMTIuNTQ8L1RvdGFsPgo8Tm9ybWFsaXplZFRvdGFsIGN1cnJlbm

    1heD4KPElzTm9udGF4YWJsZT5mYWxzZTwvSXNOb250YXhhYmxlPgo8L0NoYXJnZT4KPC9Da
    GFyZ2VzPgo8Q29tbWVudHMvPjwvUHJpY2VTaGVldD4KPFByaWNlU2hlZXQgdH

    RpQ29kZT4KPEFtb3VudD44Ljk4PC9BbW91bnQ+CjxSYXRlPjE0LjAwPC9SYXRlPgo8UmF0Z
    VF1YWxpZmllcj5QQ1Q8L1JhdGVRdWFsaWZpZXI+CjxRdWFudGl0eT42NC4xNz

    JlaWdodENsYXNzPjAuMDwvRmFrRnJlaWdodENsYXNzPgo8SXNNaW4+ZmFsc2U8L0lzTWluP
    go8SXNNYXg+ZmFsc2U8L0lzTWF4Pgo8SXNOb250YXhhYmxlPmZhbHNlPC9Jc0


    I've reviewed the example programs in libhttp and tried several things
    without success.  Can anyone point me in the right direction to process
    this data?



    Thanks in advance for your help

    J+J Flooring Group

    Frances Knott - Sr. Business Systems Analyst
    p: 706.529.2100 x8384
    [1]www.jj-invision.com
    [2]www.jj-kinetex.com
    J+J Flooring Group
    818 J&J Drive
    PO Box 1287
    Dalton, GA 30722

    Invision | Kinetex

    This e-mail and any files transmitted with it are confidential and
    intended solely for the use of the individual or entity to whom they
    are addressed. If you are not the intended recipient, please notify the
    sender immediately. J+J Flooring Group does not provide or endorse
    opinions, conclusions or other information in this message that do not
    relate to the official business of the company.

References

    1. http://www.jj-invision.com/
    2. http://www.jj-kinetex.com/



-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------

Attachment: WSDL2RPG_BASE64.ZIP
Description: Zip archive

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------