[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Need help adjusting a WSDL2RPG stub program
Got no responses from my plea for help last week, but I've continued and got just a bit closer, I think. Still stuck, though. I had some help from Thomas for something similar several months ago, so I re-jiggered the stubs (both base and method) to be more like the one I have in production that deals with the multi-ref layer.
Still seeing the data returned from the web service in the debug log, but parsing blows up when called from procedure,"HTTP_receiveResponse":
"if (XMLSAXParser_parse(g_hSAXParser: i_data: i_length) = cTrue);" [returns FALSE]
Possibly because of one or more of the following:
1) The web service is returning something non-standard, or
2) I messed up the stub programs when I tried to adapt for multi-ref handling, or
3) Additional tweaks are needed (which I would need assistance with, because I'm quite over my head as it is.)
Attached .txt files are BaseStub (RPG source WS2PRVSN), MethodStub (RPG source WS2PRVSN03), TestCaller (RPG source WS2GETDEVC), and the debug log. Note that these are a bit different than those I attached to earlier posts.
Many thanks.
-- Michael Koester
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Koester, Michael
Sent: Thursday, July 19, 2012 11:48 AM
To: HTTPAPI and FTPAPI Projects
Subject: Need help adjusting a WSDL2RPG stub program
I used WSDL2RPG (the Thomas Raddatz tool) to generate a base stub WS_PRVSN, a method stub WS_PRVSN03, and a test caller program, WS_GETDEVC. My test caller program WS_GETDEVC, sends two inputs to the webservice. For those values sent I expect to get 24 key/value pairs returned. The debug log shows that all key/value pairs were returned by the webservice -- the stub just isn't parsing them out correctly.
The webservice appears to be sending back 24 key/value pairs, but they appear to be within a <multiRef ... </multiRef> set. The method stub does not appear to have the routines for parsing out the "MultiRef" layer.
Is there an easy way to fix the stub so that it ignores the outer group and just loads the data structure from the inner group of key/value pairs?
I can't directly share the access to the webservice (it's all on the private side of the firewall, and it pertains to customer-proprietary data), but hopefully the attachments should provide what you may need.
Thanks much.
Michael Koester
HTTPAPI Ver 1.24 released 2012-01-23
OS/400 Ver V7R1M0
New iconv() objects set, PostRem=819. PostLoc=0. ProtRem=819. ProtLoc=0
WSDL2RPG Ver 1.15beta7 released 2012-01-25
** 2012-07-26-10.29.57.186000: Entering Provision_getDeviceInterfaces()
New iconv() objects set, PostRem=1208. PostLoc=0. ProtRem=819. ProtLoc=0
** 2012-07-26-10.29.57.358000: Sending request to server
http_persist_open(): entered
http_long_ParseURL(): entered
DNS resolver retrans: 2
DNS resolver retry : 2
DNS resolver options: x'00000136'
DNS default domain: GSTNETWORKS.NET
DNS server found: 12.6.236.126
DNS server found: 12.160.200.5
http_persist_post(): entered
http_persist_req(POST) entered.
http_long_ParseURL(): entered
http_setauth(): entered
do_oper(POST): entered
There are 0 cookies in the cache
POST /axis/services/Provision HTTP/1.1
Host: 192.168.41.252:9090
User-Agent: http-api/1.24
Content-Length: 553
Authorization: Basic cm9vdDpwdWJsaWM=
Content-Type: text/xml
SOAPAction:
sendraw(): entered
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="urn:Provision" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><impl:getDeviceInterfaces soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><in0>192.168.10.42</in0><in1>0.0</in1></impl:getDeviceInterfaces></soapenv:Body></soapenv:Envelope>
recvresp(): entered
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=E61436BD4C50E660FEC45B4882EFBD13; Path=/axis
Content-Type: text/xml;charset=utf-8
Transfer-Encoding: chunked
Date: Thu, 26 Jul 2012 14:30:15 GMT
SetError() #13: HTTP/1.1 200 OK
recvresp(): end with 200
recvdoc parms: chunked 0
header_load_cookies() entered
cookie_parse() entered
cookie = JSESSIONID=E61436BD4C50E660FEC45B4882EFBD13; Path=/axis
cookie attr JSESSIONID=E61436BD4C50E660FEC45B4882EFBD13
cookie attr Path=/axis
recvchunk(): entered
get_chunk_size(): entered
e4e
chunk size = 3662
get_chunk_size returned 3662
calling comm_blockread
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><ns1:getDeviceInterfacesResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:Provision"><getDeviceInterfacesReturn href="#id0"/></ns1:getDeviceInterfacesResponse><multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:Map" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="http://xml.apache.org/xml-soap"><item><key xsi:type="soapenc:string">0.0</key><value href="#id1"/></item></multiRef><multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns3:Map" xmlns:ns3="http://xml.apache.org/xml-soap" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"><item><key xsi:type="soapenc:string">PORT_SPEED</key><value xsi:type="soapenc:string">100M</value></item><item><key xsi:type="soapenc:string">EGRESSLIMITER</key><value xsi:type="soapenc:string">NONE</value></item><item><key xsi:type="soapenc:string">FLOW_CONTROL</key><value xsi:type="soapenc:string">ON</value></item><item><key xsi:type="soapenc:string">DHCP_FILTERING</key><value xsi:type="soapenc:string">OFF</value></item><item><key xsi:type="soapenc:string">SUB_TYPE</key><value xsi:type="soapenc:string">Optical Fast Ethernet</value></item><item><key xsi:type="soapenc:string">DHCP_AGEING</key><value xsi:type="soapenc:string">OFF</value></item><item><key xsi:type="soapenc:string">PORT_DIRECTION</key><value xsi:type="soapenc:string">Customer</value></item><item><key xsi:type="soapenc:string">atnInterfaceExternalProfileName</key><value xsi:type="soapenc:string">WSA4_FIBER</value></item><item><key xsi:type="soapenc:string">TAGGED_VLANS</key><value xsi:type="soapenc:string">800,3001,3201</value></item><item><key xsi:type="soapenc:string">CardType</key><value xsi:type="soapenc:string">FX20</value></item><item><key xsi:type="soapenc:string">AVAILABILITY_STATUS</key><value xsi:type="soapenc:string">Failed</value></item><item><key xsi:type="soapenc:string">TaggedHVlans</key><value xsi:type="soapenc:string"></value></item><item><key xsi:type="soapenc:string">DUPLEX_STATE</key><value xsi:type="soapenc:string">FULL</value></item><item><key xsi:type="soapenc:string">OPERATIONAL_STATE</key><value xsi:type="soapenc:string">Down</value></item><item><key xsi:type="soapenc:string">DESCRIPTION</key><value xsi:type="soapenc:string">529-9980 SVCCTR TST </value></item><item><key xsi:type="soapenc:string">MAX_LEARNED_MAC_ADDRS</key><value xsi:type="soapenc:string">OFF</value></item><item><key xsi:type="soapenc:string">Profile_Name</key><value xsi:type="soapenc:string">WSA4_FIBER</value></item><item><key xsi:type="soapenc:string">UNTAGGED_VLAN</key><value xsi:type="soapenc:string"></value></item><item><key xsi:type="soapenc:string">ADMIN_STATE</key><value xsi:type="soapenc:string">Up</value></item><item><key xsi:type="soapenc:string">Port</key><value xsi:type="soapenc:string">0.0</value></item><item><key xsi:type="soapenc:string">PORT_TYPE</key><value xsi:type="soapenc:string">Ether-like</value></item><item><key xsi:type="soapenc:string">ENABLED_DHCP_INSTANCES</key><value xsi:type="soapenc:string">BOOT,RGMGMT,WSA4VOIP</value></item><item><key xsi:type="soapenc:string">AUTONEGOTIATE</key><value xsi:type="soapenc:string">OFF</value></item><item><key xsi:type="soapenc:string">UntaggedHVlan</key><value xsi:type="soapenc:string"></value></item></multiRef></soapenv:Body></soapenv:Envelope>
comm_blockread returned 3662
** 2012-07-26-10.30.00.634000: Entering HTTP_receiveResponse()
WSDL2RPG: USR0036: Failed to retrieve multi-reference information of ID 'id1'.
received from procedure: BASICS1R1_f_sndPgmMsg
and statement: 54400
WSDL2RPG (eXpat error): (-1009) Failed to retrieve multi-reference information of ID 'id1'.
received at line: 1
at column: 732
from procedure: WSDL2R97_XMLSAXParser_parse
and statement: 101800
** 2012-07-26-10.31.04.512000: Failed parsing XML message
** 2012-07-26-10.31.05.482000: Leaving HTTP_receiveResponse()
SetError() #16: recvchunk: saveproc: Not all data was written!
http_close(): entered
* =====================================================================
* Generated by WSDL2RPG 1.15beta7 / 25.01.2012
* Built on Jul 11, 2012 (16:35:32)
* Built for V7R1M0
* Based on WS2PGM v1.15
* =====================================================================
* Sample program to show how to call the
* Provision_getDeviceInterfaces()
* Web service.
* =====================================================================
* Implementaion instructions
* ---------------------------------------------------------------------
*
* ==> libraries LIBHTTP and WSDL2RPG must be in the library list <==
*
* CRTRPGMOD (use wdsc defaults)
*
todo * CRTPGM PGM(mkoester/WS2getdevc)
* MODULE(mkoester/WS2getdevc)
* BNDSRVPGM(mkoester/WS2prvsn )
* DETAIL(*BASIC)
* ACTGRP(*NEW)
* TEXT('Web Service: Caller for getDeviceInterfaces')
*
* =====================================================================
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_WS2PRVSN03
todo /COPY MKOESTER/QRPGLESRC,WS2PRVSN03
/UNDEFINE PROTOTYPE_WS2PRVSN03
*
/define DEVICE_INTERFACES
/COPY TFSCOPYSRC,NMS_PROTOS
/undefine DEVICE_INTERFACES
* ------------------------------------
* Internal prototypes
* ------------------------------------
* Sends a message to the command line.
D sndMsg...
D PR extproc('sndMsg')
D i_text 128A value varying
*
* =====================================================================
* Program entry point
* =====================================================================
D WS2GETDEVC...
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 in0 S like(impl_in0_t)
D inz
D in1 S like(impl_in1_t)
D inz
*
* Response message
* This structure contains the result values returned by
* the web service.
D getDeviceInterfacesRpc...
D DS likeds(impl_getDeviceInterfacesRpc_t)
D inz
*
* Text of messages sent to the command line
D text S 128A varying inz
D paircount s 5u 0 inz
D i s 5u 0 inz
D pairkey S 128A varying inz
D pairvalue S 128A varying inz
test D displayThis S 25A
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
// Enable/disable http api debug log
// (Enable the http api debug log in case of problems with the web service)
Provision_Port_setHttpDebug(*ON: '/tmp/httpapi_debug.txt');
// Default path of http api
// Specify a proxy server if your network requires it.
// Provision_Port_setHttpProxy(
// 'your.proxy.server': 8080);
// Set the paramater values of the request message
// of the web service.
// assign values here
test in0 = '192.168.10.42';
test in1 = '0.0';
// Now let's call the web service, WS2PRVSN03
getDeviceInterfacesRpc =
Provision_getDeviceInterfaces(
in0:
in1:
errText);
// If the Web service finished successfully ...
B01 if (not Provision_Port_isError());
// ... get response data from response data structure
// get the number of Key/Value pairs
DeviceInterfaces_ds.PairCount = getDeviceInterfacesRpc
.getDeviceInterfacesReturn
.item(1)
.x;
// ... and load the attributes into the PairData array
DeviceInterfaces_ds.PairData = getDeviceInterfacesRpc
.getDeviceInterfacesReturn
.item(1)
.item;
X01 else;
// ... else show error messages ordered by priority:
// 1. HTTP error information
text = %char(
Provision_HttpError_getCode()
) + ': ' +
Provision_HttpError_getText()
;
sndMsg(text);
// 2. SOAP error information
B02 if (Provision_SoapError_getCode()
<> '');
text = Provision_SoapError_getCode()
+ ': ' +
Provision_SoapError_getText()
;
sndMsg(text);
E02 endif;
// 3. XML parser error information
B02 if (Provision_XmlError_getCode()
<> 0);
text = %char(Provision_XmlError_getCode())
+ ': ' +
Provision_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
*
* Module: WS2INVEN12 aka Provision_getDeviceInterfaces
*======================================================================
* Generated by WSDL2RPG 1.15beta7 / 25.01.2012
* Built on Mar 13, 2012 (11:01:57)
* Built for V7R1M0
* Based on WS_OPER v1.15
*
* This source member is the RPG web service stub of the
* following Web Service operation:
*
* Port : Provision
* Operation : getDeviceInterfaces()
*
*======================================================================
* Implementaion instructions
* ---------------------------------------------------------------------
*
* ==> libraries LIBHTTP and WSDL2RPG must be in the library list <==
*
* CRTRPGMOD MODULE(TFSCM1/WS2PRVSN03)
* SRCFILE(TFSCM1/QRPGLESRC)
* SRCMBR(WS2PRVSN03)
* DBGVIEW(*SOURCE)
* REPLACE(*YES)
*======================================================================
*
* Purpose: Web Service method stub for getDeviceInterfaces.
*
* Notes: This source was generated by the Thomas Raddatz WSDL2RPG tool
* and required modification to accommodate return of a complex
* data structure.
*
* This module will be bound into the WS2PRVSN service program.
*
*--------------------------------------------------
* Maintenance History
*
* 07/ /2012 GSD2557 Michael Koester
* Program created for Auto-provisioning of Allied equipment.
*
*--------------------------------------------------
/IF NOT DEFINED(PROTOTYPE_WS2PRVSN03)
*
* Please search for 'INFO:' to get basic information how to call
* the web service.
*
* Default attachment handling (for demonstration) was added to
* WS_OPER 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:
* Provision_Attachments_setFolder()
*
* 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.
*
H NOMAIN
H DEBUG
H BNDDIR('HTTPAPI': 'QC2LE')
H OPTION(*SRCSTMT : *NODEBUGIO)
H EXTBININT(*YES)
*
* Do not change or remove this compiler condition|
/DEFINE NO_CONST_ON_INPUT_PARAMETERS
/ENDIF
/IF NOT DEFINED(PROTOTYPE_DEFINED_WS2PRVSN03)
/DEFINE PROTOTYPE_DEFINED_WS2PRVSN03
*
* INFO:
* This is the procedure you call to consume the Web Service:
* ----------------------------------------------------------
* Operation: getDeviceInterfaces
* Returns : getDeviceInterfacesRpc
*
* INFO:
* Define your own fields using the type templates used in the prototype
* below. Use LIKE(*_t) or LIKEDS(*_t) to define these fields.
* All type templates of this web service are defined in web service
* module: WS2PRVSN
*
D Provision_getDeviceInterfaces...
D PR likeds(impl_getDeviceInterfacesRpc_t)
D extproc('Provision_getDeviceInterfac+
D es')
D i_in0 like(impl_in0_t)
/IF NOT DEFINED(NO_CONST_ON_INPUT_PARAMETERS)
D const
/ENDIF
D i_in1 like(impl_in1_t)
/IF NOT DEFINED(NO_CONST_ON_INPUT_PARAMETERS)
D const
/ENDIF
D o_msg like(wsdl_errText_t )
*
CPY /COPY QWSDL2RPG,TYPES_H
*
/DEFINE PROTOTYPE_WS2PRVSN
todo /COPY mkoester/QRPGLESRC,WS2PRVSN Web Service: Web Service Proc
/UNDEFINE PROTOTYPE_WS2PRVSN
*
/ENDIF
/IF DEFINED(PROTOTYPE_WS2PRVSN03)
/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,PWSDL2R88 WSDL2RPG: Public Helper Procedures
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
*
* ------------------------------------
* 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 impl_getDeviceInterfacesRpcStart...
D PR
D extproc('impl_getDeviceInterfacesRpc+
D Start')
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 impl_getDeviceInterfacesRpcEnd...
D PR
D extproc('impl_getDeviceInterfacesRpc+
D End')
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
D attrs * dim(32767)
D const options(*varsize)
D impl_item_of_anyTypeStart_of_impl_getDeviceInterfacesRpc...
D PR
D extproc('impl_item_of_anyTypeStart_o+
D f_impl_getDeviceInterfacesRpc')
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 impl_item_of_anyTypeEnd_of_impl_getDeviceInterfacesRpc...
D PR
D extproc('impl_item_of_anyTypeEnd_of_+
D impl_getDeviceInterfacesRpc')
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
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 ')
*
D getOperationUuid...
D PR like(wsdl_uuid_t )
D extproc('+
D getOperationUuid+
D ')
*
D getPortName...
D PR like(wsdl_portName_t )
D extproc('+
D getPortName+
D ')
*
D getOperationName...
D PR like(wsdl_operName_t )
D extproc('+
D getOperationName+
D ')
*
D getPostCcsid...
D PR 10I 0
D extproc('+
D getPostCcsid+
D ')
*
* ------------------------------------
* Global fields & constants
* ------------------------------------
*
* UUID of the web service operation as generated by WSDL2RPG
* (Using UUID of web service port for all operations by default)
*cOPERATION_UUID...
* C 'B2304C011FE8195EA35B0004AC101091'
*
* 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
*
* HTTP response "initialized" indicator
D g_HTTP_isInit...
D S N inz(cFalse)
*
* Error information of web service operation
D g_errors DS likeds(wsdl_errors_t ) inz
*
* Switch for AXIS bug AXIS-2095
D g_isAXIS_2095 S N inz(cFalse)
*
* -------------------------------------------
* 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: getDeviceInterfaces
* Returns : getDeviceInterfacesRpc
* =====================================================================
P Provision_getDeviceInterfaces...
P B export
D Provision_getDeviceInterfaces...
D PI likeds(impl_getDeviceInterfacesRpc_t)
D** i_in0 likeds(apachesoap_Map_t)
D** o_msg 128A varying
D i_in0 256A varying
D i_in1 256A varying
D o_msg 128A varying
*
* Return value
D rtnValue DS likeds(impl_getDeviceInterfacesRpc_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 32767A varying
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
*
* HTTP debug log settings
D httpDebug DS likeds(wsdl_httpDebug_t ) inz
*
* Proxy server to use
D httpProxy DS likeds(wsdl_proxy_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 X_A2 S 10I 0 inz
*
D curMapItem_A1 DS likeds(apachesoap_mapItem_t)
D inz
*
D curItem_of_anyType_A2...
2557+D ds likeds(impl_item_of_anyType_t)
2557+D inz
2557-D*** S like(impl_item_of_anyType_t)
2557-D*** inz
*
D userData DS likeds(impl_getDeviceInterfacesRpc_t)
D inz
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
o_msg = '';
monitor;
// Initialize web service stub
Provision_Port_initialize(
getOperationName());
// Enable/disable HTTP debug log
httpDebug = Provision_Port_getHttpDebug();
http_debug(httpDebug.status: httpDebug.fileName);
http_DebugLog_appendText(
'** ' + %char(%timestamp()) + ': Entering ' + f_this() + '()');
// Initialize map to manage <multiRef> elements
MultiRef_new();
// Remove all attachments of this service from the list of attachments
Provision_Attachments_removeAll(
getOperationUuid());
// Set proxy server to use
httpProxy = Provision_Port_getHttpProxy();
http_setproxy(httpProxy.server: httpProxy.port);
// Set CCSID for POST data according
// to the encoding of the SOAP envelope
HTTP_SetCCSIDs(getPostCcsid(): HTTP_EBCDIC);
// Create and open data source to store the request message
hDataSource = ManagedMemoryDataSource_new();
contentType = 'text/xml';
hOutStream = ManagedMemoryDataSource_OutputStream_open(
hDataSource: contentType: getPostCcsid());
// Produce SOAP request message
request =
'<?xml version="1.0" encoding="UTF-8"?>' +
'<soapenv:Envelope' +
' xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"' +
' xmlns:apachesoap="http://xml.apache.org/xml-soap"' +
' xmlns:impl="urn:Provision"' +
' xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"' +
' xmlns:xsd="http://www.w3.org/2001/XMLSchema"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
'>' +
'<soapenv:Body>' +
'';
a if (%len(request) > 0);
// Add previous bytes of request message to output stream
ManagedMemoryDataSource_OutputStream_write(hOutStream: %addr(requ...
est: *DATA): %len(request));
clear request;
endif;
request = request +
'<impl:getDeviceInterfaces' +
' soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/e+
ncoding/"' +
'>' +
'<in0' +
'>' +
'';
b if (%len(request) > 0);
// Add previous bytes of request message to output stream
ManagedMemoryDataSource_OutputStream_write(hOutStream: %addr(requ...
est: *DATA): %len(request));
clear request;
endif;
Marshaller_toStringV6(
%addr(i_in0)
: %addr(i_in0: *DATA)
: %len(i_in0)
: hOutStream);
request = request +
'</in0>' +
'<in1>' +
'';
c if (%len(request) > 0);
// Add previous bytes of request message to output stream
ManagedMemoryDataSource_OutputStream_write(hOutStream: %addr(
request: *DATA): %len(request));
clear request;
endif;
Marshaller_toStringV6(
%addr(i_in1)
: %addr(i_in1: *DATA)
: %len(i_in1)
: hOutStream);
request = request +
'</in1>' +
'</impl:getDeviceInterfaces>' +
'</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
Provision_Port_clearErrors(
g_errors);
// HTTPAPI: Enables additional headers
http_xproc(HTTP_POINT_ADDL_HEADER
: %paddr('HTTP_setContentTypeAndSOAPAction')
: %addr(headers));
headers.contentType =
ManagedMemoryDataSource_getContentType(hDataSource);
headers.soapAction = '';
// ---------------------------------------
// 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 = Provision_Endpoint_get();
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);
http_DebugLog_appendText(
'** ' + %char(%timestamp()) + ': Sending request to server');
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 (not Provision_Port_hasLoginCallback());
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 = Provision_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;
// Set error information of last service call
Provision_Port_setErrors(
g_errors);
return rtnValue;
/end-free
*
P Provision_getDeviceInterfaces...
P E
*
*
* ==================================================================
* Return value: impl:getDeviceInterfacesRpc
* ==================================================================
P impl_getDeviceInterfacesRpcStart...
P B
D impl_getDeviceInterfacesRpcStart...
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(impl_getDeviceInterfacesRpc_t)
D based(pCurrentItem)
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
// Get access to current item
pCurrentItem = userdata;
select;
when (depth = 1
and
name = 'getDeviceInterfacesRpc');
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 = 'getDeviceInterfacesReturn'
and
namespace = '');
XMLSAXParser_delegateElementProcessing(
%addr(currentItem.getDeviceInterfacesReturn)
: %paddr('impl_item_of_anyTypeStart_of_impl_getDeviceInterfacesRpc')
: %paddr('impl_item_of_anyTypeEnd_of_impl_getDeviceInterfacesRpc'
));
return;
endsl;
return;
/end-free
*
P impl_getDeviceInterfacesRpcStart...
P E
*
* ==================================================================
* Return value: impl:getDeviceInterfacesRpc
* ==================================================================
P impl_getDeviceInterfacesRpcEnd...
P B
D impl_getDeviceInterfacesRpcEnd...
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
D attrs * dim(32767)
D const options(*varsize)
*
D currentItem DS likeds(impl_getDeviceInterfacesRpc_t)
D based(pCurrentItem)
*
D itemValue DS likeds(wsdl_fullElementData_t)
D inz
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
// Get access to current item
pCurrentItem = userdata;
// Get full element data
itemValue = XMLSAXParser_getFullElementData();
select;
endsl;
return;
/end-free
*
P impl_getDeviceInterfacesRpcEnd...
P E
*
* ==================================================================
* Return value: impl:getDeviceInterfacesReturn
* ==================================================================
P impl_item_of_anyTypeStart_of_impl_getDeviceInterfacesRpc...
P B
D impl_item_of_anyTypeStart_of_impl_getDeviceInterfacesRpc...
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 impl_getDeviceInterfacesReturn...
D DS likeds(impl_RpgArrayOfArrayOf_xsd_...
D anyType_t)
D based(userdata)
*
2557-D*** currentItem S like(impl_item_of_anyType_t)
2557-D*** based(pCurrentItem)
2557+D currentItem ds likeds(impl_item_of_anyType_t)
2557+D based(pCurrentItem)
2557-D*** emptyItem S like(impl_item_of_anyType_t)
2557-D*** inz
2557+D emptyItem ds likeds(impl_item_of_anyType_t)
2557+D inz
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
// Return to caller if array is SOAP encoded.
// Depth=1 indicates that we are at the top
// of the array but not on item level.
if (depth = 1);
if (MultiRef_isReference(attrs));
MultiRef_put(
attrs
: XMLSAXParser_getUserData()
: depth
: namespace
: name
: path
: XMLSAXParser_getStartCallback()
: XMLSAXParser_getEndCallback()
: *omit
: %addr(impl_getDeviceInterfacesReturn)
: %size(impl_getDeviceInterfacesReturn)
);
endif;
return;
endif;
// Get access to current array item
if (MultiRef_doCaptureData() and MultiRef_hasItemIndex());
x = MultiRef_getItemIndex();
else;
if (depth = 2);
impl_getDeviceInterfacesReturn.x
= impl_getDeviceInterfacesReturn.x + 1;
endif;
x = impl_getDeviceInterfacesReturn.x;
endif;
pCurrentItem = %addr(impl_getDeviceInterfacesReturn.item(x));
select;
when (depth = 2);
if (MultiRef_isReference(attrs));
MultiRef_put(
attrs
: XMLSAXParser_getUserData()
: depth
: namespace
: name
: path
: XMLSAXParser_getStartCallback()
: XMLSAXParser_getEndCallback()
: x
: %addr(currentItem)
: %size(currentItem)
);
endif;
return;
2557+ when (depth = 3);
2557+ currentItem.x = currentItem.x + 1; // Increment # of map entries
endsl;
return;
/end-free
*
P impl_item_of_anyTypeStart_of_impl_getDeviceInterfacesRpc...
P E
*
* ==================================================================
* Return value: impl:getDeviceInterfacesReturn
* ==================================================================
P impl_item_of_anyTypeEnd_of_impl_getDeviceInterfacesRpc...
P B
D impl_item_of_anyTypeEnd_of_impl_getDeviceInterfacesRpc...
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
D attrs * dim(32767)
D const options(*varsize)
*
D x S 10I 0 inz
*
D impl_getDeviceInterfacesReturn...
D DS likeds(impl_RpgArrayOfArrayOf_xsd_...
D anyType_t)
D based(userdata)
*
2557-D*** currentItem S like(impl_item_of_anyType_t)
2557-D*** based(pCurrentItem)
2557+D currentItem ds likeds(impl_item_of_anyType_t)
D based(pCurrentItem)
2557+D currentMapItem DS likeds(impl_mapItem_t)
2557+D based(pCurrentMapItem)
D itemValue DS likeds(wsdl_fullElementData_t)
D inz
2557+ * i is Index of current map entry
2557+D i S 10I 0 inz
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
// Return to caller if array is SOAP encoded.
// Depth=1 indicates that we are at the top
// of the array but not on item level.
if (depth = 1);
return;
endif;
// Get access to current array item
if (MultiRef_doCaptureData() and MultiRef_hasItemIndex());
x = MultiRef_getItemIndex();
else;
x = impl_getDeviceInterfacesReturn.x;
endif;
pCurrentItem = %addr(impl_getDeviceInterfacesReturn.item(x));
// Get full element data
itemValue = XMLSAXParser_getFullElementData();
2557+ if (depth = 4);
2557+ i = currentItem.x;
2557+ pCurrentMapItem = %addr(currentItem.item(i));
2557+ select;
2557+ when (name = 'key');
2557+ UnMarshaller_toStringV6(
2557+ %addr(currentMapItem.key)
2557+ : %addr(currentMapItem.key: *DATA)
2557+ : %size(currentMapItem.key)
2557+ : itemValue.pData
2557+ : itemValue.size);
2557+ when (name = 'value');
2557+ UnMarshaller_toStringV6(
2557+ %addr(currentMapItem.value)
2557+ : %addr(currentMapItem.value: *DATA)
2557+ : %size(currentMapItem.value)
2557+ : itemValue.pData
2557+ : itemValue.size);
2557+ endsl;
2557+ endif;
/end-free
*
P impl_item_of_anyTypeEnd_of_impl_getDeviceInterfacesRpc...
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
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
http_DebugLog_appendText(
'** ' + %char(%timestamp()) + ': Requesting user name and password');
rc = Provision_Port_login(
i_http_err: i_numAttempts);
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 rc S 10I 0 inz(-1)
D contentType S 1024A inz
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
http_DebugLog_appendText(
'** ' + %char(%timestamp()) + ': Entering ' + f_this() + '()');
if (not g_HTTP_isInit);
select;
when (http_getContentType() = 'text');
if (http_getContentSubType() = 'html');
if (f_exist('WSDL2RPG': '*LIBL': '*MSGF'));
clear USR0030;
USR00301 = getPortName();
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;
http_DebugLog_appendText(
'** ' + %char(%timestamp()) + ': Detected MIME message');
endsl;
g_HTTP_isInit = cTrue;
endif;
if (g_isMimeMessage);
if (MIMEParser_parse(g_hMIMEParser: i_data: i_length) = cTrue);
rc = i_length;
else;
rc = -1;
http_DebugLog_appendText(
'** '+ %char(%timestamp()) +': Failed parsing MIME message');
endif;
else;
if (XMLSAXParser_parse(g_hSAXParser: i_data: i_length) = cTrue);
rc = i_length;
else;
rc = -1;
http_DebugLog_appendText(
'** '+ %char(%timestamp()) +': Failed parsing XML message');
endif;
endif;
http_DebugLog_appendText(
'** ' + %char(%timestamp()) + ': Leaving ' + f_this() + '()');
return rc;
/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 = Provision_Attachments_getFolder()
+ %char(%timestamp()) + '_' + contentID + '_'
+ fileName + '.' + fileExt;
fileName = %xlate(':<>': '___': fileName);
// Assign filename to content-ID and put it into the list of attachments
Provision_Attachments_put(
contentID
: fileName
: getOperationUuid());
// 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 = getPortName();
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('impl_getDeviceInterfacesRpcStart')
: %paddr('impl_getDeviceInterfacesRpcEnd'));
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
*
* =====================================================================
* Returns the UUID of this web service operation.
* All attachments and allocated memory block are attached to
* this UUID.
* =====================================================================
P getOperationUuid...
P B
*
D getOperationUuid...
D PI like(wsdl_uuid_t )
*
* Return value
D uuid S like(wsdl_uuid_t ) inz
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
uuid = Provision_Port_getUuid();
return uuid;
/end-free
*
P getOperationUuid...
P E
*
* =====================================================================
* Returns the name of the web service port.
* =====================================================================
P getPortName...
P B
*
D getPortName...
D PI like(wsdl_portName_t )
*
* Return value
D name S like(wsdl_portName_t ) inz
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
name = Provision_Port_getName();
return name;
/end-free
*
P getPortName...
P E
*
* =====================================================================
* Returns the name of this web service operation.
* =====================================================================
P getOperationName...
P B
*
D getOperationName...
D PI like(wsdl_operName_t )
*
* Return value
D name S like(wsdl_operName_t ) inz
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
name = 'getDeviceInterfaces';
return name;
/end-free
*
P getOperationName...
P E
*
* =====================================================================
* Returns the CCSID of the remote POST data.
* =====================================================================
P getPostCcsid...
P B
*
D getPostCcsid...
D PI 10I 0
*
* Return value
D post_ccsid S 10I 0 inz(1208)
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
post_ccsid = Provision_Port_getPostCcsid();
return post_ccsid;
/end-free
*
P getPostCcsid...
P E
*
*======================================================================
* Generated by WSDL2RPG 1.15beta7 / 25.01.2012
* Built on Jul 19, 2012 (09:24:50)
* Built for V7R1M0
* Based on WS_SRV v1.15
*======================================================================
*
* This source member contains the common procedures
* of web service port:
*
* Provision
*
*======================================================================
* Implementaion instructions
* ---------------------------------------------------------------------
*
* ==> libraries LIBHTTP and WSDL2RPG must be in the library list <==
*
* CRTRPGMOD SRCFILE(TFSCM1/QRPGLESRC)
* SRCMBR(WS2PRVSN)
* DBGVIEW(*SOURCE)
* REPLACE(*YES)
*
* CRTSRVPGM SRVPGM(TFSCM1/ws2prvsn)
* MODULE(*libl/ws2prvsn
* *libl/ws2prvsn03)
* EXPORT(*ALL)
* BNDSRVPGM(WSDL2RPG/WSDL2RPGRT
* WSDL2RPG/MIME
* WSDL2RPG/HTTPMIME
* WSDL2RPG/BASICS1
* TFSCM1/DSLAM_URL )
* TEXT('Webservice Stub for complex Provision methods')
* DETAIL(*BASIC)
*======================================================================
*
* Purpose: Web Service base stub for all "complex" NMS Provision
* operations. Any method that returns a basic data structure
* must use the companion set of stub source members, beginning
* with "WS_" instead of "WS2".
*
* Notes: This source was generated by the Thomas Raddatz WSDL2RPG tool
* for 15 Inventory methods available on the Allied Northbound
* Interface web service as of March, 2012.
*
* The base stub and method stub(s) have been modified for those
* method stubs that must return a complex data structure.
*
* This base stub has been customized to include a call to the
* DSLAM_URL service program to provide login credentials for
* connecting to the NMS web service at run-time.
*
*--------------------------------------------------
* Maintenance History
*
* 07/ /2012 GSD2557 Michael Koester
* Program created for Auto-provisioning of Allied equipment.
*
*======================================================================
/IF NOT DEFINED(PROTOTYPE_WS2PRVSN)
H NOMAIN
H DEBUG
H BNDDIR('HTTPAPI': 'QC2LE')
H OPTION(*SRCSTMT : *NODEBUGIO)
H EXTBININT(*YES)
/ENDIF
/IF NOT DEFINED(PROTOTYPE_DEFINED_WS2PRVSN)
/DEFINE PROTOTYPE_DEFINED_WS2PRVSN
*
* Type definitions
CPY /COPY QWSDL2RPG,TYPES_H
CPY /COPY QWSDL2RPG,PWSDL2R90 WSDL2RPG: AppMsg
*
* Array dimensions:
2557-D*** DIM_A1 C 256
2557+D DIM_A1 C 16
2557+D DIM_A2 C 16
2557+D DIM_A3 C 256
* Web Service specific types:
*
D apachesoap_mapItem_t...
D DS template
D qualified
D key 256A varying
D value 256A varying
*
*
D apachesoap_Map_t...
D DS template
D qualified
D item likeds(apachesoap_RpgArrayOfItem_t)
*
*
D apachesoap_RpgArrayOfItem_t...
D DS template
D qualified
D x 10I 0
D mapItem likeds(apachesoap_mapItem_t)
D dim(DIM_A1)
*
*
D impl_backupDeviceConfigRpc_t...
D DS template
D qualified
D backupDeviceConfigReturn...
D 256A varying
*
*
D impl_deprovisionPortRpc_t...
D DS template
D qualified
D deprovisionPortReturn...
D 256A varying
*
*
D impl_getDeviceInterfacesReturnMvd_t...
D DS template
D qualified
D item likeds(apachesoap_RpgArrayOfItem_t)
*
*
D impl_getDeviceInterfacesRpc_t...
D DS template
D qualified
D getDeviceInterfacesReturn...
mk- D** likeds(impl_getDeviceInterfacesRet...
mk- D** urnMvd_t)
mk D likeds(impl_RpgArrayOfArrayOf_xsd_...
mk D anyType_t)
*
D impl_getDeviceVlansReturnMvd_t...
D DS template
D qualified
D item likeds(apachesoap_RpgArrayOfItem_t)
*
*
D impl_getDeviceVlansRpc_t...
D DS template
D qualified
D getDeviceVlansReturn...
D likeds(impl_getDeviceVlansReturnMv...
D d_t)
*
*
D impl_getRGDeviceDetailsReturnMvd_t...
D DS template
D qualified
D item likeds(apachesoap_RpgArrayOfItem_t)
*
*
D impl_getRGDeviceDetailsRpc_t...
D DS template
D qualified
D getRGDeviceDetailsReturn...
D likeds(impl_getRGDeviceDetailsRetu...
D rnMvd_t)
*
D impl_in0_t S 256A varying
D template
D impl_in1_t S 256A varying
D template
*
D impl_modifyPortRpc_t...
D DS template
D qualified
D modifyPortReturn...
D 256A varying
*
*
D impl_modifyRGRpc_t...
D DS template
D qualified
D modifyRGReturn...
D 256A varying
*
*
D impl_provisionPortRpc_t...
D DS template
D qualified
D provisionPortReturn...
D 256A varying
*
*
D impl_sendDeviceCommandRpc_t...
D DS template
D qualified
D sendDeviceCommandReturn...
D 256A varying
2557+D impl_item_of_anyType_t...
2557+D ds template
2557+D qualified
2557+D x 10i 0
2557+D item likeds(impl_mapItem_t)
2557+D dim(DIM_A2)
2557+D impl_mapItem_t...
2557+D DS template
2557+D qualified
2557+D key 64A varying
2557+D value 256A varying
2557+D impl_RpgArrayOfArrayOf_xsd_anyType_t...
2557+D DS template
2557+D qualified
2557+D x 10I 0
2557+D item likeds(impl_item_of_anyType_t)
2557+D dim(DIM_A1)
* Public prototypes
*
* Web service: Returns the endpoint of the Web service
D Provision_Endpoint_get...
D PR 32767A varying
D extproc('+
D Provision+
D _Endpoint_get+
D ')
*
* Web service: Sets the endpoint of the Web service
D Provision_Endpoint_set...
D PR
D extproc('+
D Provision+
D _Endpoint_set+
D ')
D i_url 32767A const varying options(*varsize)
*
* Web service: Returns the host name of the Web Service endpoint
D Provision_Endpoint_getHost...
D PR 32767A varying
D extproc('+
D Provision+
D _Endpoint_getHost+
D ')
*
* Web service: Sets the host name of the Web service endpoint
D Provision_Endpoint_setHost...
D PR
D extproc('+
D Provision+
D _Endpoint_setHost+
D ')
D i_url 32767A const varying options(*varsize)
*
* Web service: Returns the port of the Web Service endpoint
D Provision_Endpoint_getPort...
D PR 10I 0
D extproc('+
D Provision+
D _Endpoint_getPort+
D ')
*
* Web service: Sets the port of the Web service endpoint
D Provision_Endpoint_setPort...
D PR
D extproc('+
D Provision+
D _Endpoint_setPort+
D ')
D i_port 10I 0 const
*
* Web service: Initializes the web services port
D Provision_Port_initialize...
D PR
D extproc('+
D Provision+
D _Port_initialize+
D ')
D i_operName const like(wsdl_operName_t )
*
* Web service: Sets the proxy server to use for the connection
D Provision_Port_setHttpProxy...
D PR
D extproc('+
D Provision+
D _Port_setHttpProxy+
D ')
D i_server 256A const
D i_port 10I 0 const
*
* Web service: Returns the proxy server to use for the connection
D Provision_Port_getHttpProxy...
D PR likeds(wsdl_proxy_t )
D extproc('+
D Provision+
D _Port_getHttpProxy+
D ')
*
* Web service: Enables/disables the debug log of HTTP API
D Provision_Port_setHttpDebug...
D PR
D extproc('+
D Provision+
D _Port_setHttpDebug+
D ')
D i_status N const
D i_fileName 500A const varying options(*nopass)
*
* Web service: Returns the HTTP API debug settings
D Provision_Port_getHttpDebug...
D PR likeds(wsdl_httpDebug_t )
D extproc('+
D Provision+
D _Port_getHttpDebug+
D ')
*
* Web service: Sets the CCSID used for POST data.
D Provision_Port_setPostCcsid...
D PR
D extproc('+
D Provision+
D _Port_setPostCcsid+
D ')
D i_post_ccsid 10I 0 const
*
* Web service: Returns the CCSID used for POST data.
D Provision_Port_getPostCcsid...
D PR 10I 0
D extproc('+
D Provision+
D _Port_getPostCcsid+
D ')
*
* Web service: Clears all error information
D Provision_Port_clearErrors...
D PR
D extproc('+
D Provision+
D _Port_clearErrors+
D ')
D io_errors likeds(wsdl_errors_t )
*
* Web service: Sets error information
D Provision_Port_setErrors...
D PR
D extproc('+
D Provision+
D _Port_setErrors+
D ')
D i_errors const likeds(wsdl_errors_t )
*
* Http: Returns cTrue in case of an error, else cFalse.
D Provision_Port_isError...
D PR N
D extproc('+
D Provision+
D _Port_isError+
D ')
*
* Http: Returns the last HTTP error (code) that occurred.
D Provision_HttpError_getCode...
D PR like(wsdl_http_ErrorNo_t )
D extproc('+
D Provision+
D _HttpError_getCode+
D ')
*
* Http: Returns the last HTTP error (text) that occurred.
D Provision_HttpError_getText...
D PR like(wsdl_http_ErrorText_t)
D extproc('+
D Provision+
D _HttpError_getText+
D ')
*
* Soap: Returns the last SOAP error (code) that occurred.
D Provision_SoapError_getCode...
D PR like(wsdl_soap_faultcode_t )
D extproc('+
D Provision+
D _SoapError_getCode+
D ')
*
* Soap: Returns the last SOAP error (text) that occurred.
D Provision_SoapError_getText...
D PR like(wsdl_soap_faultstring_t)
D extproc('+
D Provision+
D _SoapError_getText+
D ')
*
* Soap: Returns the last XML error (code) that occurred.
D Provision_XmlError_getCode...
D PR like(wsdl_xml_errorNo_t )
D extproc('+
D Provision+
D _XmlError_getCode+
D ')
*
* Soap: Returns the last XML error (text) that occurred.
D Provision_XmlError_getText...
D PR like(wsdl_xml_ErrorText_t )
D extproc('+
D Provision+
D _XmlError_getText+
D ')
*
* Registers an user callback procedure, that is called whenever
* a web service requires user authentification.
D Provision_Port_registerLoginCallback...
D PR
D extproc('+
D Provision+
D _Port_registerLoginCallback+
D ')
D i_pLoginProc * value procptr
*
* Returns *ON if a login procedures has been registered.
D Provision_Port_hasLoginCallback...
D PR N
D extproc('+
D Provision+
D _Port_hasLoginCallback+
D ')
*
* Login to proxy server or web service.
D Provision_Port_login...
D PR 10I 0
D extproc('+
D Provision+
D _Port_login+
D ')
D i_http_err 10I 0 value
D i_numAttempts 10I 0 value
*
* Returns the name of the web service port.
D Provision_Port_getName...
D PR 512A varying
D extproc('+
D Provision+
D _Port_getName+
D ')
*
* Returns the UUID of the web service port.
D Provision_Port_getUuid...
D PR like(wsdl_uuid_t )
D extproc('+
D Provision+
D _Port_getUuid+
D ')
*
* Adds an attachments to the list of attachments.
D Provision_Attachments_put...
D PR
D extproc('+
D Provision+
D _Attachments_put+
D ')
D i_attachmentID...
D const like(wsdl_attachmentID_t )
D i_fileName const like(wsdl_path_t )
D i_uuid const like(wsdl_uuid_t )
D options(*nopass)
*
* Returns the file name of the attachment that is associated to
* a given content ID.
D Provision_Attachments_get...
D PR like(wsdl_path_t )
D extproc('+
D Provision+
D _Attachments_get+
D ')
D i_attachmentID...
D const like(wsdl_attachmentID_t )
D i_uuid const like(wsdl_uuid_t )
D options(*nopass)
*
* Returns the file name of the attachment that is associated to
* a given index.
D Provision_Attachments_getAtPos...
D PR likeds(wsdl_attachment_t )
D extproc('+
D Provision+
D _Attachments_getAtPos+
D ')
D i_index 10I 0 const
D i_uuid const like(wsdl_uuid_t )
D options(*nopass)
*
* Returns the number of attachments that were downloaded with the
* last call to the web service.
D Provision_Attachments_getNumE...
D PR 10I 0
D extproc('+
D Provision+
D _Attachments_getNumE+
D ')
D i_uuid const like(wsdl_uuid_t )
D options(*nopass)
*
* Removes all attachments from the list of attachments of this web service.
D Provision_Attachments_removeAll...
D PR
D extproc('+
D Provision+
D _Attachments_removeAll+
D ')
D i_uuid const like(wsdl_uuid_t )
D options(*nopass)
*
* Specifies the name of the folder where to put attachments in.
D Provision_Attachments_setFolder...
D PR
D extproc('+
D Provision+
D _Attachments_setFolder+
D ')
D i_folder const like(wsdl_pathLong_t )
*
* Returns the name of the folder where attachments are stored.
D Provision_Attachments_getFolder...
D PR like(wsdl_pathLong_t )
D extproc('+
D Provision+
D _Attachments_getFolder+
D ')
*
/ENDIF
/IF DEFINED(PROTOTYPE_WS2PRVSN)
/EOF
/ENDIF
* ---------------------------------------------------------------------
*
* ------------------------------------
* Imported prototypes
* ------------------------------------
CPY /COPY QBASICS1,PBASICS1 Tools/400 Runtime Library
CPY /COPY QRPGLESRC,HTTPAPI_H HTTP-API Service Program
*
CPY /COPY QWSDL2RPG,PWSDL2R71 WSDL2RPG: HTTP Debug Log
CPY /COPY QWSDL2RPG,PWSDL2R89 WSDL2RPG: List of Attachments
*
2557 /define URL_LOGIN
2557 /COPY TFSCOPYSRC,NMS_PROTOS
2557 /undefine URL_LOGIN
* ------------------------------------
* Internal prototypes
* ------------------------------------
*
D getEndpoint...
D PR 32767A varying
D extproc('+
D getEndpoint+
D ')
*
D setEndpoint...
D PR
D extproc('+
D setEndpoint+
D ')
D i_url 32767A const varying options(*varsize)
*
* ------------------------------------
* Global fields & constants
* ------------------------------------
*
* Web service port name
D cWEB_SERVICE_PORT_NAME...
D C 'Provision'
*
* UUID of the web service as generated by WSDL2RPG
D cWEB_SERVICE_UUID...
D C '147034012D791968A35B0004AC101091'
*
* Default and current attachment folder
D cATTACHMENT_FOLDER...
D C '/tmp/attachments/'
*
* Default POST data CCSID (1208 = UTF-8)
D cPOST_DATA_CCSID...
D C 1208
*
* Web service endpoint as specified in the WSDL file.
D cURL C 'http://192.168.41.252:9090/axis/ser+
D vices/Provision'
*
* Web service endpoint
D g_url S 32767A varying inz(cURL)
*
* Proxy server to use
D g_proxy DS likeds(wsdl_proxy_t ) inz
*
* HTTPAPI debug settings
D g_httpDebug DS likeds(wsdl_httpDebug_t ) inz
*
* POST data CCSID (1208 = UTF-8)
D g_post_ccsid...
D S 10I 0 inz(cPOST_DATA_CCSID)
*
D g_attachmentFolder...
D S like(wsdl_pathLong_t )
D inz(cATTACHMENT_FOLDER)
*
* Web service 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_getLoginDataImpl...
D S * procptr inz
*
* 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 Provision_supplyLoginData...
D PR 10I 0
D extproc('+
D Provision+
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
*
* =====================================================================
* Web service: Returns the endpoint of the Web service
* =====================================================================
P Provision_Endpoint_get...
P B export
*
D Provision_Endpoint_get...
D PI 32767A varying
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
return getEndpoint();
/end-free
*
P Provision_Endpoint_get...
P E
*
* =====================================================================
* Web service: Sets the endpoint of the Web service
* =====================================================================
P Provision_Endpoint_set...
P B export
*
D Provision_Endpoint_set...
D PI
D i_url 32767A const varying options(*varsize)
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
setEndpoint(%subst(i_url: 1: %len(i_url)));
return;
/end-free
*
P Provision_Endpoint_set...
P E
*
* =====================================================================
* Web service: Returns the host name of the Web Service endpoint
* =====================================================================
P Provision_Endpoint_getHost...
P B export
*
D Provision_Endpoint_getHost...
D PI 32767A varying
*
D tmpUrl S like(url_t ) inz
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
tmpUrl = URL_new(getEndpoint());
return URL_getHost(tmpUrl);
/end-free
*
P Provision_Endpoint_getHost...
P E
*
* =====================================================================
* Web service: Sets the host name of the Web service endpoint
* =====================================================================
P Provision_Endpoint_setHost...
P B export
*
D Provision_Endpoint_setHost...
D PI
D i_host 32767A const varying options(*varsize)
*
D tmpUrl S like(url_t ) inz
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
tmpUrl = URL_new(getEndpoint());
URL_setHost(tmpUrl: %subst(i_host: 1: %len(i_host)));
setEndpoint(URL_toString(tmpUrl));
return;
/end-free
*
P Provision_Endpoint_setHost...
P E
*
* =====================================================================
* Web service: Returns the port of the Web Service endpoint
* =====================================================================
P Provision_Endpoint_getPort...
P B export
*
D Provision_Endpoint_getPort...
D PI 10I 0
*
D tmpUrl S like(url_t ) inz
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
tmpUrl = URL_new(getEndpoint());
return URL_getPort(tmpUrl);
/end-free
*
P Provision_Endpoint_getPort...
P E
*
* =====================================================================
* Web service: Sets the port of the Web service endpoint
* =====================================================================
P Provision_Endpoint_setPort...
P B export
*
D Provision_Endpoint_setPort...
D PI
D i_port 10I 0 const
*
D tmpUrl S like(url_t ) inz
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
tmpUrl = URL_new(getEndpoint());
URL_setPort(tmpUrl: i_port);
setEndpoint(URL_toString(tmpUrl));
return;
/end-free
*
P Provision_Endpoint_setPort...
P E
*
* =====================================================================
* Web service: Initializes the web service port.
* =====================================================================
P Provision_Port_initialize...
P B export
*
D Provision_Port_initialize...
D PI
D i_operName const like(wsdl_operName_t )
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
// This procedure is called from every web service
// operation right at the beginning of the operation.
// This procedure may be used to perform any type
// of initialization that is the same for all web
// service operations.
// For eample you may want to register a procedure
// to supply login credentials.
B01 if (not Provision_Port_hasLoginCallback());
Provision_Port_registerLoginCallback(
%paddr('+
Provision_supplyLoginData+
'));
E01 endif;
return;
/end-free
*
P Provision_Port_initialize...
P E
*
* =====================================================================
* Web service: Supplies login credentials for web services that
* require BASIC or DIGEST authentication.
* =====================================================================
P Provision_supplyLoginData...
P B export
*
D Provision_supplyLoginData...
D PI 10I 0
D i_authType 14A const varying
D i_realm 126A const varying
D i_numAttempts 10I 0 const
D o_user 50A varying
D o_password 50A varying
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
// This procedure is called when a web service requires
// BASIC or DIGEST authentication.
// You may use the realm value for reading the credentials
// from a file.
clear USR0048;
USR00481 = f_this();
AppMsg_sendCancelMsg(AppMsg_newError('USR0048': USR0048));
return WSDL_ERROR;
/end-free
*
P Provision_supplyLoginData...
P E
*
* =====================================================================
* Web service: Sets the proxy server to use for the connection
* =====================================================================
P Provision_Port_setHttpProxy...
P B export
*
D Provision_Port_setHttpProxy...
D PI
D i_server 256A const
D i_port 10I 0 const
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
g_proxy.server = i_server;
B01 if (g_proxy.server = '');
g_proxy.port = 0;
X01 else;
g_proxy.port = i_port;
E01 endif;
return;
/end-free
*
P Provision_Port_setHttpProxy...
P E
*
* =====================================================================
* Web service: Returns the proxy server to use for the connection
* =====================================================================
P Provision_Port_getHttpProxy...
P B export
*
D Provision_Port_getHttpProxy...
D PI likeds(wsdl_proxy_t )
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
return g_proxy;
/end-free
*
P Provision_Port_getHttpProxy...
P E
*
* =====================================================================
* Web service: Enables/disables the debug log of HTTP API
* =====================================================================
P Provision_Port_setHttpDebug...
P B export
*
D Provision_Port_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;
B01 if (%parms() >= p_fileName);
g_httpDebug.fileName = i_fileName;
X01 else;
g_httpDebug.fileName = HTTP_API_DEFAULT_LOG_FILE;
E01 endif;
B01 if (i_status);
http_DebugLog_open(g_httpDebug.fileName);
X01 else;
http_DebugLog_close();
E01 endif;
return;
/end-free
*
P Provision_Port_setHttpDebug...
P E
*
* =====================================================================
* Web service: Returns the HTTP API debug settings
* =====================================================================
P Provision_Port_getHttpDebug...
P B export
*
D Provision_Port_getHttpDebug...
D PI likeds(wsdl_httpDebug_t )
*
* Parameter positions
D p_fileName C 2
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
B01 if (g_httpDebug.fileName = '');
g_httpDebug.fileName = HTTP_API_DEFAULT_LOG_FILE;
E01 endif;
return g_httpDebug;
/end-free
*
P Provision_Port_getHttpDebug...
P E
*
* =====================================================================
* Web service: Sets the CCSID used for POST data.
* =====================================================================
P Provision_Port_setPostCcsid...
P B export
*
D Provision_Port_setPostCcsid...
D PI
D i_post_ccsid 10I 0 const
*
* Parameter positions
D p_fileName C 2
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
g_post_ccsid = i_post_ccsid;
return;
/end-free
*
P Provision_Port_setPostCcsid...
P E
*
* =====================================================================
* Web service: Returns the CCSID used for POST
* =====================================================================
P Provision_Port_getPostCcsid...
P B export
*
D Provision_Port_getPostCcsid...
D PI 10I 0
*
* Parameter positions
D p_fileName C 2
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
return g_post_ccsid;
/end-free
*
P Provision_Port_getPostCcsid...
P E
*
* =====================================================================
* Web service: Clears all error information.
* =====================================================================
P Provision_Port_clearErrors...
P B export
*
D Provision_Port_clearErrors...
D PI
D io_errors likeds(wsdl_errors_t )
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
clear g_errors;
g_errors.errType = WSDL_HTTP_SUCCESS;
io_errors = g_errors;
return;
/end-free
*
P Provision_Port_clearErrors...
P E
*
* =====================================================================
* Web service: Sets error information of last service call.
* =====================================================================
P Provision_Port_setErrors...
P B export
*
D Provision_Port_setErrors...
D PI
D i_errors const likeds(wsdl_errors_t )
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
g_errors = i_errors;
return;
/end-free
*
P Provision_Port_setErrors...
P E
*
* =====================================================================
* Http: Returns the last HTTP error (code) that occurred.
* =====================================================================
P Provision_Port_isError...
P B export
*
D Provision_Port_isError...
D PI N
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
B01 if (g_errors.errType = WSDL_HTTP_SUCCESS);
return cFalse;
X01 else;
return cTrue;
E01 endif;
/end-free
*
P Provision_Port_isError...
P E
*
* =====================================================================
* Http: Returns the last HTTP error (code) that occurred.
* =====================================================================
P Provision_HttpError_getCode...
P B export
*
D Provision_HttpError_getCode...
D PI like(wsdl_http_ErrorNo_t )
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
return g_errors.httpError.no;
/end-free
*
P Provision_HttpError_getCode...
P E
*
* =====================================================================
* Http: Returns the last HTTP error (text) that occurred.
* =====================================================================
P Provision_HttpError_getText...
P B export
*
D Provision_HttpError_getText...
D PI like(wsdl_http_ErrorText_t)
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
return g_errors.httpError.text;
/end-free
*
P Provision_HttpError_getText...
P E
*
* =====================================================================
* Soap: Returns the last SOAP error (code) that occurred.
* =====================================================================
P Provision_SoapError_getCode...
P B export
*
D Provision_SoapError_getCode...
D PI like(wsdl_soap_faultcode_t )
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
return g_errors.soapFault.code;
/end-free
*
P Provision_SoapError_getCode...
P E
*
* =====================================================================
* Soap: Returns the last SOAP error (text) that occurred.
* =====================================================================
P Provision_SoapError_getText...
P B export
*
D Provision_SoapError_getText...
D PI like(wsdl_soap_faultstring_t)
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
return g_errors.soapFault.string;
/end-free
*
P Provision_SoapError_getText...
P E
*
* =====================================================================
* XML: Returns the last XML error (code) that occurred.
* =====================================================================
P Provision_XmlError_getCode...
P B export
*
D Provision_XmlError_getCode...
D PI like(wsdl_xml_ErrorNo_t )
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
return g_errors.xmlError.code;
/end-free
*
P Provision_XmlError_getCode...
P E
*
* =====================================================================
* XML: Returns the last XML error (text) that occurred.
* =====================================================================
P Provision_XmlError_getText...
P B export
*
D Provision_XmlError_getText...
D PI like(wsdl_xml_ErrorText_t )
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
return g_errors.xmlError.text;
/end-free
*
P Provision_XmlError_getText...
P E
*
* =====================================================================
* Registers an user callback procedure, that is called whenever
* a web service requires user authentification.
* =====================================================================
P Provision_Port_registerLoginCallback...
P B export
*
D Provision_Port_registerLoginCallback...
D PI
D D i_pLoginProc * value procptr
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
g_getLoginDataImpl = i_pLoginProc;
return;
/end-free
*
P Provision_Port_registerLoginCallback...
P E
*
* =====================================================================
* Returns *ON if a login procedures has been registered.
* =====================================================================
P Provision_Port_hasLoginCallback...
P B export
*
D Provision_Port_hasLoginCallback...
D PI N
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
B01 if (g_getLoginDataImpl <> *NULL);
return *ON;
E01 endif;
return *OFF;
/end-free
*
P Provision_Port_hasLoginCallback...
P E
*
* =====================================================================
* Login to proxy server or web service.
* =====================================================================
P Provision_Port_login...
P B export
*
D Provision_Port_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
*
D getLoginDataImpl...
D PR 10I 0
D extproc(g_getLoginDataImpl)
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
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
B01 if (i_http_err = HTTP_NDAUTH);
http_getauth(basic: digest: realm);
authType = WSDL_AUTH_TYPE_HTTP;
X01 else;
http_proxy_getauth(basic: realm);
authType = WSDL_AUTH_TYPE_PROXY;
E01 endif;
rc = getLoginDataImpl(authType: realm
: i_numAttempts: userid: password);
B01 if (rc <> 1);
userid = '';
password = '';
return rc;
E01 endif;
B01 if (i_http_err = HTTP_NDAUTH);
B02 if (digest);
http_setAuth(HTTP_AUTH_MD5_DIGEST
: userid: password);
X02 else;
http_setAuth(HTTP_AUTH_BASIC
: userid: password);
E02 endif;
X01 else;
B02 if (digest);
http_proxy_setAuth(HTTP_AUTH_MD5_DIGEST
: userid: password);
X02 else;
http_proxy_setAuth(HTTP_AUTH_BASIC
: userid: password);
E02 endif;
E01 endif;
userid = '';
password = '';
return rc;
/end-free
*
P Provision_Port_login...
P E
*
* =====================================================================
* Returns the name of the web service port.
* =====================================================================
P Provision_Port_getName...
P B export
*
D Provision_Port_getName...
D PI like(wsdl_portName_t )
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
return cWEB_SERVICE_PORT_NAME;
/end-free
*
P Provision_Port_getName...
P E
*
* =====================================================================
* Returns the UUID of the web service port.
* =====================================================================
P Provision_Port_getUuid...
P B export
*
D Provision_Port_getUuid...
D PI like(wsdl_uuid_t )
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
return cWEB_SERVICE_UUID;
/end-free
*
P Provision_Port_getUuid...
P E
*
* =====================================================================
* Adds an attachments to the list of attachments.
* =====================================================================
P Provision_Attachments_put...
P B export
*
D Provision_Attachments_put...
D PI
D i_attachmentID...
D const like(wsdl_attachmentID_t )
D i_fileName const like(wsdl_path_t )
D i_uuid const like(wsdl_uuid_t )
D options(*nopass)
*
D p_uuid C 3
*
D uuid S like(i_uuid ) inz
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
B01 if (%parms() >= p_uuid);
uuid = i_uuid;
X01 else;
uuid = Provision_Port_getUuid();
E01 endif;
Attachments_put(Attachments_theInstance()
: uuid
: i_attachmentID
: i_fileName);
return;
/end-free
*
P Provision_Attachments_put...
P E
*
* =====================================================================
* Returns the file name of the attachment that is associated to
* a given content ID.
* =====================================================================
P Provision_Attachments_get...
P B export
*
D Provision_Attachments_get...
D PI like(wsdl_path_t )
D i_attachmentID...
D const like(wsdl_attachmentID_t )
D i_uuid const like(wsdl_uuid_t )
D options(*nopass)
*
D p_uuid C 2
*
D uuid S like(i_uuid ) inz
D fileName S like(wsdl_path_t ) inz
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
B01 if (%parms() >= p_uuid);
uuid = i_uuid;
X01 else;
uuid = Provision_Port_getUuid();
E01 endif;
fileName = Attachments_get(Attachments_theInstance()
: uuid
: i_attachmentID);
return fileName;
/end-free
*
P Provision_Attachments_get...
P E
*
* =====================================================================
* Returns the file name of the attachment that is associated to
* a given index.
* =====================================================================
P Provision_Attachments_getAtPos...
P B export
*
D Provision_Attachments_getAtPos...
D PI likeds(wsdl_attachment_t )
D i_index 10I 0 const
D i_uuid const like(wsdl_uuid_t )
D options(*nopass)
*
D p_uuid C 2
*
D uuid S like(i_uuid ) inz
D attachment DS likeds(wsdl_attachment_t ) inz
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
B01 if (%parms() >= p_uuid);
uuid = i_uuid;
X01 else;
uuid = Provision_Port_getUuid();
E01 endif;
attachment = Attachments_getAtPos(Attachments_theInstance()
: uuid
: i_index);
return attachment;
/end-free
*
P Provision_Attachments_getAtPos...
P E
*
* =====================================================================
* Returns the number of attachments that were downloaded with
* the last call of the web service.
* =====================================================================
P Provision_Attachments_getNumE...
P B export
*
D Provision_Attachments_getNumE...
D PI 10I 0
D i_uuid const like(wsdl_uuid_t )
D options(*nopass)
*
D p_uuid C 1
*
D uuid S like(i_uuid ) inz
D numE S 10I 0 inz
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
B01 if (%parms() >= p_uuid);
uuid = i_uuid;
X01 else;
uuid = Provision_Port_getUuid();
E01 endif;
numE = Attachments_getNumAttachments(
Attachments_theInstance(): uuid);
return numE;
/end-free
*
P Provision_Attachments_getNumE...
P E
*
* =====================================================================
* Removes all attachments from the list of attachments of
* this web service.
* =====================================================================
P Provision_Attachments_removeAll...
P B export
*
D Provision_Attachments_removeAll...
D PI
D i_uuid const like(wsdl_uuid_t )
D options(*nopass)
*
D p_uuid C 1
*
D uuid S like(i_uuid ) inz
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
B01 if (%parms() >= p_uuid);
uuid = i_uuid;
X01 else;
uuid = Provision_Port_getUuid();
E01 endif;
Attachments_removeAll(Attachments_theInstance(): uuid);
return;
/end-free
*
P Provision_Attachments_removeAll...
P E
*
* =====================================================================
* Specifies the name of the folder where to put attachments in.
* =====================================================================
P Provision_Attachments_setFolder...
P B export
*
D Provision_Attachments_setFolder...
D PI
D i_folder const like(wsdl_pathLong_t )
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
g_attachmentFolder = i_folder;
g_attachmentFolder = %trimR(%xlate('Ö': '/': g_attachmentFolder));
B01 if (not f_endsWith('/': g_attachmentFolder));
g_attachmentFolder = g_attachmentFolder + '/';
E01 endif;
return;
/end-free
*
P Provision_Attachments_setFolder...
P E
*
* =====================================================================
* Returns the name of the folder where attachments are stored.
* =====================================================================
P Provision_Attachments_getFolder...
P B export
*
D Provision_Attachments_getFolder...
D PI like(wsdl_pathLong_t )
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
return g_attachmentFolder;
/end-free
*
P Provision_Attachments_getFolder...
P E
*
* =====================================================================
* Internal procedure to get the endpoint.
* =====================================================================
P getEndpoint...
P B
*
D getEndpoint...
D PI 32767A varying
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
2557 g_url = BuildURLfromEPequipmnt(cWEB_SERVICE_PORT_NAME : cTrue);
2557 if g_url = 'ERROR';
2557 // unable to build the URL from the EPequipmnt record.
2557 // Use the default value in the cURL constant;
2557 g_url = cURL;
2557 endif;
return g_url;
/end-free
*
P getEndpoint...
P E
*
* =====================================================================
* Internal procedure to set the endpoint.
* =====================================================================
P setEndpoint...
P B
*
D setEndpoint...
D PI
D i_url 32767A const varying options(*varsize)
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
g_url = %subst(i_url: 1: %len(i_url));
/end-free
*
P setEndpoint...
P E
*
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------