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

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



   Example: start and end of elements to retrieve the values



   I always start out printing the return tags and values, so I can see
   the path names, etc



   //print file

   //dcl-f QSYSPRT printer(132) OFLIND(*INOF) usropn;



   Inside each procedure



   //if not %open(qsysprt);

   // open qsysprt;

   //endif;



   //PrintLine = 'Path: '  + path;

   //except;



   //PrintLine = 'Name: '  + name;

   //except;



   //PrintLine = 'Value: ' + value;

   //except;







   lRC = http_url_post_xml( lURL                           :

                            %addr(lSOAP) + 2               :

                            %len(lSOAP)                    :

                            %paddr(TimAvailStartOfElement) :

                            %paddr(TimAvailEndOfElement)   :

                            *NULL );





   P TimAvailStartOfElement...

   P                 B



   if path = '/TimeInTransitResponse/TransitResponse'

     and name = 'ServiceSummary';

         gTimActivity += 1;

   endif;





   P TimAvailEndOfElement...

   P                 B



   select;

   when path = '/TimeInTransitResponse/TransitResponse' +

                '/ServiceSummary/Service';



   select;



     when name = 'Code';

      gTimeInTransit_Response.Code(gTimActivity)

       = value;



     when name = 'Description';

      gTimeInTransit_Response.Desc(gTimActivity)

       = value;



     endsl;







   [1]www.pilotpen.us

   Chris Hayden - Sr. Systems Analyst

   Office: (904) 645-9999 ext.1252

   Mobile: 904-654-4089

   Pilot Corporation of America

   3855 Regent Blvd, Jacksonville, Florida 32224 United States



   This email 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 have received this email in error please notify
   the system manager. This message contains confidential information and
   is intended only for the individual named. If you are not the named
   addressee you should not disseminate, distribute or copy this e-mail.
   Please notify the sender immediately by e-mail if you have received
   this e-mail by mistake and delete this e-mail from your system. If you
   are not the intended recipient you are notified that disclosing,
   copying, distributing or taking any action in reliance on the contents
   of this information is strictly prohibited.

   -----Original Message-----
   From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   [[2]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of
   CXGBaldwin@xxxxxxxxxxxxx
   Sent: Monday, April 25, 2016 12:54 PM
   To: HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
   Subject: question on how to parse out a response from service



   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

References

   1. http://www.pilotpen.us/
   2. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------