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

Re: question on how to parse out a response from service



George,

If this is all you're getting, then why not just parse it with HTTPAPI's regular XML parser, or with one of the parsers that are built-in to RPG? I can't help but think I'm missing something, here...

-SK

On 4/26/2016 6:37 AM, CXGBaldwin@xxxxxxxxxxxxx wrote:
    Scott,
    All I get back from the service is what you see below. I seen in the
    code how to extract the payload when wrapped in a XML document but I do
    not get the XML all I get is the payload.  I would expect an XML
    wrapped around it also but after speaking with the services tech team
    they said this is how they do it and I will need to parse out this
    return data just as it is.
    I could write a parser for this but I was hoping there would already be
    a way to parse this payload in your software and maybe I am just not
    seeing it in the code.
    Thanks again,
    George A. Baldwin
    CGI Consultant
    Cell:614-753-5293
    From:        Scott Klement <sk@xxxxxxxxxxxxxxxx>
    To:        HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
    Date:        04/26/2016 01:22 AM
    Subject:        Re: question on how to parse out a response from
    service
    Sent by:        ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
      __________________________________________________________________

    Hi George,
    You haven't provided much information here...  I'm guessing the problem
    is that the web server is returning one XML document embedded within
    another one?  Is that what you're saying?  That the document you show
    here comes out of HTTPAPI's XML parser?
    If so, here's an example of extracting an 'inner payload' XML from an
    outer one:
    [1]http://www.scottklement.com/httpapi/bankrout.txt
    -SK
    On 4/25/2016 11:54 AM, CXGBaldwin@xxxxxxxxxxxxx wrote:
    >     All,
    >     Hello we are trying to return the following string to the AS/400
    and
    >     need to know how we would parse this out so we get values and
    tags as
    >     needed. I am new to this process and need a little help
    understanding
    >     how to handle this type of a return from a web service.
    >     We send this type of a request using  this command to request the
    >     response from the service:
    >     http_url_post_xml(%TRIM(PPCXADR)
    >                      : %addr(postData) + 2
    >                      : %len(postData)
    >                      : %paddr(PARSERTRNXML)
    >                      : *Null
    >                      : *NULL );
    >     This is the string we send to the server:
    >
    >     <WSPInternalPayload>
    >     <Parameter name="ClientId" value="9999"/>
    >     <Parameter name="ClientAccountNumber"
    value="AXXX00099999999999"/>
    >     <Parameter name="ServiceMethod"
    value="DeleteeBillPaymentSchedule"/>
    >     <Parameter name="Host" value="mo" />
    >     </WSPInternalPayload>
    >
    >     And we are able to connect and pass the request to the service
    and the
    >     service processes it fine but then the service returns the
    following
    >     string:
    >
    >     <WSPInternalPayload>
    >     <Aggregate name="DeletePaymentStatus">
    >     <Parameter name="Status" value="999" />
    >     <Parameter name="Description" value="No eBill Payment Schedule
    found
    >     for ClientId 9999 TransactionType I ClientAccountNumber
    >     AXXX00099999999999" />
    >     </Aggregate>
    >     </WSPInternalPayload>
    >
    >     When we look at the data coming back from the service it looks
    fine but
    >     when we try to parse it we don't see all the values it seems to
    only
    >     return bits and pieces. So how would you recommend we return and
    parse
    >     the data above to get the tags and the data correctly?
    >     Thanks,
    >     George A. Baldwin
    >     CGI Consultant
    >

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