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

Re: Web Service Request - Response Delay



   Hi again,
   My WSDL2RPG version is  v1.13 and HTTPAPI Ver 1.23
   I did the traceroute from AS400 & Windows machine and identified that
   it is goes with same path.
   so i don't think this is a network issue.
   I'm using MemoryManager_createArray() methods as well.
   I'm really confuse what Mike is telling, can you please explain to how
   to do this.
   Thomas, What is the expected result of debug the procedure
   HTTP_receiveResponse()
   The second scenario, I have to send the few request message to the
   server - all are almost similar to attached response.
   I'm trying to send two message at once & I exectue my attached
   webService client program in different jobq in one subsystem
   I hope in this case, the both execution will end up with 3 minutes,
   but it doesn't gives any response.
   any idea please..
   Thanks
   Dhanushka

   On Wed, Sep 21, 2011 at 11:08 PM, Thomas Raddatz
   <[1]thomas.raddatz@xxxxxxxxxxx> wrote:

     Dhanushka,
     Dynamic arrays might be an issue in case the arrays must be
     extended too
     often or if you use symbolic names instead of the array handle.
     Because you use dynamic arrays I assume that you do not use
     WSDL2RPG 1.3
     but v1.13, right?
     Background information:
     If you use symbolic names instead of the array handles, WSDL2RPG
     has to get
     the handle from a "Map" each time you access the array. For that it
     uses
     the binary search algorithm. I wished I had a true index to get rid
     of the
     binary search to increase performance.
     When creating a dynamic array the array allocates storage for 256
     elements.
     Each time the array is full it reallocates storage for another 256
     elements. So for extremely huge arrays time to reallocate storage
     can
     dramatically slow down performance. If you use very huge arrays,
     you should
     specify a reasonable initial size at each
     MemoryManager_createArray()
     statement:
        MemoryManager_createArray(
           serviceUUID: elemSize: name: ensureUniqueName: increment)
     Do not use Array_new() directly!
     You may also add debug statements to procedure
     HTTP_receiveResponse() of
     your stub module:
          else;
             http_DebugLog_appendText('anyDebugText-StartParser');
             if (XMLSAXParser_parse(g_hSAXParser: i_data: i_length) =
     cTrue);

     http_DebugLog_appendText('anyDebugText-EndParser-Success');
                return i_length;
             else;

     http_DebugLog_appendText('anyDebugText-EndParser-Failure');
                return -1;
                // return i_length;
             endif;
          endif;
       /end-free
       *
      P HTTP_receiveResponse...
      P                 E
     http_DebugLog_appendText
     Last but not least it might be an idea to set up a soapUI mock web
     service
     to debug the problem inside the local network.
     Thomas
     Am [2]21.09.2011 18:43, schrieb Dhanushka Manjula:

   >
   >     @ Mike
   >     I'll try to do it tomorrow...
   >     @ Thomas,
   >     One thing I forgot to mention, I use dynamic arrays in order to
   get
   >     around the 64k barrier..
   >     and processor utilization in our system is not more than 65%
   >     I'll ask network guys to look into the firewall again..
   >
   >     On Wed, Sep 21, 2011 at 9:30 AM, Thomas Raddatz

   >     <[1][3]thomas.raddatz@xxxxxxxxxxx>  wrote:
   >
   >       Good idea, Mike!
   >       It is hard to believe that WSDL2RPG consumes the additional
   time. I
   >       assume
   >       that one of the following things is true:
   >       1. Network connection is different for the System i and his
   PC.
   >       2. Too much workload on the System i.
   >       3. soapUI does not parse the response, hence it must be faster
   (but
   >       not
   >       that much)
   >       If Dhanushka really uses WSDL2RPG 1.3 then WSDL2RPG uses
   simple
   >       string
   >       operations to create the request message. That should not take
   that
   >       much
   >       time. Then is calls http_post_xml() to send the request,
   receive
   >       the
   >       response and parse the response message.
   >       Thomas.

     >       Am [2]21.09.2011 18:01, schrieb Mike Krebs:

   >
   >     >  Let's narrow it down a bit. Are you experiencing the delay in
   >     transmission, receipt, or parsing. I don't know or use WSDL2RPG
   but
   >     you can insert a couple of TIME statements to see the time of
   things
   >     in your debug log. Edit member HTTPAPIR4 and change the
   following
   >     lines (from current beta):
   >     >
   >     >  About 354 (find entered)
   >     >  c                   callp     http_dmsg( 'do_oper(' + peOper
   + '): '
   >     >  c                                      + 'entered at ' +
   >     %char(%time()))
   >     >
   >     >  About 904 (find comm_blockread)
   >     >  c                   callp     http_dmsg('calling
   comm_blockread at '
   >     +
   >     >  c                                %char(%time()))
   >     >
   >     >  Recompile the service program by calling the INSTALL routine
   again
   >     or by following the instructions in the program source.
   >     >
   >     >  If WSDL2RPG has some similar debug points, do the same there
   so you
   >     can see progression as it prepares/parses the XML.
   >     >
   >     >  So then you can look at your debug file and see how long each
   part
   >     takes. Narrows down where to look for issues.
   >     >
   >     >
   >     >  -----Original Message-----

     >     >  From: [3][4]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
     >     [mailto:[4][5]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On
     Behalf Of

   >     Dhanushka Manjula
   >     >  Sent: Wednesday, September 21, 2011 6:34 AM

     >     >  To: [5][6]ftpapi@xxxxxxxxxxxxxxxxxxxxxx

   >     >  Subject: Web Service Request - Response Delay
   >     >
   >     >  Hello,
   >     >
   >     >  I'm using WSDL2RPG 1.3 + scott's LIBHTTP to send the attached
   >     request
   >     >  message to the server in remote location via 2MB E1 line.
   >     >  it takes around 3 minutes to receive the attached response
   message.
   >     >  Then, I used the SOAP-UI from my windows machine&   execute
   the same
   >     request
   >     >  &   it takes around 10 seconds to complete the process.
   >     >  what will be the reason for this delay?
   >     >
   >     >  Thank you
   >     >  Dhanushka
   >     >
   >
   ----------------------------------------------------------------------
   >     -
   >     >  This is the FTPAPI mailing list.  To unsubscribe, please go
   to:

     >     >  [6][7]http://www.scottklement.com/mailman/listinfo/ftpapi

   >     >
   >
   ----------------------------------------------------------------------
   >     -
   >     >
   >
   ----------------------------------------------------------------------
   >     -
   >     This is the FTPAPI mailing list.  To unsubscribe, please go to:

     >     [7][8]http://www.scottklement.com/mailman/listinfo/ftpapi
     >
     -------------------------------------------------------------------
     ---
     >     -
     >
     > References
     >
     >     1. mailto:[9]thomas.raddatz@xxxxxxxxxxx
     >     2. tel:21.09.2011%2018
     >     3. mailto:[10]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
     >     4. mailto:[11]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
     >     5. mailto:[12]ftpapi@xxxxxxxxxxxxxxxxxxxxxx
     >     6. [13]http://www.scottklement.com/mailman/listinfo/ftpapi
     >     7. [14]http://www.scottklement.com/mailman/listinfo/ftpapi

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

References

   1. mailto:thomas.raddatz@xxxxxxxxxxx
   2. tel:21.09.2011%2018
   3. mailto:thomas.raddatz@xxxxxxxxxxx
   4. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   5. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   6. mailto:ftpapi@xxxxxxxxxxxxxxxxxxxxxx
   7. http://www.scottklement.com/mailman/listinfo/ftpapi
   8. http://www.scottklement.com/mailman/listinfo/ftpapi
   9. mailto:thomas.raddatz@xxxxxxxxxxx
  10. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
  11. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
  12. mailto:ftpapi@xxxxxxxxxxxxxxxxxxxxxx
  13. http://www.scottklement.com/mailman/listinfo/ftpapi
  14. http://www.scottklement.com/mailman/listinfo/ftpapi
  15. http://www.scottklement.com/mailman/listinfo/ftpapi
  16. http://www.scottklement.com/mailman/listinfo/ftpapi
      
     H DEBUG
     H OPTION(*SRCSTMT : *NODEBUGIO)
     H EXTBININT(*YES)
FB15 FSIPDL     IF   E           K DISK
FB15 FSIPDE     IF a E           K DISK
      *
      *  Define the prototype of the web service procedure
      *  and the required type definitions (aka reference fields).
      *
      /DEFINE PROTOTYPE_SAP0010
 CPY  /COPY MANJULA/QRPGLESRC,SAP0010
      /UNDEFINE PROTOTYPE_SAP0010
      *
      /IF DEFINED(LOGGING_SERVICE)
 CPY  /COPY QWSDL2RPG,PLOG4RPG                     Log4rpg: The Log4rpg service program
 CPY  /COPY QWSDL2RPG,PLOG4RPG00                   Log4rpg: The Log4rpg stub module
      /ENDIF
      *
      *  Program entry point
     D SAP0010T...
     D                 PR
     d w_DOCNDH                      10a
     d w_COMPDH                       4a
     d w_CURRDH                       5a
     d w_DODTDH                       8a
     d w_TRDTDH                       8a
     d w_REFNDH                      16a
     d w_DCTXDH                      25a
     d w_DCTYDH                       2a
     d w_EXRTDH                       9  5
     d w_DOCSDH                       1a
     d w_UPLDDH                       1a
      *
      *  Sends a message to the command line.
     D sndMsg...
     D                 PR                  extproc('sndMsg')
     D  i_text                      128A   value  varying
      *
      *  asign data to Document Header..
     D PR_DocumentH...
     D                 PR
      *  asign data to Document Line item..
     D PR_DocumentGL...
     D                 PR
     d w_TRNMDL                       2a
      *  asign data to Currency Amount..
     D PR_DocumentCA...
     D                 PR
     d w_TRNMDL                       2a
      *  asign data to Account Receivable..
     D PR_DocumentAR...
     D                 PR
     d w_TRNMDL                       2a
      *  asign data to Account Payble..
     D PR_DocumentAP...
     D                 PR
     d w_TRNMDL                       2a
      *  asign data to Copa structure..
     D PR_DocumentCP...
     D                 PR
     d w_TRNMDL                       2a

      *  asign data to Document Error..
     D PR_DocumentE...
     D                 PR
      *  asign leading zeros to given string field
     D PR_LeadingZero...
     D                 PR            10a
     d In_Word                       10a

      * send SMS message to the Administrators
     D sndSMS          pr                  extpgm('SNDSMS')
     d  smsMOB                       10A
     d  smsMSG                      256A
     d  smsUSR                       10A
     d  smsSTS                        1A
     d  smsRTN                        1A
      *
      *?=====================================================================
      *  Program entry point
      *?=====================================================================
     D SAP0010T...
     D                 PI
     d w_DOCNDH                      10a
     d w_COMPDH                       4a
     d w_CURRDH                       5a
     d w_DODTDH                       8a
     d w_TRDTDH                       8a
     d w_REFNDH                      16a
     d w_DCTXDH                      25a
     d w_DCTYDH                       2a
     d w_EXRTDH                       9  5
     d w_DOCSDH                       1a
     d w_UPLDDH                       1a
      *
      *  Web service error message text
     D errText         S                   like(wsdl_errText_t ) inz
      *
      *  Request message--
      *  These fields needs to be filled with reasonable values
      *  right before calling the web service.
     D parameters      DS                  likeds(tns_ZualAccDocumentPost_t)
     D                                     inz
      *
      *  Response message--
      *  This structure contains the result values returned by
      *  the web service.
     D ZualAccDocumentPostResponse...
     D                 DS                  likeds(tns_ZualAccDocumentPostResp...
     D                                     onse_t)
     D                                     inz
      *
      *  Text of messages sent to the command line
     D text            S            128A   varying inz
      *
      *  Memory Manager UUID, used to allocate and free
      *  the memory blocks of the dynamic arrays
     D uuid            S                   like(wsdl_uuid_t ) inz
      *
      *  Dynamic array helper fields and structure
     D X_A1            S             10I 0 inz
     D X_A2            S             10I 0 inz
     D X_A3            S             10I 0 inz
     D X_A4            S             10I 0 inz
     D X_A5            S             10I 0 inz
     D X_A6            S             10I 0 inz
      *
     D curZualBapiacgl09_A1...
     D                 DS                  likeds(tns_ZualBapiacgl09_t)
     D                                     based(pX_A1)
      *
     D newZualBapiacgl09_A1...
     D                 DS                  likeds(tns_ZualBapiacgl09_t)
     D                                     inz
      *
     D curZualBapiacap09_A2...
     D                 DS                  likeds(tns_ZualBapiacap09_t)
     D                                     based(pX_A2)
      *
     D newZualBapiacap09_A2...
     D                 DS                  likeds(tns_ZualBapiacap09_t)
     D                                     inz
      *
     D curZualBapiacar09_A3...
     D                 DS                  likeds(tns_ZualBapiacar09_t)
     D                                     based(pX_A3)
      *
     D newZualBapiacar09_A3...
     D                 DS                  likeds(tns_ZualBapiacar09_t)
     D                                     inz
      *
     D curZualBapiackec9_A4...
     D                 DS                  likeds(tns_ZualBapiackec9_t)
     D                                     based(pX_A4)
      *
     D newZualBapiackec9_A4...
     D                 DS                  likeds(tns_ZualBapiackec9_t)
     D                                     inz
      *
     D curZualBapiaccr09_A5...
     D                 DS                  likeds(tns_ZualBapiaccr09_t)
     D                                     based(pX_A5)
      *
     D newZualBapiaccr09_A5...
     D                 DS                  likeds(tns_ZualBapiaccr09_t)
     D                                     inz
      *
     D curBapiret2_A6  DS                  likeds(tns_Bapiret2_t)
     D                                     based(pX_A6)
      *
     D newBapiret2_A6  DS                  likeds(tns_Bapiret2_t)
     D                                     inz
      *?=====================================================================
      *Local Variables goes here...
      *?=====================================================================
     d size_t          s             10i 0 inz
     d i               s             10i 0 inz
      *
     D t_Bapiret2_A10...
     D                 DS                  likeds(tns_Bapiret2_t)
     D                                     inz
     d t_DOCNDH        s             10A   Inz
      *
      * Indicators use to manage dynamic arrays
     d IND_GL          s               N   Inz(*Off)
     d IND_CA          s               N   Inz(*Off)
     d IND_AP          s               N   Inz(*Off)
     d IND_AR          s               N   Inz(*Off)
     d IND_CP          s               N   Inz(*Off)
     D IND_RTN         s               N   Inz(*Off)
      * Variables to send the SMS in case of problem with net connectivies,
      * XML error or SOAP error ..ect.
     d t_smsMOB        s             10A
     d t_smsMSG        s            256A
     d t_smsUSR        s             10A   Inz(*USER)
     d t_smsSTS        s              1A   Inz('I')
     d t_smsRTN        s              1A   Inz('N')
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free
      /if defined(LOGGING_SERVICE)

         // Enable Log4rpg, in order to debug this module
         // (Enable Log4rpg when you are ask for it by the developer)
         ZUAL_ACC_DOCUMENT_POST_startLoggingService(
            'mbr:QWSDL2RPG.LOG4RPG');
      /endif

         // Enable/disable http api debug log :
         // Set DOCSDH = "D" in SIPDH file to Enable the http api debug
         // log in case of problems with the web service

         If (w_DOCSDH = 'D') ;
            ZUAL_ACC_DOCUMENT_POST_setHttpDebug(
               *ON: '/tmp/httpapi_debug.txt');   // Default path of http api
         EndIf;

         // Specify a proxy server if KEELLS network requires it.
         // ZUAL_ACC_DOCUMENT_POST_setProxy(
         //    'your.proxy.server': 8080);

         //
         // Need to registers an user callback procedure to send the
         // user authentification details to the web service
         //
           ZUAL_ACC_DOCUMENT_POST_registerLoginCallback(
             %Paddr('ZUAL_ACC_DOCUMENT_POST_supplyLoginData')
           );

         // Initialize the Memory Manager
         // (Use 'uuid' to create dynamic arrays within the same heap.)
         uuid =
            ZUAL_ACC_DOCUMENT_POST_initializeMemoryManager();

       //
       //?__________________________________________________________________
          SetLL (w_DOCNDH) SIFDL;
          readE (w_DOCNDH) SIFDL;
          Dow Not %Eof(SIPDL) ;
              PR_DocumentGL(TRNMDL);
              PR_DocumentCP(TRNMDL);
              PR_DocumentCA(TRNMDL);
              PR_DocumentAP(TRNMDL);
              PR_DocumentAR(TRNMDL);
          readE (w_DOCNDH) SIFDL;
          Enddo;
       //?__________________________________________________________________
       //

       // assign a document Header goes here...
         PR_DocumentH();


         // Create a dynamic array and add a sample item:
         // (Use the heap that has been assigned to 'uuid'.
         parameters.Return.item.hItems =
            MemoryManager_createArray(uuid: %size(newBapiret2_A6): 'item_60');


         // Now let's call the web service.
         ZualAccDocumentPostResponse =
            ZUAL_ACC_DOCUMENT_POST_ZualAccDocumentPost(
                parameters:
                errText);

         // If the Web service finished successfully ...
 B01     if (not ZUAL_ACC_DOCUMENT_POST_isError());
            //
            //Read responce message & write the status to the SIPDE file
            //
             t_Bapiret2_A10= Array_getName
                    (ZualAccDocumentPostResponse.RETURN.ITEM.HITEMS);

             for i = 1 to Array_getNumE(t_Bapiret2_A10);
                  pX_A6  = Array_get(  t_Bapiret2_A10   : i);
                  PR_DocumentE();
             Endfor;

 X01     else;
            // ... else show error messages ordered by priority:
            // 1. HTTP error information
            text = %char(
                      ZUAL_ACC_DOCUMENT_POST_HttpError_getCode()
                      ) + ': ' +
                   ZUAL_ACC_DOCUMENT_POST_HttpError_getText()
                   ;
            //sndMsg(text);
            t_smsMSG = 'SAP WEBSERVICE ERROR : ' + %trim(text);
            t_smsMOB = ''          ;

            sndSMS(t_smsMOB:t_smsMSG:t_smsUSR:t_smsSTS:t_smsRTN);

            // 2. SOAP error information
 B02        if (ZUAL_ACC_DOCUMENT_POST_SoapError_getCode()
                  <> '');
               text = ZUAL_ACC_DOCUMENT_POST_SoapError_getCode()
                      + ': ' +
                      ZUAL_ACC_DOCUMENT_POST_SoapError_getText()
                      ;
            //sndMsg(text);
            t_smsMSG = 'SAP WEBSERVICE ERROR : ' + %trim(text);
            t_smsMOB = ''          ;
            sndSMS(t_smsMOB:t_smsMSG:t_smsUSR:t_smsSTS:t_smsRTN);
 E02        endif;
            // 3. XML parser error information
 B02        if (ZUAL_ACC_DOCUMENT_POST_XmlError_getCode()
                  <> 0);
               text = %char(ZUAL_ACC_DOCUMENT_POST_XmlError_getCode())
                      + ': ' +
                      ZUAL_ACC_DOCUMENT_POST_XmlError_getText()
                      ;
            //sndMsg(text);
            t_smsMSG = 'SAP WEBSERVICE ERROR : ' + %trim(text);
            t_smsMOB = ''          ;
            sndSMS(t_smsMOB:t_smsMSG:t_smsUSR:t_smsSTS:t_smsRTN);
 E02        endif;
 E01     endif;

         // Terminate Memory Manager and free resources
         // (Release all memory blocks that have been allocated within
         //  the heap that is assigned to 'uuid'.)
         ZUAL_ACC_DOCUMENT_POST_terminateMemoryManager(uuid);

         //
         // Send back the status of the executed transaction to the
         // SIPDH file. ( If Success = 'Y' )
         //
            If IND_RTN = *On ;
            w_UPLDDH   = 'Y' ;
            Else             ;
            w_UPLDDH   = 'N' ;
            Endif            ;

         *inlr = *on;

      /end-free
      *?
      * =====================================================================
      *  *** private ***
      *  Sends a message to the command line.
      * =====================================================================
      *?
     P sndMsg...
     P                 B
      *
     D sndMsg...
     D                 PI
     D  i_text                      128A   value  varying
      *
      *  Local fields
     D msgKey          S              4A   inz
      *
      *  Qualified message file name
     D qMsgF           DS                  qualified inz
     D  name                         10A
     D  lib                          10A
      *
      *  API error code
     D errCode         DS                  qualified inz
     D  bytPrv                       10I 0
     D  bytAvl                       10I 0
     D  excID                         7A
     D  reserved                      1A
     D  excDta                      256A
      *
      *  Send Program Message (QMHSNDPM) API
     D QMHSNDPM        PR                         extpgm('QMHSNDPM')
     D   i_msgID                      7A   const
     D   i_qMsgF                     20A   const
     D   i_msgData                32767A   const  options(*varsize )
     D   i_length                    10I 0 const
     D   i_msgType                   10A   const
     D   i_callStkE               32767A   const  options(*varsize )
     D   i_callStkC                  10I 0 const
     D   o_msgKey                     4A
     D   io_ErrCode               32767A          options(*varsize )
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free
         clear qMsgF;
         qMsgF.name = 'QCPFMSG';
         qMsgF.lib  = '*LIBL';
         clear errCode;
         errCode.bytPrv = %size(errCode);
         QMHSNDPM('CPF9897': qMsgF: i_text: %len(i_text): '*INFO'
                  : '*CTLBDY': 1: msgKey: errCode);
         return;
      /end-free
      *
     P sndMsg...
     P                 E
      *?
      * =====================================================================
      *  *** private ***
      *  Register callback procedure..
      * =====================================================================
      *?
     P ZUAL_ACC_DOCUMENT_POST_supplyLoginData...
     P                 B                   export
      *
     D ZUAL_ACC_DOCUMENT_POST_supplyLoginData...
     D                 PI            10i 0
     D i_authType                    14A   const varying
     D i_realm                      126A   const varying
     D i_numAttempts                 10I 0 const
     D o_user                        50A   varying
     D o_password                    50A   varying
      *Return Value
     D rc              S             10I 0
      /free

          if (i_authType = WSDL_AUTH_TYPE_PROXY);
          o_user         = 'USR_RFC';
          o_password     = 'xyzttt12';
          return WSDL_SUCCESS;
          endif;

          if (i_authType = WSDL_AUTH_TYPE_HTTP);
          o_user         = 'USR_RFC';
          o_password     = 'xyzttt12';
          return WSDL_SUCCESS;
          endif;

          return WSDL_ERROR;
      /end-free
      *
     P ZUAL_ACC_DOCUMENT_POST_supplyLoginData...
     P                 E
      *?
      *?=====================================================================
      *  *** private ***
      *  Webservice responce message details extracting here..
      *?=====================================================================
      *?
     P PR_DocumentE    B
     D PR_DocumentE    PI
      * Local fields
      /Free
        // Calculation code goes here
           If (CURBAPIRET2_A6.TYPE = 'S' )     ;
              IND_RTN = *On;
           EndIf                               ;
           //__|
           //  |
           DOCNDE = w_DOCNDH                   ;
         //LINNDE =
           TYPEDE = CURBAPIRET2_A6.TYPE        ;
           IDNODE = CURBAPIRET2_A6.ID          ;
           NUMBDE = CURBAPIRET2_A6.NUMBER      ;
           MESGDE = CURBAPIRET2_A6.MESSAGE     ;
           LOGNDE = CURBAPIRET2_A6.LOGNO       ;
           LOMNDE = CURBAPIRET2_A6.LOGMSGNO    ;
           MSV1DE = CURBAPIRET2_A6.MESSAGEV1   ;
           MSV2DE = CURBAPIRET2_A6.MESSAGEV2   ;
           MSV3DE = CURBAPIRET2_A6.MESSAGEV3   ;
           MSV4DE = CURBAPIRET2_A6.MESSAGEV4   ;
           PARMDE = CURBAPIRET2_A6.PARAMETER   ;
           ROWNDE = %char(CURBAPIRET2_A6.ROW)  ;
           FELDDE = CURBAPIRET2_A6.FIELD       ;
           SYSMDE = CURBAPIRET2_A6.SYSTEM      ;
           DATEDE =      %Char(%Date(): *ISO0) ;
           TIMEDE =  %Dec(%time())             ;
           Write SIFDE;

      /End-free
     P PR_DocumentE    E
      *?
      *?=====================================================================
      *  *** private ***
      *  Set leading zeros to given string..
      *?=====================================================================
      *?
     P PR_LeadingZero  B
     D PR_LeadingZero  PI            10a
     d In_Word                       10a
      * Local fields
     d t_Zero          S             10A   Inz('0000000000')
      /Free
        // Calculation code goes here
        %subst(t_Zero: 11-%len(%trim(In_Word)) : %len(%trim(In_Word))) =
           %Trim(In_Word);
        return t_Zero;

      /End-free
     P PR_LeadingZero  E
      *?
      *?=====================================================================
      *  *** private ***
      *  Assign Document Header details to the SOAP request accordingly
      *?=====================================================================
      *?
     P PR_DocumentH    B
     D PR_DocumentH    PI
      * Local fields
     D t_Date          S               D   datfmt(*iso)
      /Free
        // Calculation code goes here
         parameters.Documentheader.BusAct       = 'RFBU';
         parameters.Documentheader.Username     = 'ISRDEV2';
         parameters.Documentheader.HeaderTxt    =  %trim(w_DCTXDH);
         parameters.Documentheader.CompCode     =  %trim(w_COMPDH);
         t_date = %date(%int(w_DODTDH));
         parameters.Documentheader.DocDate      =  %char(t_date);
         t_date = %date(%int(w_TRDTDH));
         parameters.Documentheader.PstngDate    =  %char(t_date);
         parameters.Documentheader.DocType      =  w_DCTYDH       ;
         parameters.Documentheader.RefDocNo     =  %trim(w_REFNDH);

      /End-free
     P PR_DocumentH    E
      *?
      *?=====================================================================
      *  *** private ***
      *  Assign Copa transaction details to the SOAP request accordingly
      *?=====================================================================
      *?
     P PR_DocumentCP   B
     D PR_DocumentCP   PI
     d w_TRNMDL                       2a
      * Local fields
      /Free
        //
         If IND_CP = *Off ;
         // Create a dynamic array and add a sample item:
         // (Use the heap that has been assigned to 'uuid'.
         parameters.Criteria.item.hItems =
            MemoryManager_createArray(uuid: %size(newZualBapiackec9_A4): 'item_+
            40');
         IND_CP = *On;
         EndIf;

         If w_TRNMDL = 'GL';

            If PLOBDL <> *Blanks;
            newZualBapiackec9_A4.ItemnoAcc = %EDITC( LINNDL : 'X' );
                  //  %char(LINNDL);
            newZualBapiackec9_A4.Copafieldname = 'WWPLB' ;
            newZualBapiackec9_A4.Copacharacter = PLOBDL  ;
            Array_add(
               parameters.Criteria.item.hItems
               : %addr(newZualBapiackec9_A4)
               );
            Endif;

            If PLRCDL <> *Blanks;
            newZualBapiackec9_A4.ItemnoAcc = %EDITC( LINNDL : 'X' );
            newZualBapiackec9_A4.Copafieldname = 'WWRCL' ;
            newZualBapiackec9_A4.Copacharacter = PLRCDL  ;
            Array_add(
               parameters.Criteria.item.hItems
               : %addr(newZualBapiackec9_A4)
               );
            Endif;

         Endif;

      /End-free
     P PR_DocumentCP   E
      *?
      *?
      *?=====================================================================
      *  *** private ***
      *  Assign GL transaction details to the SOAP request accordingly
      *?=====================================================================
      *?
     P PR_DocumentGL   B
     D PR_DocumentGL   PI
     d w_TRNMDL                       2a
      * Local fields
     D t_Date          S               D   datfmt(*iso)
      /Free
        //
         If IND_GL = *Off ;
         // Create a dynamic array and add a sample item:
         // (Use the heap that has been assigned to 'uuid'.
          parameters.Accountgl.item.hItems =
            MemoryManager_createArray(uuid: %size(newZualBapiacgl09_A1):
            'item10');
         IND_GL = *On;
         EndIf;

         If w_TRNMDL = 'GL';
         newZualBapiacgl09_A1.ItemnoAcc = %char(LINNDL);
         newZualBapiacgl09_A1.GlAccount = %EDITC( %int(CODEDL) : 'X' );
         newZualBapiacgl09_A1.ItemText =  LITXDL     ;
         newZualBapiacgl09_A1.RefKey1 = BLOBDL   ;
         newZualBapiacgl09_A1.RefKey2 = BSRCDL   ;
         newZualBapiacgl09_A1.CompCode = w_COMPDH   ;
         newZualBapiacgl09_A1.AllocNmbr = ASKYDL     ;
         newZualBapiacgl09_A1.Costcenter = CSCNDL    ;
         newZualBapiacgl09_A1.ProfitCtr = PRCNDL     ;
         Array_add(
            parameters.Accountgl.item.hItems
            : %addr(newZualBapiacgl09_A1)
            );
         Endif;

      /End-free
     P PR_DocumentGL   E
      *?
      *?=====================================================================
      *  *** private ***
      *  Assign Currency Amount details to the SOAP request accordingly
      *?=====================================================================
      *?
     P PR_DocumentCA   B
     D PR_DocumentCA   PI
     d w_TRNMDL                       2a
      * Local fields
      /Free
        //
         If IND_CA = *Off ;
         // Create a dynamic array and add a sample item:
         // (Use the heap that has been assigned to 'uuid'.
         parameters.Currencyamount.item.hItems =
            MemoryManager_createArray(uuid: %size(newZualBapiaccr09_A5): 'item_+
            50');
         IND_CA = *On;
         EndIf;

         newZualBapiaccr09_A5.ItemnoAcc = %char(LINNDL);
         newZualBapiaccr09_A5.Currency  = w_CURRDH;
         newZualBapiaccr09_A5.AmtDoccur = DCAMDL;
         newZualBapiaccr09_A5.ExchRate  = w_EXRTDH;
         newZualBapiaccr09_A5.AmtBase   = LCAMDL;
         Array_add(
            parameters.Currencyamount.item.hItems
            : %addr(newZualBapiaccr09_A5)
            );

      /End-free
     P PR_DocumentCA   E
      *?
      *?=====================================================================
      *  *** private ***
      *  Assign Account Payble details to the SOAP request accordingly
      *?=====================================================================
      *?
     P PR_DocumentAP   B
     D PR_DocumentAP   PI
     d w_TRNMDL                       2a
      * Local fields
      /Free
        //
         If IND_AP = *Off ;
         parameters.Accountpayable.item.hItems =
            MemoryManager_createArray(uuid: %size(newZualBapiacap09_A2): 'item_+
            20');
         IND_AP = *On;
         EndIf;

         If w_TRNMDL = 'AP';
         newZualBapiacap09_A2.ItemnoAcc = %char(LINNDL);
         Monitor;
         newZualBapiacap09_A2.VendorNo  = %EDITC( %int(CODEDL) : 'X' );
         On-Error;
         newZualBapiacap09_A2.VendorNo  = CODEDL       ;
         Endmon;
         newZualBapiacap09_A2.RefKey1   = BLOBDL   ;
         newZualBapiacap09_A2.RefKey2   = BSRCDL   ;
         newZualBapiacap09_A2.CompCode  = w_COMPDH    ;
         newZualBapiacap09_A2.Pmnttrms  = PYTMDL   ;
         newZualBapiacap09_A2.PymtMeth  = PYMDDL      ;
         newZualBapiacap09_A2.PmntBlock = PYHDDL  ;
         newZualBapiacap09_A2.AllocNmbr = ASKYDL  ;
         newZualBapiacap09_A2.ItemText  = LITXDL  ;
         newZualBapiacap09_A2.SpGlInd   = SGLIDL  ;
         newZualBapiacap09_A2.ProfitCtr = PRCNDL  ;

         Array_add(
            parameters.Accountpayable.item.hItems
            : %addr(newZualBapiacap09_A2)
            );
        // |-----------------
         parameters.Customercpd.Name      = NAM1DL ;
         parameters.Customercpd.Name2     = NAM2DL ;
         parameters.Customercpd.Name3     = NAM3DL ;
         parameters.Customercpd.Name4     = NAM4DL ;
         parameters.Customercpd.PostlCode = PSCDDL ;
         parameters.Customercpd.City      = CITYDL ;
         parameters.Customercpd.Country   = BKCNDL ;
         parameters.Customercpd.Street    = STRTDL ;
         parameters.Customercpd.PoBox     = POBXDL ;
         parameters.Customercpd.PobxPcd   = POPCDL ;
         parameters.Customercpd.PobkCurac = PBCADL ;
         parameters.Customercpd.BankAcct  = BKACDL ;
         parameters.Customercpd.BankNo    = BKKYDL ;
         parameters.Customercpd.BankCtry  = 'LK'   ;
         parameters.Customercpd.TaxNo1    = TAX1DL ;
         parameters.Customercpd.TaxNo2    = TAX2DL ;


         Endif;

      /End-free
     P PR_DocumentAP   E
      *?
      *?=====================================================================
      *  *** private ***
      *  Assign Account Receivable details to the SOAP request accordingly
      *?=====================================================================
      *?
     P PR_DocumentAR   B
     D PR_DocumentAR   PI
     d w_TRNMDL                       2a
      * Local fields
      /Free
        //
         If IND_AR = *Off ;
         parameters.Accountreceivable.item.hItems =
            MemoryManager_createArray(uuid: %size(newZualBapiacar09_A3): 'item_+
            30');
         IND_AR = *On;
         EndIf;

         If w_TRNMDL = 'AR';
         newZualBapiacar09_A3.ItemnoAcc =  %char(LINNDL);

         Monitor;
         newZualBapiacar09_A3.Customer  = %EDITC( %int(CODEDL) : 'X' );
         On-Error;
         newZualBapiacar09_A3.Customer  = CODEDL                      ;
         EndMon;

         newZualBapiacar09_A3.RefKey1   = BLOBDL   ;
         newZualBapiacar09_A3.RefKey2   = BSRCDL   ;
         newZualBapiacar09_A3.CompCode  = w_COMPDH ;
         newZualBapiacar09_A3.Pmnttrms  = PYTMDL   ;
         newZualBapiacar09_A3.PymtMeth  = PYMDDL   ;
         newZualBapiacar09_A3.PmntBlock =  PYHDDL  ;
         newZualBapiacar09_A3.AllocNmbr =  ASKYDL  ;
         newZualBapiacar09_A3.ItemText  =  LITXDL  ;
         newZualBapiacar09_A3.SpGlInd   =  SGLIDL  ;
         newZualBapiacar09_A3.ProfitCtr =  PRCNDL  ;

         Array_add(
            parameters.Accountreceivable.item.hItems
            : %addr(newZualBapiacar09_A3)
            );

         Endif;

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