[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Green Screen request
Sender: "Rick Hill" <rhill@xxxxxxxxxxxxxxxxxxxx>
Hi Jere,
Here is a sample program - it sends a soap request - in turn receives the data
Hope this helps
H DFTACTGRP(*NO) ACTGRP(*NEW) BNDDIR('LIBHTTP/HTTPAPI')
D/copy libhttp/qrpglesrc,httpapi_h
D translate PR ExtPgm('QDCXLATE')
D length 5P 0 const
D data 32766A options(*varsize)
D table 10A const
D incoming PR 10I 0
D descriptor 10I 0 value
D data 8192A options(*varsize)
D datalen 10I 0 value
D parsedata PR 1024A
D searchdata 32766A const
D varname 20A const
D rc s 10I 0
D msg s 52A
D CRLF C CONST(x'0d25')
D data S 2048A
D nextpos S 10I 0 inz(1)
D TOKEN S 40
D retdata S 32766A
D retlen S 10I 0
D ReturnMsg S 52 INZ(*BLANKS)
D ReturnCode S 10 INZ(*BLANKS)
D ReturnRFee S 8 INZ(*BLANKS)
D ReturnLFee S 8 INZ(*BLANKS)
D ReturnRef# S 20 INZ(*BLANKS)
C eval data = '<?xml version="1.0"' +
C ' encoding="UTF-8" ?>' + CRLF +
C '<soap:Envelope xmlns' +
C ':xsi="http://www.w3.org' +
C '/2001/XMLSchema-instance" '+
C 'xmlns:xsd="http://www.w3.org'+
C '/2001/XMLSchema" xmlns:soap="http://' +
C 'schemas.xmlsoap.org/' +
C 'soap/envelope/">' + CRLF +
C '<soap:Body>' + CRLF +
C '<Execute xmlns="http' +
C '://test.scdmvonline.com/CIDR/Step1">' +
C CRLF + '<RequestMsgData>' + CRLF +
C '<SecurityToken>' +
C TOKEN +
C '</SecurityToken>' + CRLF +
C '<CountyID>' +
C %Editc(HTCNTY: 'X') +
C '</CountyID>' + CRLF +
C '<CountyDate>' +
C %Editc(HTTRDT: 'X') +
C '</CountyDate>' + CRLF +
C '<CountyTime>' +
C %Editc(HTTRTM: 'X') +
C '</CountyTime>' + CRLF +
C '<CountyOID>' +
C %Trim(HTOPID) +
C '</CountyOID>' + CRLF +
C '<PaymentDate>' +
C %Editc(HTRCDT: 'X') +
C '</PaymentDate>' + CRLF +
C '<VIN>' +
C %Trim(HTVIN) +
C '</VIN>' + CRLF +
C '<VehicleMake>' +
C %Trim(HTMAKE) +
C '</VehicleMake>' + CRLF +
C '<ExpireMonth>' +
C %Editc(HTEXMO:'X') +
C '</ExpireMonth>' + CRLF +
C '<VehicleType>' +
C %Trim(HTVTYP) +
C '</VehicleType>' + CRLF +
C '<PlateClass>' +
C %Trim(HTPCLS) +
C '</PlateClass>' + CRLF +
C '<VehicleWeight>' +
C %Editc(HTWGHT:'X') +
C '</VehicleWeight>' + CRLF +
C '<VehicleGVW>' +
C %Trim(HTGVW) +
C '</VehicleGVW>' + CRLF +
C '<OwnerName>' +
C %Trim(ownnam) +
C '</OwnerName>' + CRLF +
C '<OwnerAddr>' +
C %Trim(ownadd) +
C '</OwnerAddr>' + CRLF +
C '<OwnerCity>' +
C %Trim(owncity) +
C '</OwnerCity>' + CRLF +
C '<OwnerState>' +
C %Trim(HTOST) +
C '</OwnerState>' + CRLF +
C '<OwnerZip>' +
C %EditC(HTOZIP:'X') +
C '</OwnerZip>' + CRLF +
C '<AddrChangeFlag>' +
C %Trim(AdrChgFlag) +
C '</AddrChangeFlag>' + CRLF +
C '<ChangeAddress>' +
C %Trim(newadd) +
C '</ChangeAddress>' + CRLF +
C '<ChangeCity>' +
C %Trim(newcity) +
C '</ChangeCity>' + CRLF +
C '<ChangeState>' +
C %Trim(HTNST) +
C '</ChangeState>' + CRLF +
C '<ChangeZip>' +
C %Editc(HTNZIP:'X') +
C '</ChangeZip>' + CRLF +
C '<ChangeTaxDistrict>' +
C %Trim(HTNDST) +
C '</ChangeTaxDistrict>' + CRLF +
C '<TaxPaidFlag>' +
C %Trim(HTTAX) +
C '</TaxPaidFlag>' + CRLF +
C '<InsInfoFlag>' +
C %Trim(HTINS) +
C '</InsInfoFlag>' + CRLF +
C '<RegFee>' +
C %Editw(HTRFEE:'0 . ') +
C '</RegFee>' + CRLF +
C '<SpName>' +
C %Trim(spcnam) +
C '</SpName>' + CRLF +
C '<SpAddress>' +
C %Trim(spcadd) +
C '</SpAddress>' + CRLF +
C '<SpCity>' +
C %Trim(spccity) +
C '</SpCity>' + CRLF +
C '<SpState>' +
C %Trim(HTSST) +
C '</SpState>' + CRLF +
C '<SpZip>' +
C %Trim(HTSZIP) +
C '</SpZip>' + CRLF +
C '<RefNumber>' +
C %Trim(HTREF#) +
C '</RefNumber>' + CRLF +
C '</RequestMsgData>' + CRLF +
C '</Execute>' + CRLF +
C '</soap:Body>' + CRLF +
C '</soap:Envelope>'
c eval rc=http_url_post_raw(
C 'http://test.scdmvonline.com/+
C CIDR/Step1.asmx':
C %addr(data): %len(%trimr(data)):
c 1: %paddr('INCOMING'):
C 120 :'Mozilla/5.0 (X11; U; OS400)'
C : 'text/xml' :
C 'http://test.scdmvonline.com/+
C CIDR/Step1/Execute')
C if rc <> 1
C eval msg = http_error
C dsply msg
C return
C endif
C* convert the data we just received to EBCDIC
c if retlen > 1
c callp Translate(retlen: retdata: 'QTCPEBC')
c endif
C* now the returned data is in the 'retdata' string.
C* run this program in debug and display retdata.... you'll see...
*
* Retrieve Return Values
*
C Eval ReturnMsg = parsedata(retdata:'Message')
C Eval ReturnCode = parsedata(retdata:'ReturnCode')
C Eval ReturnRfee = parsedata(retdata:'RenewalFee')
C Eval ReturnLfee = parsedata(retdata:'DMVLateFee')
C Eval ReturnRef# = parsedata(retdata:'RefNumber')
C* ReturnMsg Dsply
C* ReturnCode Dsply
C* ReturnRfee Dsply
C* ReturnLfee Dsply
C* ReturnRef# Dsply
C eval *inlr = *on
P*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
P* this procedure will receive the raw data received
P*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
P incoming B
D incoming PI 10I 0
D descriptor 10I 0 value
D data 8192A options(*varsize)
D datalen 10I 0 value
c eval nextpos = 1
C* Make sure we don't overflow the string:
c eval retlen = (nextpos + datalen) - 1
c if retlen > %size(retdata)
c eval datalen=datalen-(%size(retdata)-retlen)
c endif
c* If there is nothing to write, return THAT...
c if datalen < 1
c return 0
c endif
C* Here we add any data sent to the end of our 'retdata' string:
c eval %subst(retdata: nextpos) =
c %subst(data:1:datalen)
c eval nextpos = nextpos + datalen
c* We always return the amount of data that we wrote. Note
C* that if http-api sees that we didn't write as much data as
C* it sent us, it'll abort the process with an error message.
c return datalen
P E
P*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
P* this procedure will parse xml data for variable name
P*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
P parsedata B
D parsedata PI 1024A
D searchdata 32766A const
D varname 20A const
D strvar S 25
D endvar S 25
D strfind S 10I 0
D endfind S 10I 0
D returndta S 1024A
* build start variable <variable>
* build end variable </variable>
C Eval Strvar = *Blanks
C Eval Endvar = *Blanks
C Eval returndta = *Blanks
C Eval Strvar = '<' + %trim(varname) + '>'
C Eval Endvar = '</' + %trim(varname) + '>'
* find beginning position / ending position
* return data in these positions
C Eval StrFind = %Scan(%Trim(Strvar):searchdata)
C Eval StrFind = Strfind + %len(%Trim(Strvar))
C Eval EndFind = %Scan(%Trim(Endvar):searchdata)
C Eval Returndta = %Subst(searchdata:StrFind:
C EndFind - StrFind)
c return Returndta
P E
-----Original Message-----
From: owner-ftpapi@xxxxxxxxxxxxx [mailto:owner-ftpapi@xxxxxxxxxxxxx]On
Behalf Of Jere Jackson
Sent: Tuesday, July 20, 2004 9:54 AM
To: ftpapi@xxxxxxxxxxxxx
Subject: Re: Green Screen request
Sender: "Jere Jackson" <jjackson@xxxxxxxxx>
I have, the problem I see is that all of his examples send a request and
get a file back. I don't need a file I need the response to come back
into the program. I also looked at the socket utilities but I still
don't understand exactly how to do what I need. If I could see an
example of this I can take it and run with it.
Jere Jackson
System Analyst
Ducks Unlimited, Inc
One Waterfowl Way
Memphis, TN 38120-2351
www.ducks.org
jjackson@xxxxxxxxx
Phone (901) 758-3895
Fax (901) 758-3850
>>> michaelr_41@xxxxxxxxxxxxxx 07/19/04 6:10 PM >>>
Sender: michaelr_41@xxxxxxxxxxxxxx
Check out http://www.scottklement.com/httpapi/
On Mon, 19 Jul 2004 15:42:04 -0500, "Jere Jackson"
<jjackson@xxxxxxxxx><~!B*+R^&>said:<~!B*+R^&>> Sender: "Jere Jackson"
<jjackson@xxxxxxxxx><~!B*+R^&>>
> I have an order entry program that needs to verify the PO number by
> sending an HTML request to another system and wait for a response from
> the called system. I have the URL of the other system that will verify
> the PO number. This is the first time I have tried to do anything like
> this. I am not sure how to put the calls in the program for the APIs
> that I need. Does anyone have an example of this? I don't want to
write
> anything to a file or read from a file, all I am trying to do is
execute
> the URL and check the response from the called program.
>
> Thanks
>
> Jere
>
> Jere Jackson
> System Analyst
> Ducks Unlimited, Inc
> One Waterfowl Way
> Memphis, TN 38120-2351
> www.ducks.org
> jjackson@xxxxxxxxx
> Phone (901) 758-3895
> Fax (901) 758-3850
>
>
-----------------------------------------------------------------------
> This is the FTPAPI mailing list. To unsubsribe from the list send
mail
> to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi
mymailaddr
>
-----------------------------------------------------------------------
--
michaelr_41@xxxxxxxxxxxxxx
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------