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

Re: Problem calling webservice using WSDL2RPG tool



Thanks Thomas, basically i corrected the content-type from text/xml to text/xml; 
charset=utf-8. Additionally the double quotes to soap action did help to resolve 
my issue.

Apart from this the RPG stub had generated wrong soap request, which i corrected 
it in WS0090 program. I have attached the code for your reference.

When i used the code generated by the tool, it used to give me these set of 
errors:
13: HTTP/1.1 500 Internal Server Error                                
SOAP-ENV:Server: There is no active Web Service with operation named  
  'http://siebel.com/asi/:Mapics TE'.(SBL-EAI-04313)                  

Let me know what you think of them.. Thank you for your help..

Regards,
Avinash.



----- Original Message ----
From: "thomas.raddatz@xxxxxx" <thomas.raddatz@xxxxxx>
To: ftpapi@xxxxxxxxxxxxxxxxxxxxxx
Sent: Mon, 31 January, 2011 3:25:04 PM
Subject: Re: Problem calling webservice using WSDL2RPG tool


   Avinash,
   SoapUI specifies the soap action parameter as shown below:
   Content-Type: text/xml;charset=UTF-8
   SOAPAction: "rpc/http://siebel.com/asi/:Mapics_spcTE";
   User-Agent: Jakarta Commons-HttpClient/3.1
   Host: sbluatweb01.ad.agi
   Proxy-Connection: Keep-Alive
   Content-Length: 1252
   Please open your web service stub module (WS0099) and add the double
   quotes to the soap action parameter likes this:
     headers.contentType =
           ManagedMemoryDataSource_getContentType(hDataSource);
     headers.soapAction  = '"rpc/http://siebel.com/asi/:Mapics_spcTE";';
   Then recompile the stub module and try it again.
   Please let me know if that solved the problem. I do not yet know why
   the soap action parameter has to be set into double quotes. I will try
   to get an answer to that question. Maybe that Scott can shed some
   light on that.
   Thomas.
  ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx schrieb am 31.01.2011 07:29:52:
   > Von: avinash_miraskar@xxxxxxxxxxx
   > An: ftpapi@xxxxxxxxxxxxxxxxxxxxxx
   > Datum: 31.01.2011 09:59
   > Betreff: Problem calling webservice using WSDL2RPG tool
   > Gesendet von: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   >
   > Hello All,
   >
   > I have installed WSDL2RPG tool and i generated the RPG stub and
   > program out of
   > it. Later when i try to invoke the program, it gives me these
   errors:
   >
   > 1) 13: HTTP/1.1 400 Bad Request.
   > 2)SOAP-ENV:Client: SOAPAction '<?>' is of invalid format: SOAPAction
   should
   >   be either rpc/operationName or document/operationName.
        .
   >
   > I have attached the following :
   > 1) WSDL file
   > 2)Corresponding RPG Program and stub generated out of WSDL2RPG tool.
   > 3) HTTP error log after invoking the RPG program.
   >
   > Can someone please help me resolve this issue. Thanks for your help
   > and let me
   > know if you need additional info.
   >
   > Regards,
   > Avinash.
   >
   > [Anhang "MapicTEType.WSDL" gelöscht von Thomas Raddatz/OBI/DE]
   > [Anhang "RPGsources.zip" gelöscht von Thomas Raddatz/OBI/DE] [Anhang
   > "httpapi_debug.txt" gelöscht von Thomas Raddatz/OBI/DE]
   >
   ----------------------------------------------------------------------
   -
   > This is the FTPAPI mailing list.  To unsubscribe, please go to:
   > [1]http://www.scottklement.com/mailman/listinfo/ftpapi
   >
   ----------------------------------------------------------------------
   -

   --
   IMPORTANT NOTICE:
   This email is confidential, may be legally privileged, and is for the
   intended recipient only. Access, disclosure, copying, distribution, or
   reliance on any of it by anyone else is prohibited and may be a
   criminal
   offence. Please delete if obtained in error and email confirmation to
   the sender.

References

   1. http://www.scottklement.com/mailman/listinfo/ftpapi


      /IF NOT DEFINED(PROTOTYPE_WS0090)
      *======================================================================
      *  Generated by WSDL2RPG 1.13 / 21.01.2011
      *  Built on Jan 31, 2011 (02:35:33)
      *  Based on WS_STUB v1.13
      *======================================================================
      *
      *   Please search for 'INFO:' to get basic information how to call
      *   the web service.
      *
      *   Default attachment handling (for demonstration) was added to
      *   WS_STUB but is disabled by default.
      *
      *   In order to enable or disable default attachment handling you have
      *   to define or undefine the following compiler condition name:
      *      DEFAULT_ATTACHMENT_HANDLING
      /UNDEFINE DEFAULT_ATTACHMENT_HANDLING
      *
      *   By default attachments are stored in folder:
      *      '/tmp/attachments'
      *
      *   You can change the default attachment folder by calling the
      *   following procedure before calling the web service:
      *      Query_spcTE_spcType_setAttachmentFolder()
      *
      *   Default attachment handling was added to demonstrate how
      *   to manage attachments. Please search the generate stub
      *   module for 'TODO:' to see what code belongs to attachment
      *   support.
      *
      *   Log4rpg:
      /UNDEFINE LOGGING_SERVICE
      *
      *======================================================================
      *   Pre-Compiler tags used by STRPREPRC to retrieve creation
      *   commands from the source member.
      * ---------------------------------------------------------------------
      * >>PRE-COMPILER<<
      *   >>CRTCMD<< CRTRPGMOD    MODULE(&LI/&OB) +
      *                           SRCFILE(&SL/&SF) +
      *                           SRCMBR(&SM);
      *   >>COMPILE<<
      *     >>PARM<< TRUNCNBR(*NO);
      *     >>PARM<< DBGVIEW(*LIST);
      *   >>END-COMPILE<<
      *   >>EXECUTE<<
      *   >>CMD<<    CRTSRVPGM +
      *              SRVPGM(&LI/&OB) +
      *              MODULE(&LI/&OB) +
      *              EXPORT(*ALL) +
      *              BNDSRVPGM(*LIBL/WSDL2RPGRT +
      *                        *LIBL/MIME     +
      *                        *LIBL/HTTPMIME +
      *                        *LIBL/BASICS1) +
      *              TEXT('+
      *              Web Service: Mapics_spcTE()+
      *              ') +
      *              DETAIL(*BASIC);
      * >>END-PRE-COMPILER<<
      *======================================================================
     H NOMAIN
     H DEBUG
     H BNDDIR('HTTPAPI': 'QC2LE')
     H OPTION(*SRCSTMT : *NODEBUGIO)
     H EXTBININT(*YES)
      /ENDIF
      *
      * INFO:
      * This is the procedure you call to consume the Web Service:
      * ----------------------------------------------------------
      * Operation: tns:Mapics_spcTE
      * Returns  : tns_Mapics_spcTERpc
      *
      * INFO:
      * Include fields in your test/production programs referring to the *_t
      * type templates used in this prototype, using a LIKE(*_t) or LIKEDS(*_t).
      * These fields will be your request and response messages.
      *
     D Query_spcTE_spcType_Mapics_spcTE...
     D                 PR                  likeds(tns_Mapics_spcTERpc_t)
     D                                     extproc('Query_spcTE_spcType_Mapics_+
     D                                     spcTE')
     D  i__XML_spcString...
     D                             1000A   varying
     D                                     const
     D  i_Error_spcCode...
     D                               10A   varying
     D                                     const
     D  i_Error_spcMessage...
     D                               10A   varying
     D                                     const
     D  i_Object_spcId...
     D                               10A   varying
     D                                     const
     D  i_Process_spcInstance_spcId...
     D                               10A   varying
     D                                     const
     D  i_Siebel_spcOperation_spcObject_spcId...
     D                               10A   varying
     D                                     const
     D  i_SiebelMessage...
     D                                     likeds(xsdLocal0_ListOfAgileUpdate...
     D                                     LovTopElmt_t)
     D                                     const
     D  i_Step_spcName...
     D                               10A   varying
     D                                     const
     D  o_msg                              like(wsdl_errText_t )
      *
      *   Array dimensions:
     D DIM_A1          C                   128
      *
      *   Types:
     D tns__XML_spcString_t...
     D                 S           1000A   varying
     D                                     based(pDummy)
     D tns_Error_spcCode_t...
     D                 S             10A   varying
     D                                     based(pDummy)
     D tns_Error_spcMessage_t...
     D                 S             10A   varying
     D                                     based(pDummy)
      *
     D tns_Mapics_spcTERpc_t...
     D                 DS                  based(pDummy)
     D                                     qualified
     D  #XML_spcString...
     D                             1000A   varying
     D  Error_spcCode                10A   varying
     D  Error_spcMessage...
     D                               10A   varying
     D  Object_spcId                 10A   varying
     D  Process_spcInstance_spcId...
     D                               10A   varying
     D  Siebel_spcOperation_spcObject_spcId...
     D                               10A   varying
     D  SiebelMessage                      likeds(tns_SiebelMessageMvd_t)
     D  Step_spcName                 10A   varying
      *
     D tns_Object_spcId_t...
     D                 S             10A   varying
     D                                     based(pDummy)
     D tns_Process_spcInstance_spcId_t...
     D                 S             10A   varying
     D                                     based(pDummy)
     D tns_Siebel_spcOperation_spcObject_spcId_t...
     D                 S             10A   varying
     D                                     based(pDummy)
      *
     D tns_SiebelMessageMvd_t...
     D                 DS                  based(pDummy)
     D                                     qualified
     D  ListOfAgileUpdateLov...
     D                                     likeds(xsdLocal0_ListOfAgileUpdate...
     D                                     LovRnmd_t)
      *
     D tns_Step_spcName_t...
     D                 S             10A   varying
     D                                     based(pDummy)
      *
     D xsdLocal0_ListOfAgileUpdateLovRnmd_t...
     D                 DS                  based(pDummy)
     D                                     qualified
     D  ListOfValues                       likeds(xsdLocal0_RpgArrayOfListOfV...
     D                                     alues_t)
      *
      *
     D xsdLocal0_ListOfAgileUpdateLovTopElmt_t...
     D                 DS                  based(pDummy)
     D                                     qualified
     D  ListOfAgileUpdateLov...
     D                                     likeds(xsdLocal0_ListOfAgileUpdate...
     D                                     LovRnmd_t)
      *
      *
     D xsdLocal0_ListOfValues_t...
     D                 DS                  based(pDummy)
     D                                     qualified
     D  Active                       10A   varying
     D  Name                         10A   varying
     D  SubType                      10A   varying
     D  Type                         10A   varying
     D  Value                        10A   varying
      *
      *
     D xsdLocal0_RpgArrayOfListOfValues_t...
     D                 DS                  based(pDummy)
     D                                     qualified
     D  x                            10I 0
     D  item                               likeds(xsdLocal0_ListOfValues_t)
     D                                     dim(DIM_A1)
      /IF DEFINED(LOGGING_SERVICE)
      *
      *   Starts the Log4rpg logging service.
     D Query_spcTE_spcType_startLoggingService...
     D                 PR
     D                                     extproc('+
     D                                     Query_spcTE_spcType+
     D                                     _startLoggingService+
     D                                     ')
     D  i_path                             const  like(LOG4RPG_path_t   )
     D                                            options(*nopass)
     D  i_waitMinutes                10I 0 const  options(*nopass)
     D  i_unit                       10A   const  options(*nopass)
      /ENDIF
      *
      *   Web service: Enables/disables the debug log of HTTP API
     D Query_spcTE_spcType_setHttpDebug...
     D                 PR
     D                                     extproc('+
     D                                     Query_spcTE_spcType+
     D                                     _setHttpDebug+
     D                                     ')
     D   i_status                      N   const
     D   i_fileName                 500A   const  varying  options(*nopass)
      *
      *   Web service: Sets the proxy server to use for the connection
     D Query_spcTE_spcType_setProxy...
     D                 PR
     D                                     extproc('+
     D                                     Query_spcTE_spcType+
     D                                     _setProxy+
     D                                     ')
     D  i_server                    256A   const
     D  i_port                       10I 0 const
      *
      *   Web service: Returns the endpoint of the Web service
     D Query_spcTE_spcType_getEndpoint...
     D                 PR         32767A          varying
     D                                     extproc('+
     D                                     Query_spcTE_spcType+
     D                                     _getEndpoint+
     D                                     ')
      *
      *   Web service: Sets the endpoint of the Web service
     D Query_spcTE_spcType_setEndpoint...
     D                 PR
     D                                     extproc('+
     D                                     Query_spcTE_spcType+
     D                                     _setEndpoint+
     D                                     ')
     D  i_url                     32767A   const varying  options(*varsize)
      *
      *   Web service: Returns the host name of the Web Service endpoint
     D Query_spcTE_spcType_getHost...
     D                 PR         32767A          varying
     D                                     extproc('+
     D                                     Query_spcTE_spcType+
     D                                     _getHost+
     D                                     ')
      *
      *   Web service: Sets the host name of the Web service endpoint
     D Query_spcTE_spcType_setHost...
     D                 PR
     D                                     extproc('+
     D                                     Query_spcTE_spcType+
     D                                     _setHost+
     D                                     ')
     D  i_url                     32767A   const varying  options(*varsize)
      *
      *   Web service: Returns the port of the Web Service endpoint
     D Query_spcTE_spcType_getPort...
     D                 PR            10I 0
     D                                     extproc('+
     D                                     Query_spcTE_spcType+
     D                                     _getPort+
     D                                     ')
      *
      *   Web service: Sets the port of the Web service endpoint
     D Query_spcTE_spcType_setPort...
     D                 PR
     D                                     extproc('+
     D                                     Query_spcTE_spcType+
     D                                     _setPort+
     D                                     ')
     D  i_port                       10I 0 const
      *
      *   Registers an user callback procedure, that is called whenever
      *   a web service requires user authentification.
     D Query_spcTE_spcType_registerLoginCallback...
     D                 PR
     D                                     extproc('+
     D                                     Query_spcTE_spcType+
     D                                     _registerLoginCallback+
     D                                     ')
     D  i_pLoginProc                   *   value  procptr
      *
      *   Http: Returns cTrue in case of an error, else cFalse.
     D Query_spcTE_spcType_isError...
     D                 PR              N
     D                                     extproc('+
     D                                     Query_spcTE_spcType+
     D                                     _isError+
     D                                     ')
      *
      *   Http: Returns the last HTTP error (code) that occurred.
     D Query_spcTE_spcType_HttpError_getCode...
     D                 PR                  like(wsdl_http_ErrorNo_t  )
     D                                     extproc('+
     D                                     Query_spcTE_spcType+
     D                                     _HttpError_getCode+
     D                                     ')
      *
      *   Http: Returns the last HTTP error (text) that occurred.
     D Query_spcTE_spcType_HttpError_getText...
     D                 PR                  like(wsdl_http_ErrorText_t)
     D                                     extproc('+
     D                                     Query_spcTE_spcType+
     D                                     _HttpError_getText+
     D                                     ')
      *
      *   Soap: Returns the last SOAP error (code) that occurred.
     D Query_spcTE_spcType_SoapError_getCode...
     D                 PR                  like(wsdl_soap_faultcode_t  )
     D                                     extproc('+
     D                                     Query_spcTE_spcType+
     D                                     _SoapError_getCode+
     D                                     ')
      *
      *   Soap: Returns the last SOAP error (text) that occurred.
     D Query_spcTE_spcType_SoapError_getText...
     D                 PR                  like(wsdl_soap_faultstring_t)
     D                                     extproc('+
     D                                     Query_spcTE_spcType+
     D                                     _SoapError_getText+
     D                                     ')
      *
      *   Soap: Returns the last XML error (code) that occurred.
     D Query_spcTE_spcType_XmlError_getCode...
     D                 PR                  like(wsdl_xml_errorNo_t    )
     D                                     extproc('+
     D                                     Query_spcTE_spcType+
     D                                     _XmlError_getCode+
     D                                     ')
      *
      *   Soap: Returns the last XML error (text) that occurred.
     D Query_spcTE_spcType_XmlError_getText...
     D                 PR                  like(wsdl_xml_ErrorText_t  )
     D                                     extproc('+
     D                                     Query_spcTE_spcType+
     D                                     _XmlError_getText+
     D                                     ')
      *
      *   Returns the file name of the attachment that is associated to
      *   a given content ID.
     D Query_spcTE_spcType_Attachments_get...
     D                 PR                  like(wsdl_path_t     )
     D                                     extproc('+
     D                                     Query_spcTE_spcType+
     D                                     _Attachments_get+
     D                                     ')
     D  i_attachmentID...
     D                                     const  like(wsdl_attachmentID_t )
      *
      *   Returns the file name of the attachment that is associated to
      *   a given index.
     D Query_spcTE_spcType_Attachments_getAtPos...
     D                 PR                  likeds(wsdl_attachment_t )
     D                                     extproc('+
     D                                     Query_spcTE_spcType+
     D                                     _Attachments_getAtPos+
     D                                     ')
     D  i_index                      10I 0 const
      *
      *   Returns the number of attachments that were downloaded with the
      *   last call to the web service.
     D Query_spcTE_spcType_Attachments_getNumE...
     D                 PR            10I 0
     D                                     extproc('+
     D                                     Query_spcTE_spcType+
     D                                     _Attachments_getNumE+
     D                                     ')
      *
      *   Removes all attachments from the list of attachments of this web service.
     D Query_spcTE_spcType_Attachments_removeAll...
     D                 PR
     D                                     extproc('+
     D                                     Query_spcTE_spcType+
     D                                     _Attachments_removeAll+
     D                                     ')
      *
      *   Enables/disables a workaround for Web services that are driven
      *   by Axis and that are affected by the AXIS-2095 bug.
     D Query_spcTE_spcType_enableAxis2095...
     D                 PR
     D                                     extproc('+
     D                                     Query_spcTE_spcType+
     D                                     _enableAxis2095+
     D                                     ')
     D  i_isEnabled                    N   const
      *
      *   User callback to supply login information
      *   Returns WSDL_SUCCESS if successful, WSDL_ERROR upon error.
      *
      *   Parameter description:
      *     i_authType         Authentication type:
      *                          WSDL_AUTH_TYPE_HTTP  - HTTP server.
      *                          WSDL_AUTH_TYPE_PROXY - Proxy server.
      *     i_realm            Authentication realm.
      *     i_numAttempts      Number of login attempts.
      *     o_user             UserName to use.
      *     o_password         Password to use.
      *
     D Query_spcTE_spcType_supplyLoginData...
     D                 PR            10I 0
     D                                     extproc('+
     D                                     Query_spcTE_spcType+
     D                                     _supplyLoginData+
     D                                     ')
     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
      *
      *   Specifies the name of the folder where to put attachments in.
     D Query_spcTE_spcType_setAttachmentFolder...
     D                 PR
     D                                     extproc('+
     D                                     Query_spcTE_spcType+
     D                                     _setAttachmentFolder+
     D                                     ')
     D  i_folder                   1024A   const  varying options(*varsize)
      *
 CPY  /COPY QWSDL2RPG,TYPES_H
      *
      /IF DEFINED(PROTOTYPE_WS0090)
      /EOF
      /ENDIF
      * ---------------------------------------------------------------------
      *
 CPY  /COPY QBASICS1,PBASICS1                      Tools/400 Runtime Library
 CPY  /COPY QMIME,PMIME                            Tools/400 MIME Parser
 CPY  /COPY QMIME,HTTPMIME_H                       Tools/400 MIME Parser to HTTP API adapter
 CPY  /COPY QRPGLESRC,HTTPAPI_H                    HTTP-API Service Program
 CPY  /COPY QWSDL2RPG,PWSDL2R70                    WSDL2RPG: HTTP API Header Extensions
 CPY  /COPY QWSDL2RPG,PWSDL2R71                    WSDL2RPG: HTTP Debug Log
 CPY  /COPY QWSDL2RPG,PWSDL2R86                    WSDL2RPG: Stream
 CPY  /COPY QWSDL2RPG,PWSDL2R87                    WSDL2RPG: ManagedMemoryDataSource
 CPY  /COPY QWSDL2RPG,PWSDL2R89                    WSDL2RPG: List of attachments
 CPY  /COPY QWSDL2RPG,PWSDL2R90                    WSDL2RPG: AppMsg
 CPY  /COPY QWSDL2RPG,PWSDL2R94                    WSDL2RPG: MultiRef
 CPY  /COPY QWSDL2RPG,PWSDL2R97                    WSDL2RPG: eXpat Adapter
 CPY  /COPY QWSDL2RPG,PWSDL2R98                    WSDL2RPG: UnMarshaller/Marshaller
 CPY  /COPY QWSDL2RPG,PWSDL2R42                    WSDL2RPG: User name and password
      *
      /IF DEFINED(LOGGING_SERVICE)
 CPY  /COPY QWSDL2RPG,PLOG4RPG                     Log4rpg: The Log4rpg service program
 CPY  /COPY QWSDL2RPG,PLOG4RPG00                   Log4rpg: The Log4rpg stub module
      /ENDIF
      *
      * ------------------------------------
      *  Internal prototypes
      * ------------------------------------
      *
      *   Reopens a given input stream in order to send it over
      *   the wire again.
     D reOpenInputStream...
     D                 PR                         like(wsdl_hStream_t    )
     D                                     extproc('+
     D                                     reOpenInputStream+
     D                                     ')
     D  i_hDataSource                      const  like(wsdl_hDataSource_t)
     D  i_hInpStream                       value  like(wsdl_hStream_t    )
      *
      *   Login in to proxy server or http server.
     D login...
     D                 PR            10I 0
     D                                     extproc('+
     D                                     login+
     D                                     ')
     D  i_http_err                   10I 0 value
     D  i_numAttempts                10I 0 value
      *
      *   Sets the content type and the SOAP action of the POST message.
     D HTTP_setContentTypeAndSOAPAction...
     D                 PR
     D                                     extproc('+
     D                                     HTTP_setContentTypeAndSOAPAction+
     D                                     ')
     D  o_addlHdrs                 1024A          varying
     D  i_pUserData                    *   value
      *
     D tns_Mapics_spcTERpcStart...
     D                 PR
     D                                     extproc('tns_Mapics_spcTERpcStart')
     D  userdata                       *   value
     D  depth                        10I 0 value
     D  namespace                  1024A   varying const
     D  name                       1024A   varying const
     D  path                      24576A   varying const
     D  attrs                          *   dim(32767)
     D                                     const options(*varsize)
     D tns_Mapics_spcTERpcEnd...
     D                 PR
     D                                     extproc('tns_Mapics_spcTERpcEnd')
     D  userdata                       *   value
     D  depth                        10I 0 value
     D  namespace                  1024A   varying const
     D  name                       1024A   varying const
     D  path                      24576A   varying const
     D  value                     65535A   varying const
     D  attrs                          *   dim(32767)
     D                                     const options(*varsize)
     D tns_SiebelMessageStart...
     D                 PR
     D                                     extproc('tns_SiebelMessageStart')
     D  userdata                       *   value
     D  depth                        10I 0 value
     D  namespace                  1024A   varying const
     D  name                       1024A   varying const
     D  path                      24576A   varying const
     D  attrs                          *   dim(32767)
     D                                     const options(*varsize)
     D tns_SiebelMessageEnd...
     D                 PR
     D                                     extproc('tns_SiebelMessageEnd')
     D  userdata                       *   value
     D  depth                        10I 0 value
     D  namespace                  1024A   varying const
     D  name                       1024A   varying const
     D  path                      24576A   varying const
     D  value                     65535A   varying const
     D  attrs                          *   dim(32767)
     D                                     const options(*varsize)
     D xsdLocal0_ListOfAgileUpdateLovStart...
     D                 PR
     D                                     extproc('xsdLocal0_ListOfAgileUpdate+
     D                                     LovStart')
     D  userdata                       *   value
     D  depth                        10I 0 value
     D  namespace                  1024A   varying const
     D  name                       1024A   varying const
     D  path                      24576A   varying const
     D  attrs                          *   dim(32767)
     D                                     const options(*varsize)
     D xsdLocal0_ListOfAgileUpdateLovEnd...
     D                 PR
     D                                     extproc('xsdLocal0_ListOfAgileUpdate+
     D                                     LovEnd')
     D  userdata                       *   value
     D  depth                        10I 0 value
     D  namespace                  1024A   varying const
     D  name                       1024A   varying const
     D  path                      24576A   varying const
     D  value                     65535A   varying const
     D  attrs                          *   dim(32767)
     D                                     const options(*varsize)
     D xsdLocal0_ListOfValuesStart_of_xsdLocal0_List...
     D OfAgileUpdateLov...
     D                 PR
     D                                     extproc('xsdLocal0_ListOfValuesStart+
     D                                     _of_xsdLocal0_ListOfAgileUpdateLov')
     D  userdata                       *   value
     D  depth                        10I 0 value
     D  namespace                  1024A   varying const
     D  name                       1024A   varying const
     D  path                      24576A   varying const
     D  attrs                          *   dim(32767)
     D                                     const options(*varsize)
     D xsdLocal0_ListOfValuesEnd_of_xsdLocal0_ListOf...
     D AgileUpdateLov...
     D                 PR
     D                                     extproc('xsdLocal0_ListOfValuesEnd_o+
     D                                     f_xsdLocal0_ListOfAgileUpdateLov')
     D  userdata                       *   value
     D  depth                        10I 0 value
     D  namespace                  1024A   varying const
     D  name                       1024A   varying const
     D  path                      24576A   varying const
     D  value                     65535A   varying const
     D  attrs                          *   dim(32767)
     D                                     const options(*varsize)
      *
      *   Receice response of HTTP post operation.
     D HTTP_receiveResponse...
     D                 PR            10I 0 extproc('+
     D                                     HTTP_receiveResponse+
     D                                     ')
     D  i_hStream                    10I 0 value
     D  i_data                         *   value
     D  i_length                     10I 0 value
      *
      *   SOAP message: Envelope
     D SOAPMessage_Envelope...
     D                 PR                  extproc('+
     D                                     SOAPMessage_Envelope+
     D                                     ')
     D   userdata                      *   value
     D   depth                       10I 0 value
     D   namespace                 1024A   varying const
     D   name                      1024A   varying const
     D   path                     24576A   varying const
     D   attrs                         *   dim(32767)
     D                                     const options(*varsize)
      *
      *   SOAP message: fault information
     D SOAPMessage_FaultStart...
     D                 PR                  extproc('+
     D                                     SOAPMessage_FaultStart+
     D                                     ')
     D   userdata                      *   value
     D   depth                       10I 0 value
     D   namespace                 1024A   varying const
     D   name                      1024A   varying const
     D   path                     24576A   varying const
     D   attrs                         *   dim(32767)
     D                                     const options(*varsize)
      *
      *   SOAP message: fault information
     D SOAPMessage_FaultEnd...
     D                 PR                  extproc('+
     D                                     SOAPMessage_FaultEnd+
     D                                     ')
     D   userdata                      *   value
     D   depth                       10I 0 value
     D   namespace                 1024A   varying const
     D   name                      1024A   varying const
     D   path                     24576A   varying const
     D   value                    65535A   varying const
     D   attrs                         *   dim(32767)
     D                                     const options(*varsize)
      *
      *   SOAP message: fault details
     D SOAPMessage_FaultDetailStart...
     D                 PR                  extproc('+
     D                                     SOAPMessage_FaultDetailStart+
     D                                     ')
     D   userdata                      *   value
     D   depth                       10I 0 value
     D   namespace                 1024A   varying const
     D   name                      1024A   varying const
     D   path                     24576A   varying const
     D   attrs                         *   dim(32767)
     D                                     const options(*varsize)
      *
      *   SOAP message: fault details
     D SOAPMessage_FaultDetailEnd...
     D                 PR                  extproc('+
     D                                     SOAPMessage_FaultDetailEnd+
     D                                     ')
     D   userdata                      *   value
     D   depth                       10I 0 value
     D   namespace                 1024A   varying const
     D   name                      1024A   varying const
     D   path                     24576A   varying const
     D   value                    65535A   varying const
     D   attrs                         *   dim(32767)
     D                                     const options(*varsize)
      *
      *   SOAP message: NULL callback procedure
     D SOAPMessage_unexpectedElementStart...
     D                 PR
     D                                     extproc('+
     D                                     SOAPMessage_unexpectedElementStart+
     D                                     ')
     D   userdata                      *   value
     D   depth                       10I 0 value
     D   namespace                 1024A   varying const
     D   name                      1024A   varying const
     D   path                     24576A   varying const
     D   attrs                         *   dim(32767)
     D                                     const options(*varsize)
      *
      *   SOAP message: NULL callback procedure
     D SOAPMessage_unexpectedElementEnd...
     D                 PR
     D                                     extproc('+
     D                                     SOAPMessage_unexpectedElementEnd+
     D                                     ')
     D   userdata                      *   value
     D   depth                       10I 0 value
     D   namespace                 1024A   varying const
     D   name                      1024A   varying const
     D   path                     24576A   varying const
     D   value                    65535A   varying const
     D   attrs                         *   dim(32767)
     D                                     const options(*varsize)
      *
     D ignoreUnexpectedSoapHeader...
     D                 PR              N
     D                                     extproc('+
     D                                     ignoreUnexpectedSoapHeader+
     D                                     ')
      *
      * ------------------------------------
      *  Global fields & constants
      * ------------------------------------
      *
      *   Web service port name
     D cWEB_SERVICE_PORT...
     D                 C                   'Query_spcTE_spcType'
      *
      *   UUID of the web service as generated by WSDL2RPG
     D cSERVICE_UUID   C                   'F3BC88031A09193EB7FC0004AC0EBB59'
      *
      *   SOAP response header
      *
      *   Reference to the 'respSoapHeader' field.
     D g_pRespSoapHeader...
     D                 S               *   inz
      *
      *   XMLSAXParser handle
     D g_hSAXParser    S                   like(xmlSaxParser_handle_t) inz
      *
      *   MIME parser
     D g_hMIMEParser   S                   like(mime_hMime_t ) inz
      *
      *   MIME message indicator
     D g_isMimeMessage...
     D                 S               N   inz(cFalse)
      *
      *   Content ID of the SOAP message part
     D g_SOAPMessageID...
     D                 S            512A   varying inz
      *
      *   Indicator "parse SOAP message"
     D g_doParseSOAPMessage...
     D                 S               N   inz(cFalse)
      *
      *   Indicator "SOAP message parsed"
     D g_SOAPMessage_done...
     D                 S               N   inz(cFalse)
      *
      *   Body part counter
     D g_BodyPart_counter...
     D                 S             10I 0 inz
      *
      *   Default and current attachment folder
     D cATTACHMENT_FOLDER...
     D                 C                   '/tmp/attachments/'
      *
     D g_attachmentFolder...
     D                 S           1024A   varying inz(cATTACHMENT_FOLDER)
      *
      *   HTTP response "initialized" indicator
     D g_HTTP_isInit...
     D                 S               N   inz(cFalse)
      *
      *   POST data CCSID (1208 = UTF-8)
     D g_post_ccsid...
     D                 S             10I 0 inz(1208)
      *
      *   HTTP debug log settings
     D g_httpDebug     DS                  qualified
     D  status                         N   inz
     D  fileName                    500A   inz varying
      *
      *   Proxy server to use
     D g_proxy         DS                  qualified
     D  server                      256A   inz
     D  port                         10I 0 inz
      *
      *   Web service endpoint
     D g_url           S          32767A   varying inz(cURL)
      *
      *   Switch for AXIS bug AXIS-2095
     D g_isAXIS_2095   S               N   inz(cFalse)
      *
      *   Error information
     D g_errors        DS                  likeds(wsdl_errors_t    ) inz
      *
      *   User callback to supply login information
      *   Returns WSDL_SUCCESS if successful, WSDL_ERROR upon error.
     D g_getLoginData  S               *   procptr inz
      *
    R *getLoginData...
    R *                PR            10I 0
    R *                                    extproc(g_getLoginData)
    R * i_authType                   14A          const  varying
    R * i_realm                     126A          const  varying
    R * i_numAttempts                10I 0        const
    R * o_user                       50A                 varying
    R * o_password                   50A                 varying
      *
      *   Web service endpoint as specified in the WSDL file.
     D cURL            C                   'http://sbluatweb01.ad.agi/eai_enu/s+
     D                                     tart.swe?SWEExtSource=WebService&SWE+
     D                                     ExtCmd=Execute&UserName=SADMIN&Passw+
     D                                     ord=S@DM1N'
      *
      * -------------------------------------------
      *  TODO: Added to implement default
      *        attachment handling.
      * -------------------------------------------
      /IF DEFINED(DEFAULT_ATTACHMENT_HANDLING)
 CPY  /COPY QWSDL2RPG,CLIB                         C Runtime Library
      *
      *  User data scoped to the current part
     D partUserData_t...
     D                 DS                  qualified               based(pDummy)
     D  FD                           10i 0
      *
      /ENDIF
      * =====================================================================
      * Operation: tns:Mapics_spcTE
      * Returns  : tns_Mapics_spcTERpc
      * =====================================================================
     P Query_spcTE_spcType_Mapics_spcTE...
     P                 B                   export
     D Query_spcTE_spcType_Mapics_spcTE...
     D                 PI                  likeds(tns_Mapics_spcTERpc_t)
     D  i__XML_spcString...
     D                             1000A   varying
     D                                     const
     D  i_Error_spcCode...
     D                               10A   varying
     D                                     const
     D  i_Error_spcMessage...
     D                               10A   varying
     D                                     const
     D  i_Object_spcId...
     D                               10A   varying
     D                                     const
     D  i_Process_spcInstance_spcId...
     D                               10A   varying
     D                                     const
     D  i_Siebel_spcOperation_spcObject_spcId...
     D                               10A   varying
     D                                     const
     D  i_SiebelMessage...
     D                                     likeds(xsdLocal0_ListOfAgileUpdate...
     D                                     LovTopElmt_t)
     D                                     const
     D  i_Step_spcName...
     D                               10A   varying
     D                                     const
     D  o_msg                       128A   varying
      *
      *  Return value
     D rtnValue        DS                  likeds(tns_Mapics_spcTERpc_t)
     D                                     inz
      *
      *  Local fields
     D isUnexpectedError...
     D                 S               N   inz(cFalse)
     D isRedirect      S               N   inz(cFalse)
     D request         S          65535A   varying inz
     D url             S                   like(g_url) inz
     D rc              S             10I 0 inz
     D rcvm0200        DS                  likeds(rcvm0200_t ) inz
     D msg             DS                  likeds(msg_t      ) inz
     D headers         DS                  likeds(headers_t  ) inz
      *
     D hDataSource     S                   like(wsdl_hDataSource_t   ) inz
     D hOutStream      S                   like(wsdl_hStream_t       ) inz
     D hSAXParser      S                   like(xmlSaxParser_handle_t) inz
     D hMIMEParser     S                   like(mime_hMime_t         ) inz
     D hInpStream      S                   like(wsdl_hStream_t       ) inz
     D contentType     S                   like(wsdl_contentType_t   ) inz
      *
      *  Login helper fields
     D err             S             10I 0 inz
     D lastErr         S             10I 0 inz(-1)
     D numAttempts     S             10I 0 inz
      *
      *  Array iterator fields
     D X_A1            S             10I 0 inz
      *
     D curListOfValues_A1...
     D                 DS                  likeds(xsdLocal0_ListOfValues_t)
     D                                     inz
      *
     D userData        DS                  likeds(tns_Mapics_spcTERpc_t)
     D                                     inz
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         o_msg = '';

         monitor;

            // Initialize map to manage <multiRef> elements
            MultiRef_new();

            // Remove all attachments of this service from the list of attachments
            Attachments_removeAll(Attachments_theInstance(): cSERVICE_UUID);

            // Enable/disable HTTP debug log
 B01        if (g_httpDebug.status = *ON);
 B02           if (g_httpDebug.fileName <> '');
                  http_debug(*ON: g_httpDebug.fileName);
 X02           else;
                  http_debug(*ON);
 E02           endif;
 X01        else;
               http_debug(*OFF);
 E01        endif;

            // Set proxy server to use
 B01        if (g_proxy.server <> '');
               http_setproxy(g_proxy.server: g_proxy.port);
 X01        else;
               http_setproxy('': 0);
 E01        endif;

            // Set CCSID for POST data according
            // to the encoding of the SOAP envelope
            HTTP_SetCCSIDs(g_post_ccsid: HTTP_EBCDIC);

            // Create and open data source to store the request message
            hDataSource = ManagedMemoryDataSource_new();

            contentType = 'text/xml; charset=utf-8';
            hOutStream = ManagedMemoryDataSource_OutputStream_open(
                               hDataSource: contentType: g_post_ccsid);

            // Produce SOAP request message
            request =
               '<?xml version="1.0" encoding="utf-8"?>'                     +
               '<soap:Envelope xmlns:soap="'                                +
               'http://schemas.xmlsoap.org/soap/envelope/"; xmlns:xsi="'     +
            'http://www.w3.org/2001/XMLSchema-instance";'                    +
            ' xmlns:xsd="http://www.w3.org/2001/XMLSchema";>'                +
            '<soap:Body>' +
            '<Mapics_spcTE xmlns="http://siebel.com/asi/";>' +
            '<Process_spcInstance_spcId xmlns="" />'      +
            '<Step_spcName xmlns="" />' +
            '<_XML_spcString xmlns="" />' +
            '<Object_spcId xmlns="" />' +
            '<Siebel_spcOperation_spcObject_spcId xmlns="" />' +
            '<SiebelMessage xmlns="">' +
            '<ListOfAgileUpdateLov xmlns=' +
            '"http://www.siebel.com/xml/BT%20Agile%20Update%20LOV";>' +
            '<ListOfValues>' +
            '<Type />' +
            '<Name />' +
            '<Value />' +
            '<SubType />' +
            '<Active />' +
            '</ListOfValues>' +
            '</ListOfAgileUpdateLov>' +
            '</SiebelMessage>' +
            '<Error_spcCode xmlns="" />' +
            '<Error_spcMessage xmlns="" />' +
            '</Mapics_spcTE>' +
            '</soap:Body>' +
            '</soap:Envelope>';

            //request =
            //   '<?xml version="1.0" encoding="UTF-8"?>'                   +
            //   '<soapenv:Envelope'                                        +
           //   ' xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";'+
           // ' xmlns:tns="http://siebel.com/asi/";' +
          //  ' xmlns:xsdLocal0="http://www.siebel.com/xml/BT%20Agile%20Upd+
          //  ate%20LOV"' +
           // ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";' +
           //    '>'                                                        +
           //    '<soapenv:Body>'                                           +
           // '';

         if (%len(request) > 0);
            // Add previous bytes of request message to output stream
            ManagedMemoryDataSource_OutputStream_write(hOutStream: %addr(requ...
            est) + 2: %len(request));
            clear request;
         endif;

         //request = request +
         //'<tns:Mapics_spcTE' +
         //      ' soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/e+
         //      ncoding/"' +
         //'>' +
         //'<_XML_spcString>' +
         //Marshaller_toString(
         //   i__XML_spcString
         //   ) +
         //'</_XML_spcString>' +
         //'<Error_spcCode>' +
         //Marshaller_toString(
         //   i_Error_spcCode
         //   ) +
         //'</Error_spcCode>' +
         //'<Error_spcMessage>' +
         //Marshaller_toString(
         //   i_Error_spcMessage
         //   ) +
         //'</Error_spcMessage>' +
         //'<Object_spcId>' +
         //Marshaller_toString(
         //   i_Object_spcId
         //   ) +
         //'</Object_spcId>' +
         //'<Process_spcInstance_spcId>' +
         //Marshaller_toString(
         //   i_Process_spcInstance_spcId
         //   ) +
         //'</Process_spcInstance_spcId>' +
         //'<Siebel_spcOperation_spcObject_spcId>' +
         //Marshaller_toString(
         //   i_Siebel_spcOperation_spcObject_spcId
         //   ) +
         //'</Siebel_spcOperation_spcObject_spcId>' +
         //'<SiebelMessage' +
         //      ' xsi:type="xsdLocal0:ListOfAgileUpdateLovTopElmt"' +
         //'>' +
         //'<xsdLocal0:ListOfAgileUpdateLov' +
         //      ' xsi:type="xsdLocal0:ListOfAgileUpdateLov"' +
         //'>' +
         //   '';

         //if (%len(request) > 0);
            // Add previous bytes of request message to output stream
         // ManagedMemoryDataSource_OutputStream_write(hOutStream: %addr(requ...
         // est) + 2: %len(request));
         // clear request;
         //endif;

        //for X_A1 = 1 to i_SiebelMessage.ListOfAgileUpdateLov.ListOfValu...
        //               es.x;
        //  curListOfValues_A1 =
        //     i_SiebelMessage.ListOfAgileUpdateLov.ListOfValues.item(X_A1);

         // request = request +
         // '<xsdLocal0:ListOfValues' +
         //    ' xsi:type="xsdLocal0:ListOfValues"' +
         // '>' +
         // '<xsdLocal0:Type>' +
         // Marshaller_toString(
         //    curListOfValues_A1.Type
         //    ) +
         // '</xsdLocal0:Type>' +
         // '<xsdLocal0:Name>' +
         // Marshaller_toString(
         //    curListOfValues_A1.Name
         //    ) +
         // '</xsdLocal0:Name>' +
         // '<xsdLocal0:Value>' +
         // Marshaller_toString(
         //    curListOfValues_A1.Value
         //    ) +
         // '</xsdLocal0:Value>' +
         // '<xsdLocal0:SubType>' +
         // Marshaller_toString(
         //    curListOfValues_A1.SubType
         //    ) +
         // '</xsdLocal0:SubType>' +
         // '<xsdLocal0:Active>' +
         // Marshaller_toString(
         //    curListOfValues_A1.Active
         //    ) +
         // '</xsdLocal0:Active>' +
         // '</xsdLocal0:ListOfValues>' +
         //    '';

         // if (%len(request) > 0);
         //    // Add previous bytes of request message to output stream
         //    ManagedMemoryDataSource_OutputStream_write(hOutStream: %addr(
         //    request) + 2: %len(request));
         //    clear request;
         // endif;
         //endfor;

         //request = request +
         //'</xsdLocal0:ListOfAgileUpdateLov>' +
         //'</SiebelMessage>' +
         //'<Step_spcName>' +
         //Marshaller_toString(
         //   i_Step_spcName
         //   ) +
         //'</Step_spcName>' +
         //'</tns:Mapics_spcTE>' +
         //    '</soapenv:Body>'                                            +
         //    '</soapenv:Envelope>';

            // Add remaining bytes of request message to output stream
 B01     // if (%len(request) > 0);
         //    ManagedMemoryDataSource_OutputStream_write(
         //          hOutStream: %addr(request) + 2: %len(request));
 E01     // endif;

            // Close output stream and finish the request message
            ManagedMemoryDataSource_OutputStream_close(hOutStream);

            // Open input stream
            hInpStream = ManagedMemoryDataSource_InputStream_open(hDataSource);

            // Clear error code
            clear g_errors;
            g_errors.errType = WSDL_HTTP_SUCCESS;

            // HTTPAPI: Enables additional headers
            http_xproc(HTTP_POINT_ADDL_HEADER
                       : %paddr('HTTP_setContentTypeAndSOAPAction')
                       : %addr(headers));

            headers.contentType =
                  ManagedMemoryDataSource_getContentType(hDataSource);
            headers.soapAction  = '"rpc/http://siebel.com/asi/:Mapics_spcTE";'
                                  ;

            // ---------------------------------------
            //   Post request and parse response
            // ---------------------------------------

            // Create parser (callbacks style: HTTP API)
            XMLSAXParser_new(hSAXParser: cTrue);
            XMLSAXParser_setDoNamespaces(hSAXParser: cTrue);
            XMLSAXParser_registerCallback(hSAXParser
               : cXML_CB_SAX_STARTELEMENT
               : %paddr('SOAPMessage_Envelope'));
            XMLSAXParser_prepareParse(hSAXParser: %addr(userData));

            // Create MIME parser in case we need it
            hMIMEParser = MIMEParser_new();
            MIMEParser_setDecodeData(hMIMEParser: cTrue);
            http_mime_DataSink_initialize(hMIMEParser
                                          : *NULL
                                          : %paddr('HTTPDataSink_startPart')
                                          : %paddr('HTTPDataSink_bodyData')
                                          : %paddr('HTTPDataSink_endPart'));

            // Make parser available for HTTP_receiveResponse()
            g_hSAXParser    = hSAXParser;
            g_hMIMEParser   = hMIMEParser;
            g_isMimeMessage = cFalse;
            g_HTTP_isInit   = cFalse;
            g_SOAPMessageID = '';
            g_doParseSOAPMessage = cFalse;
            g_SOAPMessage_done   = cFalse;
            g_BodyPart_counter   = 0;

            // Make SOAP response header available to SOAPMessage_Envelope
            g_pRespSoapHeader = *NULL;

            // eXpat: Post request and parse response
            url = g_url;
 B01        dou (err <> HTTP_NDAUTH and err <> HTTP_PXNDAUTH);
               // Get document from server and handle http redirects
               //   301 Moved Permanently
               //   302 Found
               //   303 See Other
               //   307 Temporary Redirect
 B02           dou (not isRedirect);
                  rc = http_url_post_raw2(
                     url
                     : hInpStream
                     : %paddr(
                          'WSDL2R87_ManagedMemoryDataSource_InputStream_read')
                     : ManagedMemoryDataSource_getSize(hDataSource)
                     : 0
                     : %paddr('HTTP_receiveResponse')
                     : HTTP_TIMEOUT
                     : HTTP_USERAGENT
                     : '');
 B03              if (rc = 301 or rc = 302 or rc = 303 or rc = 307);
                     url = http_redir_loc();
                     // Reopen data stream
                     hInpStream = reOpenInputStream(hDataSource: hInpStream);
                     isRedirect = cTrue;
 X03              else;
                     isRedirect = cFalse;
 E03              endif;
 E02           enddo;

               // The first time we request a document that requires user/password
               // it will return a HTTP_NDAUTH error.
 B02           if (rc <> 1);
                  http_error(err);
 B03              if (err = HTTP_NDAUTH or err = HTTP_PXNDAUTH);
 B04                 if (g_getLoginData = *NULL);
                        leave;
 E04                 endif;

 B04                 if (err <> lastErr);
                        lastErr = err;
                        numAttempts = 0;
 E04                 endif;
                     numAttempts = numAttempts + 1;

 B04                 if (login(err: numAttempts) <> 1);
                        leave;
 E04                 endif;

                     // Reopen data stream
                     hInpStream = reOpenInputStream(hDataSource: hInpStream);
 E03              endif;
 X02           else;
                  MultiRef_finalize();
                  err = 0;
 E02           endif;
 E01        enddo;

            // Preserve parser error code and message text
 B01        if (err = HTTP_RDWERR);
               g_errors.xmlError.code = XMLToolkit_getError(
                                              hSAXParser
                                              : g_errors.xmlError.text
                                              : g_errors.xmlError.line
                                              : g_errors.xmlError.column);
 E01        endif;

            XMLSAXParser_endParse(hSAXParser);

 B01        if (g_isMimeMessage);
               MIMEParser_endParse(hMIMEParser);
               g_isMimeMessage = cFalse;
 E01        endif;

            g_HTTP_isInit = cFalse;

         on-error;
            isUnexpectedError = cTrue;
            rcvm0200 = f_rcvPgmMsg(cMsg_Any: *: cMsg_Act_Same: 0
                                   : cMsg_Same: cMsg_ToMyself);
            http_DebugLog_appendRcvMsg(rcvm0200);
            msg = f_cvtRcvMsgToMsg(rcvm0200);
            g_errors.errType        = WSDL_HTTP_ERROR_UNEXPECTED;
            g_errors.httpError.no   = WSDL_HTTP_ERROR_UNEXPECTED;
            g_errors.httpError.text = f_rtvMsgText(msg);
            rc    = g_errors.httpError.no;
            o_msg = g_errors.httpError.text;
         endmon;

         g_hSAXParser  = *NULL;
         g_hMIMEParser = *NULL;

 B01     if (not isUnexpectedError);
 B02        if (err <> 0);
               g_errors.errType = WSDL_HTTP_ERROR;

               // Set http error code and message text
               g_errors.httpError.no   = err;
               g_errors.httpError.text = http_error();

               // Return error message text to caller
 B03           if (g_errors.httpError.text <> '');
                  o_msg = g_errors.httpError.text;
 X03           else;
                  o_msg = Query_spcTE_spcType_SoapError_getText();
 E03           endif;
               clear rtnValue;
            else;
               o_msg = '';
               rtnValue = userData;
            endif;
 E02     endif;

 B02     if (not XMLSAXParser_isNull(hSAXParser));
            XMLSAXParser_delete(hSAXParser);
 E02     endif;

 B02     if (not MIMEParser_isNull(hMIMEParser));
            MIMEParser_delete(hMIMEParser);
 E02     endif;

 B02     if (not ManagedMemoryDataSource_isNull(hDataSource));
 B03        if (ManagedMemoryDataSource_Stream_isOpen(hInpStream));
               ManagedMemoryDataSource_InputStream_close(hInpStream);
 E03        endif;
 B03        if (ManagedMemoryDataSource_Stream_isOpen(hOutStream));
               ManagedMemoryDataSource_OutputStream_close(hOutStream);
 E03        endif;
            ManagedMemoryDataSource_delete(hDataSource);
 E02     endif;

 B02     if (not MultiRef_isNull());
            MultiRef_delete();
 E02     endif;

 B02     if (http_DebugLog_isOpen());
            http_DebugLog_close();
 E02     endif;

         return rtnValue;

      /end-free
      *
     P Query_spcTE_spcType_Mapics_spcTE...
     P                 E
      *
      *
      * ==================================================================
      * Return value: tns:Mapics_spcTERpc
      * ==================================================================
     P tns_Mapics_spcTERpcStart...
     P                 B
     D tns_Mapics_spcTERpcStart...
     D                 PI
     D  userdata                       *   value
     D  depth                        10I 0 value
     D  namespace                  1024A   varying const
     D  name                       1024A   varying const
     D  path                      24576A   varying const
     D  attrs                          *   dim(32767)
     D                                     const options(*varsize)
      *
      *
     D currentItem     DS                  likeds(tns_Mapics_spcTERpc_t)
     D                                     based(pCurrentItem)
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         // Get access to current item
         pCurrentItem = userdata;

         select;
         when (depth = 1
                and
                name = 'Mapics_spcTERpc');
            if (MultiRef_isReference(attrs));
               MultiRef_put(
                  attrs
                  : XMLSAXParser_getUserData()
                  : depth
                  : namespace
                  : name
                  : path
                  : XMLSAXParser_getStartCallback()
                  : XMLSAXParser_getEndCallback()
                  : *omit
                  : %addr(currentItem)
                  : %size(currentItem)
                  );
            endif;
            return;

         when (depth = 2
                and
                name = 'Error_spcCode');
            // Value is retrieved in corresponding END procedure
            if (MultiRef_isReference(attrs));
               MultiRef_put(
                  attrs
                  : XMLSAXParser_getUserData()
                  : depth
                  : namespace
                  : name
                  : path
                  : XMLSAXParser_getStartCallback()
                  : XMLSAXParser_getEndCallback()
                  : *omit
                  : %addr(currentItem.Error_spcCode)
                  : %size(currentItem.Error_spcCode)
                  );
            endif;
            return;

         when (depth = 2
                and
                name = 'Error_spcMessage');
            // Value is retrieved in corresponding END procedure
            if (MultiRef_isReference(attrs));
               MultiRef_put(
                  attrs
                  : XMLSAXParser_getUserData()
                  : depth
                  : namespace
                  : name
                  : path
                  : XMLSAXParser_getStartCallback()
                  : XMLSAXParser_getEndCallback()
                  : *omit
                  : %addr(currentItem.Error_spcMessage)
                  : %size(currentItem.Error_spcMessage)
                  );
            endif;
            return;

         when (depth = 2
                and
                name = '_XML_spcString');
            // Value is retrieved in corresponding END procedure
            if (MultiRef_isReference(attrs));
               MultiRef_put(
                  attrs
                  : XMLSAXParser_getUserData()
                  : depth
                  : namespace
                  : name
                  : path
                  : XMLSAXParser_getStartCallback()
                  : XMLSAXParser_getEndCallback()
                  : *omit
                  : %addr(currentItem.#XML_spcString)
                  : %size(currentItem.#XML_spcString)
                  );
            endif;
            return;

         when (depth = 2
                and
                name = 'Object_spcId');
            // Value is retrieved in corresponding END procedure
            if (MultiRef_isReference(attrs));
               MultiRef_put(
                  attrs
                  : XMLSAXParser_getUserData()
                  : depth
                  : namespace
                  : name
                  : path
                  : XMLSAXParser_getStartCallback()
                  : XMLSAXParser_getEndCallback()
                  : *omit
                  : %addr(currentItem.Object_spcId)
                  : %size(currentItem.Object_spcId)
                  );
            endif;
            return;

         when (depth = 2
                and
                name = 'Process_spcInstance_spcId');
            // Value is retrieved in corresponding END procedure
            if (MultiRef_isReference(attrs));
               MultiRef_put(
                  attrs
                  : XMLSAXParser_getUserData()
                  : depth
                  : namespace
                  : name
                  : path
                  : XMLSAXParser_getStartCallback()
                  : XMLSAXParser_getEndCallback()
                  : *omit
                  : %addr(currentItem.Process_spcInstance_spcId)
                  : %size(currentItem.Process_spcInstance_spcId)
                  );
            endif;
            return;

         when (depth = 2
                and
                name = 'Siebel_spcOperation_spcObject_spcId');
            // Value is retrieved in corresponding END procedure
            if (MultiRef_isReference(attrs));
               MultiRef_put(
                  attrs
                  : XMLSAXParser_getUserData()
                  : depth
                  : namespace
                  : name
                  : path
                  : XMLSAXParser_getStartCallback()
                  : XMLSAXParser_getEndCallback()
                  : *omit
                  : %addr(currentItem.Siebel_spcOperation_spcObject_spcId)
                  : %size(currentItem.Siebel_spcOperation_spcObject_spcId)
                  );
            endif;
            return;

         when (depth = 2
                and
                name = 'SiebelMessage'
                and
                namespace = '');
            XMLSAXParser_delegateElementProcessing(
               %addr(currentItem.SiebelMessage)
               : %paddr('tns_SiebelMessageStart')
               : %paddr('tns_SiebelMessageEnd')
               );
            return;

         when (depth = 2
                and
                name = 'Step_spcName');
            // Value is retrieved in corresponding END procedure
            if (MultiRef_isReference(attrs));
               MultiRef_put(
                  attrs
                  : XMLSAXParser_getUserData()
                  : depth
                  : namespace
                  : name
                  : path
                  : XMLSAXParser_getStartCallback()
                  : XMLSAXParser_getEndCallback()
                  : *omit
                  : %addr(currentItem.Step_spcName)
                  : %size(currentItem.Step_spcName)
                  );
            endif;
            return;

         endsl;

         return;

      /end-free
      *
     P tns_Mapics_spcTERpcStart...
     P                 E
      *
      * ==================================================================
      * Return value: tns:Mapics_spcTERpc
      * ==================================================================
     P tns_Mapics_spcTERpcEnd...
     P                 B
     D tns_Mapics_spcTERpcEnd...
     D                 PI
     D  userdata                       *   value
     D  depth                        10I 0 value
     D  namespace                  1024A   varying const
     D  name                       1024A   varying const
     D  path                      24576A   varying const
     D  value                     65535A   varying const
     D  attrs                          *   dim(32767)
     D                                     const options(*varsize)
      *
      *
     D currentItem     DS                  likeds(tns_Mapics_spcTERpc_t)
     D                                     based(pCurrentItem)
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         // Get access to current item
         pCurrentItem = userdata;

         select;
         when (depth = 2
                and
                name = 'Error_spcCode');
            if (not Value_isNil(attrs));
               currentItem.Error_spcCode = UnMarshaller_toString(value);
            endif;

         when (depth = 2
                and
                name = 'Error_spcMessage');
            if (not Value_isNil(attrs));
               currentItem.Error_spcMessage = UnMarshaller_toString(value);
            endif;

         when (depth = 2
                and
                name = '_XML_spcString');
            if (not Value_isNil(attrs));
               currentItem.#XML_spcString = UnMarshaller_toString(value);
            endif;

         when (depth = 2
                and
                name = 'Object_spcId');
            if (not Value_isNil(attrs));
               currentItem.Object_spcId = UnMarshaller_toString(value);
            endif;

         when (depth = 2
                and
                name = 'Process_spcInstance_spcId');
            if (not Value_isNil(attrs));
               currentItem.Process_spcInstance_spcId =
                  UnMarshaller_toString(value);
            endif;

         when (depth = 2
                and
                name = 'Siebel_spcOperation_spcObject_spcId');
            if (not Value_isNil(attrs));
               currentItem.Siebel_spcOperation_spcObject_spcId =
                  UnMarshaller_toString(value);
            endif;

         when (depth = 2
                and
                name = 'Step_spcName');
            if (not Value_isNil(attrs));
               currentItem.Step_spcName = UnMarshaller_toString(value);
            endif;

         endsl;

         return;

      /end-free
      *
     P tns_Mapics_spcTERpcEnd...
     P                 E
      *
      * ==================================================================
      * Return value: tns:SiebelMessage
      * ==================================================================
     P tns_SiebelMessageStart...
     P                 B
     D tns_SiebelMessageStart...
     D                 PI
     D  userdata                       *   value
     D  depth                        10I 0 value
     D  namespace                  1024A   varying const
     D  name                       1024A   varying const
     D  path                      24576A   varying const
     D  attrs                          *   dim(32767)
     D                                     const options(*varsize)
      *
      *
     D currentItem     DS                  likeds(tns_SiebelMessageMvd_t)
     D                                     based(pCurrentItem)
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         // Get access to current item
         pCurrentItem = userdata;

         select;
         when (depth = 1
                and
                name = 'SiebelMessage'
                and
                namespace = '');
            if (MultiRef_isReference(attrs));
               MultiRef_put(
                  attrs
                  : XMLSAXParser_getUserData()
                  : depth
                  : namespace
                  : name
                  : path
                  : XMLSAXParser_getStartCallback()
                  : XMLSAXParser_getEndCallback()
                  : *omit
                  : %addr(currentItem)
                  : %size(currentItem)
                  );
            endif;
            return;

         when (depth = 2
                and
                name = 'ListOfAgileUpdateLov'
                and
                namespace = '');
            XMLSAXParser_delegateElementProcessing(
               %addr(currentItem.ListOfAgileUpdateLov)
               : %paddr('xsdLocal0_ListOfAgileUpdateLovStart')
               : %paddr('xsdLocal0_ListOfAgileUpdateLovEnd')
               );
            return;

         endsl;

         return;

      /end-free
      *
     P tns_SiebelMessageStart...
     P                 E
      *
      * ==================================================================
      * Return value: tns:SiebelMessage
      * ==================================================================
     P tns_SiebelMessageEnd...
     P                 B
     D tns_SiebelMessageEnd...
     D                 PI
     D  userdata                       *   value
     D  depth                        10I 0 value
     D  namespace                  1024A   varying const
     D  name                       1024A   varying const
     D  path                      24576A   varying const
     D  value                     65535A   varying const
     D  attrs                          *   dim(32767)
     D                                     const options(*varsize)
      *
      *
     D currentItem     DS                  likeds(tns_SiebelMessageMvd_t)
     D                                     based(pCurrentItem)
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         // Get access to current item
         pCurrentItem = userdata;

         select;
         endsl;

         return;

      /end-free
      *
     P tns_SiebelMessageEnd...
     P                 E
      *
      * ==================================================================
      * Return value: xsdLocal0:ListOfAgileUpdateLov
      * ==================================================================
     P xsdLocal0_ListOfAgileUpdateLovStart...
     P                 B
     D xsdLocal0_ListOfAgileUpdateLovStart...
     D                 PI
     D  userdata                       *   value
     D  depth                        10I 0 value
     D  namespace                  1024A   varying const
     D  name                       1024A   varying const
     D  path                      24576A   varying const
     D  attrs                          *   dim(32767)
     D                                     const options(*varsize)
      *
      *
     D currentItem     DS                  likeds(xsdLocal0_ListOfAgileUpdate...
     D                                     LovRnmd_t)
     D                                     based(pCurrentItem)
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         // Get access to current item
         pCurrentItem = userdata;

         select;
         when (depth = 1
                and
                name = 'ListOfAgileUpdateLov'
                and
                namespace = '');
            if (MultiRef_isReference(attrs));
               MultiRef_put(
                  attrs
                  : XMLSAXParser_getUserData()
                  : depth
                  : namespace
                  : name
                  : path
                  : XMLSAXParser_getStartCallback()
                  : XMLSAXParser_getEndCallback()
                  : *omit
                  : %addr(currentItem)
                  : %size(currentItem)
                  );
            endif;
            return;

         when (depth = 2
                and
                name = 'ListOfValues'
                and
                namespace = '');
            XMLSAXParser_delegateElementProcessing(
               %addr(currentItem.ListOfValues)
               : %paddr('xsdLocal0_ListOfValuesStart_of_xsdLocal0_ListOfAgileUp+
               dateLov')
               : %paddr('xsdLocal0_ListOfValuesEnd_of_xsdLocal0_ListOfAgileUpda+
               teLov')
               );
            return;

         endsl;

         return;

      /end-free
      *
     P xsdLocal0_ListOfAgileUpdateLovStart...
     P                 E
      *
      * ==================================================================
      * Return value: xsdLocal0:ListOfAgileUpdateLov
      * ==================================================================
     P xsdLocal0_ListOfAgileUpdateLovEnd...
     P                 B
     D xsdLocal0_ListOfAgileUpdateLovEnd...
     D                 PI
     D  userdata                       *   value
     D  depth                        10I 0 value
     D  namespace                  1024A   varying const
     D  name                       1024A   varying const
     D  path                      24576A   varying const
     D  value                     65535A   varying const
     D  attrs                          *   dim(32767)
     D                                     const options(*varsize)
      *
      *
     D currentItem     DS                  likeds(xsdLocal0_ListOfAgileUpdate...
     D                                     LovRnmd_t)
     D                                     based(pCurrentItem)
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         // Get access to current item
         pCurrentItem = userdata;

         select;
         endsl;

         return;

      /end-free
      *
     P xsdLocal0_ListOfAgileUpdateLovEnd...
     P                 E
      *
      * ==================================================================
      * Return value: xsdLocal0:ListOfValues
      * ==================================================================
     P xsdLocal0_ListOfValuesStart_of_xsdLocal0_List...
     P OfAgileUpdateLov...
     P                 B
     D xsdLocal0_ListOfValuesStart_of_xsdLocal0_List...
     D OfAgileUpdateLov...
     D                 PI
     D  userdata                       *   value
     D  depth                        10I 0 value
     D  namespace                  1024A   varying const
     D  name                       1024A   varying const
     D  path                      24576A   varying const
     D  attrs                          *   dim(32767)
     D                                     const options(*varsize)
      *
     D x               S             10I 0 inz
      *
     D xsdLocal0_ListOfValues...
     D                 DS                  likeds(xsdLocal0_RpgArrayOfListOfV...
     D                                     alues_t)
     D                                     based(userdata)
      *
     D currentItem     DS                  likeds(xsdLocal0_ListOfValues_t)
     D                                     based(pCurrentItem)
      *
     D emptyItem       DS                  likeds(xsdLocal0_ListOfValues_t)
     D                                     inz
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         // Get access to current array item
         if (MultiRef_doCaptureData() and MultiRef_hasItemIndex());
            x = MultiRef_getItemIndex();
         else;
            if (depth = 1);
               xsdLocal0_ListOfValues.x = xsdLocal0_ListOfValues.x + 1;
            endif;
            x = xsdLocal0_ListOfValues.x;
         endif;

         pCurrentItem = %addr(xsdLocal0_ListOfValues.item(x));

         select;
         when (depth = 1
                and
                name = 'ListOfValues'
                and
                namespace = '');
            if (MultiRef_isReference(attrs));
               MultiRef_put(
                  attrs
                  : XMLSAXParser_getUserData()
                  : depth
                  : namespace
                  : name
                  : path
                  : XMLSAXParser_getStartCallback()
                  : XMLSAXParser_getEndCallback()
                  : x
                  : %addr(currentItem)
                  : %size(currentItem)
                  );
            endif;
            return;

         when (depth = 2
                and
                name = 'Type'
                and
                namespace = '');
            // Value is retrieved in corresponding END procedure
            if (MultiRef_isReference(attrs));
               MultiRef_put(
                  attrs
                  : XMLSAXParser_getUserData()
                  : depth
                  : namespace
                  : name
                  : path
                  : XMLSAXParser_getStartCallback()
                  : XMLSAXParser_getEndCallback()
                  : x
                  : %addr(currentItem.Type)
                  : %size(currentItem.Type)
                  );
            endif;
            return;

         when (depth = 2
                and
                name = 'Name'
                and
                namespace = '');
            // Value is retrieved in corresponding END procedure
            if (MultiRef_isReference(attrs));
               MultiRef_put(
                  attrs
                  : XMLSAXParser_getUserData()
                  : depth
                  : namespace
                  : name
                  : path
                  : XMLSAXParser_getStartCallback()
                  : XMLSAXParser_getEndCallback()
                  : x
                  : %addr(currentItem.Name)
                  : %size(currentItem.Name)
                  );
            endif;
            return;

         when (depth = 2
                and
                name = 'Value'
                and
                namespace = '');
            // Value is retrieved in corresponding END procedure
            if (MultiRef_isReference(attrs));
               MultiRef_put(
                  attrs
                  : XMLSAXParser_getUserData()
                  : depth
                  : namespace
                  : name
                  : path
                  : XMLSAXParser_getStartCallback()
                  : XMLSAXParser_getEndCallback()
                  : x
                  : %addr(currentItem.Value)
                  : %size(currentItem.Value)
                  );
            endif;
            return;

         when (depth = 2
                and
                name = 'SubType'
                and
                namespace = '');
            // Value is retrieved in corresponding END procedure
            if (MultiRef_isReference(attrs));
               MultiRef_put(
                  attrs
                  : XMLSAXParser_getUserData()
                  : depth
                  : namespace
                  : name
                  : path
                  : XMLSAXParser_getStartCallback()
                  : XMLSAXParser_getEndCallback()
                  : x
                  : %addr(currentItem.SubType)
                  : %size(currentItem.SubType)
                  );
            endif;
            return;

         when (depth = 2
                and
                name = 'Active'
                and
                namespace = '');
            // Value is retrieved in corresponding END procedure
            if (MultiRef_isReference(attrs));
               MultiRef_put(
                  attrs
                  : XMLSAXParser_getUserData()
                  : depth
                  : namespace
                  : name
                  : path
                  : XMLSAXParser_getStartCallback()
                  : XMLSAXParser_getEndCallback()
                  : x
                  : %addr(currentItem.Active)
                  : %size(currentItem.Active)
                  );
            endif;
            return;

         endsl;

         return;

      /end-free
      *
     P xsdLocal0_ListOfValuesStart_of_xsdLocal0_List...
     P OfAgileUpdateLov...
     P                 E
      *
      * ==================================================================
      * Return value: xsdLocal0:ListOfValues
      * ==================================================================
     P xsdLocal0_ListOfValuesEnd_of_xsdLocal0_ListOf...
     P AgileUpdateLov...
     P                 B
     D xsdLocal0_ListOfValuesEnd_of_xsdLocal0_ListOf...
     D AgileUpdateLov...
     D                 PI
     D  userdata                       *   value
     D  depth                        10I 0 value
     D  namespace                  1024A   varying const
     D  name                       1024A   varying const
     D  path                      24576A   varying const
     D  value                     65535A   varying const
     D  attrs                          *   dim(32767)
     D                                     const options(*varsize)
      *
     D x               S             10I 0 inz
      *
     D xsdLocal0_ListOfValues...
     D                 DS                  likeds(xsdLocal0_RpgArrayOfListOfV...
     D                                     alues_t)
     D                                     based(userdata)
      *
     D currentItem     DS                  likeds(xsdLocal0_ListOfValues_t)
     D                                     based(pCurrentItem)
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         // Get access to current array item
         if (MultiRef_doCaptureData() and MultiRef_hasItemIndex());
            x = MultiRef_getItemIndex();
         else;
            x = xsdLocal0_ListOfValues.x;
         endif;

         pCurrentItem = %addr(xsdLocal0_ListOfValues.item(x));

         select;
         when (depth = 2
                and
                name = 'Type'
                and
                namespace = '');
            if (not Value_isNil(attrs));
               currentItem.Type = UnMarshaller_toString(value);
            endif;

         when (depth = 2
                and
                name = 'Name'
                and
                namespace = '');
            if (not Value_isNil(attrs));
               currentItem.Name = UnMarshaller_toString(value);
            endif;

         when (depth = 2
                and
                name = 'Value'
                and
                namespace = '');
            if (not Value_isNil(attrs));
               currentItem.Value = UnMarshaller_toString(value);
            endif;

         when (depth = 2
                and
                name = 'SubType'
                and
                namespace = '');
            if (not Value_isNil(attrs));
               currentItem.SubType = UnMarshaller_toString(value);
            endif;

         when (depth = 2
                and
                name = 'Active'
                and
                namespace = '');
            if (not Value_isNil(attrs));
               currentItem.Active = UnMarshaller_toString(value);
            endif;

         endsl;

         return;

      /end-free
      *
     P xsdLocal0_ListOfValuesEnd_of_xsdLocal0_ListOf...
     P AgileUpdateLov...
     P                 E
      *
      * =====================================================================
      *   Reopens a given input stream in order to send it over
      *   the wire again.
      * =====================================================================
     P reOpenInputStream...
 ERR P                 B
      *
     D reOpenInputStream...
     D                 PI                         like(wsdl_hStream_t    )
     D  i_hDataSource                      const  like(wsdl_hDataSource_t)
     D  i_hInpStream                       value  like(wsdl_hStream_t    )
      *
      *  Return value
     D hInpStream      S                   like(wsdl_hStream_t       ) inz
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         ManagedMemoryDataSource_InputStream_close(i_hInpStream);
         hInpStream =
               ManagedMemoryDataSource_InputStream_open(i_hDataSource);

         return hInpStream;

      /end-free
      *
     P reOpenInputStream...
     P                 E
      *
      * =====================================================================
      *   Login in to proxy server or http server.
      * =====================================================================
     P login...
     P                 B
      *
     D login...
     D                 PI            10I 0
     D  i_http_err                   10I 0 value
     D  i_numAttempts                10I 0 value
      *
      *  Return value
     D rc              S             10I 0 inz
      *
      *  Helper fields
     D basic           S               N   inz
     D digest          S               N   inz
     D realm           S            124A   inz
     D authType        S             14A   inz varying
     D userid          S             50A   inz varying
     D password        S             50A   inz varying
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         if (i_http_err = HTTP_NDAUTH);
            http_getauth(basic: digest: realm);
            authType = WSDL_AUTH_TYPE_HTTP;
         else;
            http_proxy_getauth(basic: realm);
            authType = WSDL_AUTH_TYPE_PROXY;
         endif;

         rc = getLoginData(authType: realm
                           : i_numAttempts: userid: password);
         if (rc <> 1);
            userid = '';
            password = '';
            return rc;
         endif;

         if (i_http_err = HTTP_NDAUTH);
            if (digest);
               http_setAuth(HTTP_AUTH_MD5_DIGEST
                            : userid: password);
            else;
               http_setAuth(HTTP_AUTH_BASIC
                            : userid: password);
            endif;
         else;
            if (digest);
               http_proxy_setAuth(HTTP_AUTH_MD5_DIGEST
                                  : userid: password);
            else;
               http_proxy_setAuth(HTTP_AUTH_BASIC
                                  : userid: password);
            endif;
         endif;

         userid = '';
         password = '';

         return rc;

      /end-free
      *
     P login...
     P                 E
      *
      * =====================================================================
      *   Sets the content type and the SOAP action of the POST message.
      * =====================================================================
     P HTTP_setContentTypeAndSOAPAction...
     P                 B
      *
     D HTTP_setContentTypeAndSOAPAction...
     D                 PI
     D  o_addlHdrs                 1024A          varying
     D  i_pUserData                    *   value
      *
      *  User Data
     D headers         DS                  likeds(headers_t) based(i_pUserData)
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         o_addlHdrs = cHTTP_HEADER_CONTENT_TYPE + ': ' +
                      headers.contentType + cEBCDIC_CRLF +
                      cHTTP_HEADER_SOAP_ACTION + ': ' +
                      headers.soapAction + cEBCDIC_CRLF;

      /end-free
      *
     P HTTP_setContentTypeAndSOAPAction...
     P                 E
      *
      * =====================================================================
      *   Receice response of HTTP post operation.
      * =====================================================================
     P HTTP_receiveResponse...
     P                 B
      *
     D HTTP_receiveResponse...
     D                 PI            10I 0
     D  i_hStream                    10I 0 value
     D  i_data                         *   value
     D  i_length                     10I 0 value
      *
     D contentType     S           1024A   inz
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         if (not g_HTTP_isInit);
            select;
            when (http_getContentType() = 'text');
               if (http_getContentSubType() = 'html');
                  if (f_exist('WSDL2RPG': '*LIBL': '*MSGF'));
                     clear USR0030;
                     USR00301 = cWEB_SERVICE_PORT;
                     AppMsg_sendCancelMsg(AppMsg_newError('USR0030': USR0030));
                  else;
                     AppMsg_sendCancelMsg(
                        f_newMsg('CPF9898'
                              : 'Unexpected HTML data received from web service'
                              : '*ESCAPE'
                              : 'QCPFMSG'));
                  endif;
               endif;
            when (http_getContentType() = 'multipart');
               contentType = %trim(http_header('content-type'));
               MIMEParser_beginParse(g_hMIMEParser);
               MIMEParser_setContentType(g_hMIMEParser: contentType);
               g_SOAPMessageID = http_getContentTypeAttr('start': cTrue);
               g_isMimeMessage = cTrue;
            endsl;
            g_HTTP_isInit = cTrue;
         endif;

         if (g_isMimeMessage);
            if (MIMEParser_parse(g_hMIMEParser: i_data: i_length) = cTrue);
               return i_length;
            else;
               return -1;
            endif;
         else;
            if (XMLSAXParser_parse(g_hSAXParser: i_data: i_length) = cTrue);
               return i_length;
            else;
               return -1;
               // return i_length;
            endif;
         endif;

      /end-free
      *
     P HTTP_receiveResponse...
     P                 E
      *
      * =====================================================================
      *   Starts a MIME body part.
      *   This procedure is called whenever a new part is started.
      * =====================================================================
      *   Parameters:
      *     i_pPart            Handle of the current part.
      *     i_pUserData        Pointer to user data as specified at
      *                        http_mime_DataSink_initialize().
      * =====================================================================
     P HTTPDataSink_startPart...
     P                 B
      *
     D HTTPDataSink_startPart...
     D                 PI
     D  i_pPart                        *   const
     D  i_pUserData                    *   const
      *
     D contentID       S            512A   varying inz
     D contentSubType  S             16A   varying inz
      *
      * -------------------------------------------
      *  TODO: Add fields to open
      *        the file and to store the
      *        file descriptor.
      * -------------------------------------------
      /IF DEFINED(DEFAULT_ATTACHMENT_HANDLING)
     D contentType     S             10I 0 inz
     D fileName        S           1024A   varying inz
     D fileExt         S             10A   varying inz
      *
     D partUserData    DS                  likeds(partUserData_t )
     D                                     based(pPartUserData)
      /ENDIF
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         if (http_mime_Part_getType(i_pPart) <> cMIME_BASICPART);
            return;
         endif;

         g_BodyPart_counter = g_BodyPart_counter + 1;

         contentID      = http_mime_Part_getContentID(i_pPart);
         contentSubType = http_mime_Part_getContentSubType(i_pPart);

         if (not g_SOAPMessage_done);
            if (g_SOAPMessageID <> '');
               if (contentSubType = 'xml' and contentID = g_SOAPMessageID);
                  g_doParseSOAPMessage = cTrue;
                  return;
               endif;
            else;
               if (g_BodyPart_counter = 1);
                  g_doParseSOAPMessage = cTrue;
                  return;
               endif;
            endif;
         endif;

         // -----------------------------------------
         // TODO:
         // Add your code to handle attachments here|
         // E.g.: Open output file.
         // -----------------------------------------
      /IF DEFINED(DEFAULT_ATTACHMENT_HANDLING)

         // Ignore all attachments that are not a BasicPart
         if (http_mime_Part_getType(i_pPart) <> cMIME_BASICPART);
            return;
         endif;

         fileName       = http_mime_Part_getFileName(i_pPart);
         contentID      = http_mime_Part_getContentID(i_pPart);
         contentType    = http_mime_Part_getContentType(i_pPart);
         contentSubType = http_mime_Part_getContentSubType(i_pPart);

         if (contentType = cMIME_TYPE_TEXT);
            fileExt = 'txt';
         else;
            fileExt = contentSubType;
         endif;

         fileName = g_attachmentFolder +
                    %char(%timestamp()) + '_' + contentID + '_' +
                    fileName  + '.' + fileExt;
         fileName = %xlate(':<>': '___': fileName);

         // Assign filename to content-ID and put it into the list of attachments
         Attachments_put(Attachments_theInstance()
                         : cSERVICE_UUID
                         : contentID
                         : fileName);

         // Produce the user data of that Part to
         // store the file descriptor of the open file.
         pPartUserData = %alloc(%size(partUserData_t));
         clear partUserData;

         partUserData.FD = open(fileName
                                : O_CREAT + O_EXCL +
                                  O_SHARE_RDONLY + O_WRONLY + O_CCSID
                                : S_IRWXU + S_IRWXG + S_IRWXO
                                : 819);   // CCSID does not matter because
                                          // we write binary data

         // Set user data of the current Part.
         http_mime_Part_setUserData(i_pPart: pPartUserData);
      /ENDIF

         return;

      /end-free
      *
     P HTTPDataSink_startPart...
     P                 E
      *
      * =====================================================================
      *   Receices MIME part body data.
      *   This procedure is called whenever new body data is available.
      * =====================================================================
      *   Parameters:
      *     i_pPart            Handle of the current part.
      *     i_pUserData        Pointer to user data as specified at
      *                        http_mime_DataSink_initialize().
      *     i_data             Pointer to decoded body data.
      *     i_size             Size of decoded body data.
      * =====================================================================
     P HTTPDataSink_bodyData...
     P                 B
      *
     D HTTPDataSink_bodyData...
     D                 PI
     D  i_pPart                        *   const
     D  i_pUserData                    *   const
     D  i_data                         *   const
     D  i_size                       10I 0 const
      *
      * -------------------------------------------
      *  TODO: Add fields to write
      *        the attachment to the file
      *        opened in HTTPDataSink_startPart().
      * -------------------------------------------
      /IF DEFINED(DEFAULT_ATTACHMENT_HANDLING)
     D rc              S             10I 0 inz
      *
     D partUserData    DS                  likeds(partUserData_t )
     D                                     based(pPartUserData)
      /ENDIF
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         if (g_doParseSOAPMessage);
            XMLSAXParser_parse(g_hSAXParser: i_data: i_size);
            return;
         endif;

         // -----------------------------------------
         // TODO:
         // Add your code to handle attachments here|
         // E.g.: Write received data to output file.
         // -----------------------------------------

      /IF DEFINED(DEFAULT_ATTACHMENT_HANDLING)
         // Gain access to the user data of the current Part.
         pPartUserData = http_mime_Part_getUserData(i_pPart);
         if (pPartUserData = *NULL);
            return;
         endif;

         // Return to caller if no file is open.
         if (partUserData.FD <= 0);
            return;
         endif;

         // Append attachment data to the file.
         rc = write(partUserData.FD: i_data: i_size);
      /ENDIF

         return;

      /end-free
      *
     P HTTPDataSink_bodyData...
     P                 E
      *
      * =====================================================================
      *   Ends a MIME body part.
      *   This procedure is called whenever a new part ends.
      * =====================================================================
      *   Parameters:
      *     i_pPart            Handle of the current part.
      *     i_pUserData        Pointer to user data as specified at
      *                        http_mime_DataSink_initialize().
      * =====================================================================
     P HTTPDataSink_endPart...
     P                 B
      *
     D HTTPDataSink_endPart...
     D                 PI
     D  i_pPart                        *   const
     D  i_pUserData                    *   const
      *
      * -------------------------------------------
      *  TODO: Add fields to close the file
      *        opened in HTTPDataSink_startPart().
      * -------------------------------------------
      /IF DEFINED(DEFAULT_ATTACHMENT_HANDLING)
     D rc              S             10I 0 inz
      *
     D partUserData    DS                  likeds(partUserData_t )
     D                                     based(pPartUserData)
      /ENDIF
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         if (http_mime_Part_getType(i_pPart) <> cMIME_BASICPART);
            return;
         endif;

         if (g_doParseSOAPMessage);
            g_doParseSOAPMessage = cFalse;
            g_SOAPMessage_done   = cTrue;
            return;
         endif;

         // -----------------------------------------
         // TODO:
         // Add your code to handle attachments here|
         // E.g.: Close output file.
         // -----------------------------------------
      /IF DEFINED(DEFAULT_ATTACHMENT_HANDLING)

         // Gain access to the user data of the current Part.
         pPartUserData = http_mime_Part_getUserData(i_pPart);
         if (pPartUserData = *NULL);
            return;
         endif;

         // Return to caller if no file is open.
         if (partUserData.FD <= 0);
            return;
         endif;

         // Close the file.
         callp close(partUserData.FD);
         partUserData.FD = 0;

         // Free memory allocated in HTTPDataSink_startPart()
         dealloc(N) pPartUserData;
      /ENDIF

         return;

      /end-free
      *
     P HTTPDataSink_endPart...
     P                 E
      *
      * =====================================================================
      *   SOAP message: Envelope
      * =====================================================================
     P SOAPMessage_Envelope...
     P                 B
      *
     D SOAPMessage_Envelope...
     D                 PI
     D   userdata                      *   value
     D   depth                       10I 0 value
     D   namespace                 1024A   varying const
     D   name                      1024A   varying const
     D   path                     24576A   varying const
     D   attrs                         *   dim(32767)
     D                                     const options(*varsize)
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         if (depth = 1 and f_lcase(name) = 'html');
            if (f_exist('WSDL2RPG': '*LIBL': '*MSGF'));
               clear USR0030;
               USR00301 = cWEB_SERVICE_PORT;
               AppMsg_sendCancelMsg(AppMsg_newError('USR0030': USR0030));
            else;
               AppMsg_sendCancelMsg(
                     f_newMsg('CPF9898'
                              : 'Unexpected HTML data received from web service'
                              : '*ESCAPE'
                              : 'QCPFMSG'));
            endif;
         endif;

         select;
         when (path = '/Envelope/Header');
            XMLSAXParser_delegateElementProcessing(
               g_pRespSoapHeader
               : %paddr('SOAPMessage_unexpectedElementStart')
               : %paddr('SOAPMessage_unexpectedElementEnd'));
           return;

         when (path = '/Envelope/Body');

            select;
            when (name = 'Fault');
               XMLSAXParser_delegateElementProcessing(
                  %addr(g_errors.soapFault)
                  : %paddr('SOAPMessage_FaultStart')
                  : %paddr('SOAPMessage_FaultEnd'));
              return;

            when (MultiRef_isData(attrs));
               XMLSAXParser_delegateElementProcessing(
                  *NULL
                  : MultiRef_getStartCallback()
                  : MultiRef_getEndCallback());
               return;

            other;
               XMLSAXParser_delegateElementProcessing(
                  userdata
                  : %paddr('tns_Mapics_spcTERpcStart')
                  : %paddr('tns_Mapics_spcTERpcEnd'));
              return;
            endsl;

         endsl;

         return;

      /end-free
      *
     P SOAPMessage_Envelope...
     P                 E
      *
      * =====================================================================
      *   SOAP message: fault information
      * =====================================================================
     P SOAPMessage_FaultStart...
     P                 B
      *
     D SOAPMessage_FaultStart...
     D                 PI
     D   userdata                      *   value
     D   depth                       10I 0 value
     D   namespace                 1024A   varying const
     D   name                      1024A   varying const
     D   path                     24576A   varying const
     D   attrs                         *   dim(32767)
     D                                     const options(*varsize)
      *
     D fault...
     D                 DS                  based(userdata)
     D                                     likeds(wsdl_soapFault_t )
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         if (depth = 1);
            return;
         endif;

         select;
         when (name = 'detail');
            XMLSAXParser_delegateElementProcessing(
               %addr(fault.detail)
               : %paddr('SOAPMessage_FaultDetailStart')
               : %paddr('SOAPMessage_FaultDetailEnd'));
         endsl;

      /end-free
      *
     P SOAPMessage_FaultStart...
     P                 E
      *
      * =====================================================================
      *   SOAP message: fault information
      * =====================================================================
     P SOAPMessage_FaultEnd...
     P                 B
      *
     D SOAPMessage_FaultEnd...
     D                 PI
     D   userdata                      *   value
     D   depth                       10I 0 value
     D   namespace                 1024A   varying const
     D   name                      1024A   varying const
     D   path                     24576A   varying const
     D   value                    65535A   varying const
     D   attrs                         *   dim(32767)
     D                                     const options(*varsize)
      *
     D fault...
     D                 DS                  based(userdata)
     D                                     likeds(wsdl_soapFault_t )
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         if (depth = 1);
            return;
         endif;

         select;
         when (name = 'faultcode');
            fault.code = value;
         when (name = 'faultstring');
            fault.string = value;
         endsl;

      /end-free
      *
     P SOAPMessage_FaultEnd...
     P                 E
      *
      * =====================================================================
      *   SOAP message: fault details
      * =====================================================================
     P SOAPMessage_FaultDetailStart...
     P                 B
      *
     D SOAPMessage_FaultDetailStart...
     D                 PI
     D   userdata                      *   value
     D   depth                       10I 0 value
     D   namespace                 1024A   varying const
     D   name                      1024A   varying const
     D   path                     24576A   varying const
     D   attrs                         *   dim(32767)
     D                                     const options(*varsize)
      *
     D detail...
     D                 DS                  based(userdata)
     D                                     likeds(wsdl_soap_faultDetail_t)
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         if (depth = 1);
            return;
         endif;

         select;
         endsl;

      /end-free
      *
     P SOAPMessage_FaultDetailStart...
     P                 E
      *
      * =====================================================================
      *   SOAP message: fault details
      * =====================================================================
     P SOAPMessage_FaultDetailEnd...
     P                 B
      *
     D SOAPMessage_FaultDetailEnd...
     D                 PI
     D   userdata                      *   value
     D   depth                       10I 0 value
     D   namespace                 1024A   varying const
     D   name                      1024A   varying const
     D   path                     24576A   varying const
     D   value                    65535A   varying const
     D   attrs                         *   dim(32767)
     D                                     const options(*varsize)
      *
     D detail...
     D                 DS                  based(userdata)
     D                                     likeds(wsdl_soap_faultDetail_t)
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         if (depth = 1);
            return;
         endif;

         select;
         when (name = 'hostname');
            detail.hostname = value;
         endsl;

      /end-free
      *
     P SOAPMessage_FaultDetailEnd...
     P                 E
      *
      * =====================================================================
      *   SOAP message: NULL callback procedure
      * =====================================================================
     P SOAPMessage_unexpectedElementStart...
     P                 B
      *
     D SOAPMessage_unexpectedElementStart...
     D                 PI
     D   userdata                      *   value
     D   depth                       10I 0 value
     D   namespace                 1024A   varying const
     D   name                      1024A   varying const
     D   path                     24576A   varying const
     D   attrs                         *   dim(32767)
     D                                     const options(*varsize)
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         if (ignoreUnexpectedSoapHeader());
            http_DebugLog_appendText(
               'Warning: Received unexpected Soap header: <' + name + '>');
            return;
         endif;

         if (f_exist('WSDL2RPG': '*LIBL': '*MSGF'));
            clear USR0042;
            USR00421 = 'SOAPMessage_unexpectedElementStart';
            USR00422 = 'SOAPMessage_unexpectedElementEnd';
            AppMsg_sendCancelMsg(AppMsg_newError('USR0042': USR0042));
         else;
            AppMsg_sendCancelMsg(
               f_newMsg('CPF9898'
                     : 'Unexpected Soap element received from web service.'
                     : '*ESCAPE'
                     : 'QCPFMSG'));
         endif;

         return;

      /end-free
      *
     P SOAPMessage_unexpectedElementStart...
     P                 E
      *
      * =====================================================================
      *   SOAP message: NULL callback procedure
      * =====================================================================
     P SOAPMessage_unexpectedElementEnd...
     P                 B
      *
     D SOAPMessage_unexpectedElementEnd...
     D                 PI
     D   userdata                      *   value
     D   depth                       10I 0 value
     D   namespace                 1024A   varying const
     D   name                      1024A   varying const
     D   path                     24576A   varying const
     D   value                    65535A   varying const
     D   attrs                         *   dim(32767)
     D                                     const options(*varsize)
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         if (ignoreUnexpectedSoapHeader());
            http_DebugLog_appendText(
               'Warning: Received unexpected Soap header: ' + value);
            http_DebugLog_appendText(
               'Warning: Received unexpected Soap header: </' + name + '>');
            return;
         endif;

         if (f_exist('WSDL2RPG': '*LIBL': '*MSGF'));
            clear USR0042;
            USR00421 = 'SOAPMessage_unexpectedElementStart';
            USR00422 = 'SOAPMessage_unexpectedElementEnd';
            AppMsg_sendCancelMsg(AppMsg_newError('USR0042': USR0042));
         else;
            AppMsg_sendCancelMsg(
               f_newMsg('CPF9898'
                     : 'Unexpected Soap element received from web service.'
                     : '*ESCAPE'
                     : 'QCPFMSG'));
         endif;

         return;

      /end-free
      *
     P SOAPMessage_unexpectedElementEnd...
     P                 E
      *
      * =====================================================================
      *   Specifies, whether unexpected Soap headers are ignored or not.
      * =====================================================================
     P ignoreUnexpectedSoapHeader...
     P                 B
      *
     D ignoreUnexpectedSoapHeader...
     D                 PI              N
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         return cFalse;

      /end-free
      *
     P ignoreUnexpectedSoapHeader...
     P                 E
      *
      * =====================================================================
      *   Registers an user callback procedure, that is called whenever
      *   a web service requires user authentification.
      * =====================================================================
     P Query_spcTE_spcType_registerLoginCallback...
     P                 B                   export
      *
     D Query_spcTE_spcType_registerLoginCallback...
     D                 PI
  D  D  i_pLoginProc                   *   value  procptr
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         g_getLoginData = i_pLoginProc;

         return;

      /end-free
      *
     P Query_spcTE_spcType_registerLoginCallback...
     P                 E
      *
      * =====================================================================
      *   Http: Returns the last HTTP error (code) that occurred.
      * =====================================================================
     P Query_spcTE_spcType_isError...
     P                 B                   export
      *
     D Query_spcTE_spcType_isError...
     D                 PI              N
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         if (g_errors.errType = WSDL_HTTP_SUCCESS);
            return cFalse;
         else;
            return cTrue;
         endif;

      /end-free
      *
     P Query_spcTE_spcType_isError...
     P                 E
      *
      * =====================================================================
      *   Http: Returns the last HTTP error (code) that occurred.
      * =====================================================================
     P Query_spcTE_spcType_HttpError_getCode...
     P                 B                   export
      *
     D Query_spcTE_spcType_HttpError_getCode...
     D                 PI                  like(wsdl_http_ErrorNo_t  )
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         return g_errors.httpError.no;

      /end-free
      *
     P Query_spcTE_spcType_HttpError_getCode...
     P                 E
      *
      * =====================================================================
      *   Http: Returns the last HTTP error (text) that occurred.
      * =====================================================================
     P Query_spcTE_spcType_HttpError_getText...
     P                 B                   export
      *
     D Query_spcTE_spcType_HttpError_getText...
     D                 PI                  like(wsdl_http_ErrorText_t)
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         return g_errors.httpError.text;

      /end-free
      *
     P Query_spcTE_spcType_HttpError_getText...
     P                 E
      *
      * =====================================================================
      *   Soap: Returns the last SOAP error (code) that occurred.
      * =====================================================================
     P Query_spcTE_spcType_SoapError_getCode...
     P                 B                   export
      *
     D Query_spcTE_spcType_SoapError_getCode...
     D                 PI                  like(wsdl_soap_faultcode_t  )
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         return g_errors.soapFault.code;

      /end-free
      *
     P Query_spcTE_spcType_SoapError_getCode...
     P                 E
      *
      * =====================================================================
      *   Soap: Returns the last SOAP error (text) that occurred.
      * =====================================================================
     P Query_spcTE_spcType_SoapError_getText...
     P                 B                   export
      *
     D Query_spcTE_spcType_SoapError_getText...
     D                 PI                  like(wsdl_soap_faultstring_t)
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         return g_errors.soapFault.string;

      /end-free
      *
     P Query_spcTE_spcType_SoapError_getText...
     P                 E
      *
      * =====================================================================
      *   XML: Returns the last XML error (code) that occurred.
      * =====================================================================
     P Query_spcTE_spcType_XmlError_getCode...
     P                 B                   export
      *
     D Query_spcTE_spcType_XmlError_getCode...
     D                 PI                  like(wsdl_xml_ErrorNo_t    )
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         return g_errors.xmlError.code;

      /end-free
      *
     P Query_spcTE_spcType_XmlError_getCode...
     P                 E
      *
      * =====================================================================
      *   XML: Returns the last XML error (text) that occurred.
      * =====================================================================
     P Query_spcTE_spcType_XmlError_getText...
     P                 B                   export
      *
     D Query_spcTE_spcType_XmlError_getText...
     D                 PI                  like(wsdl_xml_ErrorText_t  )
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         return g_errors.xmlError.text;

      /end-free
      *
     P Query_spcTE_spcType_XmlError_getText...
     P                 E
      *
      * =====================================================================
      *   Returns the file name of the attachment that is associated to
      *   a given content ID.
      * =====================================================================
     P Query_spcTE_spcType_Attachments_get...
     P                 B                   export
      *
     D Query_spcTE_spcType_Attachments_get...
     D                 PI                  like(wsdl_path_t     )
     D  i_attachmentID...
     D                                     const  like(wsdl_attachmentID_t )
      *
     D fileName        S                   like(wsdl_path_t     ) inz
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         fileName = Attachments_get(Attachments_theInstance()
                                    : cSERVICE_UUID
                                    : i_attachmentID);
         return fileName;

      /end-free
      *
     P Query_spcTE_spcType_Attachments_get...
     P                 E
      *
      * =====================================================================
      *   Returns the file name of the attachment that is associated to
      *   a given index.
      * =====================================================================
     P Query_spcTE_spcType_Attachments_getAtPos...
     P                 B                   export
      *
     D Query_spcTE_spcType_Attachments_getAtPos...
     D                 PI                  likeds(wsdl_attachment_t )
     D  i_index                      10I 0 const
      *
     D attachment      DS                  likeds(wsdl_attachment_t ) inz
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         attachment = Attachments_getAtPos(Attachments_theInstance()
                                           : cSERVICE_UUID
                                           : i_index);
         return attachment;

      /end-free
      *
     P Query_spcTE_spcType_Attachments_getAtPos...
     P                 E
      *
      * =====================================================================
      *   Returns the number of attachments that were downloaded with
      *   the last call of the web service.
      * =====================================================================
     P Query_spcTE_spcType_Attachments_getNumE...
     P                 B                   export
      *
     D Query_spcTE_spcType_Attachments_getNumE...
     D                 PI            10I 0
      *
     D numE            S             10I 0 inz
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         numE = Attachments_getNumAttachments(Attachments_theInstance()
                                              : cSERVICE_UUID);
         return numE;

      /end-free
      *
     P Query_spcTE_spcType_Attachments_getNumE...
     P                 E
      *
      * =====================================================================
      *   Removes all attachments from the list of attachments of
      *   this web service.
      * =====================================================================
     P Query_spcTE_spcType_Attachments_removeAll...
     P                 B                   export
      *
     D Query_spcTE_spcType_Attachments_removeAll...
     D                 PI
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         Attachments_removeAll(Attachments_theInstance()
                               : cSERVICE_UUID);
         return;

      /end-free
      *
     P Query_spcTE_spcType_Attachments_removeAll...
     P                 E
      *
      * =====================================================================
    R *   *** private/experimental ***
      *   Enables/disables a workaround for Web services that are driven
      *   by Axis and that are affected by the AXIS-2095 bug.
      *   Export this procedure if you really need it.
      * =====================================================================
     P Query_spcTE_spcType_enableAxis2095...
     P                 B
      *
     D Query_spcTE_spcType_enableAxis2095...
     D                 PI
     D  i_isEnabled                    N   const
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         deprecated();

         g_isAXIS_2095 = i_isEnabled;

         return;

      /end-free
      *
     P Query_spcTE_spcType_enableAxis2095...
     P                 E
      *
      * =====================================================================
      *   Specifies the name of the folder where to put attachments in.
      * =====================================================================
     P Query_spcTE_spcType_setAttachmentFolder...
     P                 B                   export
      *
     D Query_spcTE_spcType_setAttachmentFolder...
     D                 PI
     D  i_folder                   1024A   const  varying options(*varsize)
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         g_attachmentFolder = i_folder;

         g_attachmentFolder = %trimR(%xlate('?': '/': g_attachmentFolder));
         if (not f_endsWith('/': g_attachmentFolder));
            g_attachmentFolder = g_attachmentFolder + '/';
         endif;

         return;

      /end-free
      *
     P Query_spcTE_spcType_setAttachmentFolder...
     P                 E
      /IF DEFINED(LOGGING_SERVICE)
      *
      * =====================================================================
      *   Starts the Log4rpg logging service.
      * =====================================================================
     P Query_spcTE_spcType_startLoggingService...
     P                 B                   export
      *
     D Query_spcTE_spcType_startLoggingService...
     D                 PI
     D  i_path                             const  like(LOG4RPG_path_t   )
     D                                            options(*nopass)
     D  i_waitMinutes                10I 0 const  options(*nopass)
     D  i_unit                       10A   const  options(*nopass)
      *
      *  Parameter positions
     D p_path          C                   1
     D p_waitMinutes   C                   2
     D p_unit          C                   3
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         LoggerStub_loadSrvPgm();

         select;
         when (%parms() >= p_unit);
            Configurator_loadAndWatchPropertiesConfiguration(
                                                i_path: i_waitMinutes: i_unit);
         when (%parms() >= p_waitMinutes);
            Configurator_loadAndWatchPropertiesConfiguration(
                                                i_path: i_waitMinutes);
         when (%parms() >= p_path);
            Configurator_loadPropertiesConfiguration(i_path);
         other;
            Configurator_loadDefaultConfiguration();
         endsl;

         return;

      /end-free
      *
     P Query_spcTE_spcType_startLoggingService...
     P                 E
      /ENDIF
      *
      * =====================================================================
      *   Web service: Enables/disables the debug log of HTTP API
      * =====================================================================
     P Query_spcTE_spcType_setHttpDebug...
     P                 B                   export
      *
     D Query_spcTE_spcType_setHttpDebug...
     D                 PI
     D   i_status                      N   const
     D   i_fileName                 500A   const  varying  options(*nopass)
      *
      *  Parameter positions
     D p_fileName      C                   2
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         g_httpDebug.status = i_status;

         if (%parms() >= p_fileName);
            g_httpDebug.fileName = i_fileName;
         else;
            g_httpDebug.fileName = HTTP_API_DEFAULT_LOG_FILE;
         endif;

         if (i_status);
            http_DebugLog_open(g_httpDebug.fileName);
         else;
            http_DebugLog_close();
         endif;

         return;

      /end-free
      *
     P Query_spcTE_spcType_setHttpDebug...
     P                 E
      *
      * =====================================================================
      *   Web service: Sets the proxy server to use for the connection
      * =====================================================================
     P Query_spcTE_spcType_setProxy...
     P                 B                   export
      *
     D Query_spcTE_spcType_setProxy...
     D                 PI
     D  i_server                    256A   const
     D  i_port                       10I 0 const
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         g_proxy.server = i_server;
         g_proxy.port   = i_port;

         return;

      /end-free
      *
     P Query_spcTE_spcType_setProxy...
     P                 E
      *
      * =====================================================================
      *   Web service: Returns the endpoint of the Web service
      * =====================================================================
     P Query_spcTE_spcType_getEndpoint...
     P                 B                   export
      *
     D Query_spcTE_spcType_getEndpoint...
     D                 PI         32767A          varying
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         return g_url;

      /end-free
      *
     P Query_spcTE_spcType_getEndpoint...
     P                 E
      *
      * =====================================================================
      *   Web service: Sets the endpoint of the Web service
      * =====================================================================
     P Query_spcTE_spcType_setEndpoint...
     P                 B                   export
      *
     D Query_spcTE_spcType_setEndpoint...
     D                 PI
     D  i_url                     32767A   const varying  options(*varsize)
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         g_url = %subst(i_url: 1: %len(i_url));

         return;

      /end-free
      *
     P Query_spcTE_spcType_setEndpoint...
     P                 E
      *
      * =====================================================================
      *   Web service: Returns the host name of the Web Service endpoint
      * =====================================================================
     P Query_spcTE_spcType_getHost...
     P                 B                   export
      *
     D Query_spcTE_spcType_getHost...
     D                 PI         32767A          varying
      *
     D tmpUrl          S                   like(url_t ) inz
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         tmpUrl = URL_new(g_url);

         return URL_getHost(tmpUrl);

      /end-free
      *
     P Query_spcTE_spcType_getHost...
     P                 E
      *
      * =====================================================================
      *   Web service: Sets the host name of the Web service endpoint
      * =====================================================================
     P Query_spcTE_spcType_setHost...
     P                 B                   export
      *
     D Query_spcTE_spcType_setHost...
     D                 PI
     D  i_host                    32767A   const varying  options(*varsize)
      *
     D tmpUrl          S                   like(url_t ) inz
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         tmpUrl = URL_new(g_url);
         URL_setHost(tmpUrl: %subst(i_host: 1: %len(i_host)));
         g_url = URL_toString(tmpUrl);

         return;

      /end-free
      *
     P Query_spcTE_spcType_setHost...
     P                 E
      *
      * =====================================================================
      *   Web service: Returns the port of the Web Service endpoint
      * =====================================================================
     P Query_spcTE_spcType_getPort...
     P                 B                   export
      *
     D Query_spcTE_spcType_getPort...
     D                 PI            10I 0
      *
     D tmpUrl          S                   like(url_t ) inz
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         tmpUrl = URL_new(g_url);

         return URL_getPort(tmpUrl);

      /end-free
      *
     P Query_spcTE_spcType_getPort...
     P                 E
      *
      * =====================================================================
      *   Web service: Sets the port of the Web service endpoint
      * =====================================================================
     P Query_spcTE_spcType_setPort...
     P                 B                   export
      *
     D Query_spcTE_spcType_setPort...
     D                 PI
     D  i_port                       10I 0 const
      *
     D tmpUrl          S                   like(url_t ) inz
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free

         tmpUrl = URL_new(g_url);
         URL_setPort(tmpUrl: i_port);
         g_url = URL_toString(tmpUrl);

         return;

      /end-free
      *
     P Query_spcTE_spcType_setPort...
     P                 E
      *

      * =====================================================================
      *  Generated by WSDL2RPG 1.13 / 21.01.2011
      *  Built on Jan 31, 2011 (02:36:16)
      *  Based on WS_PGM v1.13
      * =====================================================================
      *   Sample program to show how to call the
      *     Query_spcTE_spcType_Mapics_spcTE()
      *   Web service.
      * =====================================================================
      *   Log4rpg Logging Service
      /UNDEFINE LOGGING_SERVICE
      * =====================================================================
      *   Pre-Compiler tags used by STRPREPRC to retrieve creation
      *   commands from the source member.
      * ---------------------------------------------------------------------
      * >>PRE-COMPILER<<
      *   >>CRTCMD<< CRTRPGMOD    MODULE(&LI/&OB) +
      *                           SRCFILE(&SL/&SF) +
      *                           SRCMBR(&SM);
      *   >>COMPILE<<
      *     >>PARM<< TRUNCNBR(*NO);
      *     >>PARM<< DBGVIEW(*LIST);
      *   >>END-COMPILE<<
      *   >>EXECUTE<<
      *   >>CMD<<    CRTPGM       PGM(&LI/&OB) +
      *                           MODULE(*PGM) +
      *                           BNDSRVPGM(*LIBL/WS0090      +
      *                                     ) +
      *                           DETAIL(*BASIC) +
      *                           ACTGRP(*NEW);
      * >>END-PRE-COMPILER<<
      * =====================================================================
     H DEBUG
     H OPTION(*SRCSTMT : *NODEBUGIO)
     H EXTBININT(*YES)
      *
      *  Include generated web service stub module to
      *  define the prototype of the web service procedure
      *  and the required type definitions (aka reference fields).
      /DEFINE PROTOTYPE_WS0090
 CPY  /COPY MAVINASH/QRPGLESRC,WS0090
      /UNDEFINE PROTOTYPE_WS0090
      *
      /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 WS0091...
     D                 PR
      *
      *  Sends a message to the command line.
     D sndMsg...
     D                 PR                  extproc('sndMsg')
     D  i_text                      128A   value  varying
      *
      * =====================================================================
      *  Program entry point
      * =====================================================================
     D WS0091...
     D                 PI
      *
      *  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 XML_spcString   S                   like(tns__XML_spcString_t)
     D                                     inz
     D Error_spcCode   S                   like(tns_Error_spcCode_t)
     D                                     inz
     D Error_spcMessage...
     D                 S                   like(tns_Error_spcMessage_t)
     D                                     inz
     D Object_spcId    S                   like(tns_Object_spcId_t)
     D                                     inz
     D Process_spcInstance_spcId...
     D                 S                   like(tns_Process_spcInstance_spcId_t)
     D                                     inz
     D Siebel_spcOperation_spcObject_spcId...
     D                 S                   like(tns_Siebel_spcOperation_spcOb...
     D                                     ject_spcId_t)
     D                                     inz
     D SiebelMessage   DS                  likeds(xsdLocal0_ListOfAgileUpdate...
     D                                     LovTopElmt_t)
     D                                     inz
     D Step_spcName    S                   like(tns_Step_spcName_t)
     D                                     inz
      *
      *  Response message
      *  This structure contains the result values returned by
      *  the web service.
     D Mapics_spcTERpc...
     D                 DS                  likeds(tns_Mapics_spcTERpc_t)
     D                                     inz
      *
      *  Text of messages sent to the command line
     D text            S            128A   varying inz
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free
      /if defined(LOGGING_SERVICE)

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

         // Enable/disable http api debug log
         // (Enable the http api debug log in case of problems with the web service)
            Query_spcTE_spcType_setHttpDebug(
               *ON: '/tmp/httpapi_debug.txt');   // Default path of http api

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

         // Set the paramater values of the request message
         // of the web service.
         //    assign values here
         XML_spcString = 'string';
         Error_spcCode = 'string';
         Error_spcMessage = 'string';
         Object_spcId = 'string';
         Process_spcInstance_spcId = 'string';
         Siebel_spcOperation_spcObject_spcId = 'string';
         // Set number of array items:
         SiebelMessage.ListOfAgileUpdateLov.ListOfValues.x = 1;
         // Set array item values:
         SiebelMessage.ListOfAgileUpdateLov.ListOfValues.item(SiebelMessage...
         .ListOfAgileUpdateLov.ListOfValues.x).Type = 'string';
         SiebelMessage.ListOfAgileUpdateLov.ListOfValues.item(SiebelMessage...
         .ListOfAgileUpdateLov.ListOfValues.x).Name = 'string';
         SiebelMessage.ListOfAgileUpdateLov.ListOfValues.item(SiebelMessage...
         .ListOfAgileUpdateLov.ListOfValues.x).Value = 'string';
         SiebelMessage.ListOfAgileUpdateLov.ListOfValues.item(SiebelMessage...
         .ListOfAgileUpdateLov.ListOfValues.x).SubType = 'string';
         SiebelMessage.ListOfAgileUpdateLov.ListOfValues.item(SiebelMessage...
         .ListOfAgileUpdateLov.ListOfValues.x).Active = 'string';
         Step_spcName = 'string';

         // Now let's call the web service.
         Mapics_spcTERpc =
            Query_spcTE_spcType_Mapics_spcTE(
                XML_spcString:
                Error_spcCode:
                Error_spcMessage:
                Object_spcId:
                Process_spcInstance_spcId:
                Siebel_spcOperation_spcObject_spcId:
                SiebelMessage:
                Step_spcName:
                errText);

         // If the Web service finished successfully ...
 B01     if (not Query_spcTE_spcType_isError());
            // ... get response data from response data structure

 X01     else;
            // ... else show error messages ordered by priority:
            // 1. HTTP error information
            text = %char(
                      Query_spcTE_spcType_HttpError_getCode()
                      ) + ': ' +
                   Query_spcTE_spcType_HttpError_getText()
                   ;
            sndMsg(text);
            // 2. SOAP error information
 B02        if (Query_spcTE_spcType_SoapError_getCode()
                  <> '');
               text = Query_spcTE_spcType_SoapError_getCode()
                      + ': ' +
                      Query_spcTE_spcType_SoapError_getText()
                      ;
               sndMsg(text);
 E02        endif;
            // 3. XML parser error information
 B02        if (Query_spcTE_spcType_XmlError_getCode()
                  <> 0);
               text = %char(Query_spcTE_spcType_XmlError_getCode())
                      + ': ' +
                      Query_spcTE_spcType_XmlError_getText()
                      ;
               sndMsg(text);
 E02        endif;
 E01     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
      *

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