[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: https with userid and password
Scott,
Taking in consideration the fact that the xml request is less then 6k and
the fact that I did not want to use user space or memory allocation, I have
created a new version of the program. I load the xml in a program variable.
Do you mind having a quick look at my code before the call to http_url_post?
Thanks
Adriana
-----Original Message-----
From: owner-ftpapi@xxxxxxxxxxxxx [mailto:owner-ftpapi@xxxxxxxxxxxxx] On
Behalf Of Scott Klement
Sent: Tuesday, January 03, 2006 2:14 PM
To: 'ftpapi@xxxxxxxxxxxxx'
Subject: RE: https with userid and password
Sender: Scott Klement <sk@xxxxxxxxxxxxxxxx>
Hi,
You appear to be getting back garbage in the response. I don't know why
this would happen, I'm guessing that you're getting disconnected prior to
receiving the whole reply from the server.
To fix the "length or start position" error, can you try changing the
following line (from your debug):
> 4162 callp
SetError(HTTP_RESP:%subst(peRespChain:1:
> 4163 %scan(CR:peRespChain)-1) )
So that it looks like this, instead?
c if %scan(CR:peRespChain) > 1
c callp SetError(HTTP_RESP: %subst(peRespChain:1:
c %scan(CR:peRespChain)-1) )
c else
c callp SetError(HTTP_RESP: peRespChain)
c endif
It should go back to givign you a 500 error, rather than crashing, when
that happens.
Regardng the source you sent me.... it appears to be a PDF of a printout
of your source file. That doesn't help me. Just to be clear: I'm not
looking to print out your source member. I want to be able to compile and
run it so that I can see the errors as they happen.
Since I don't want to print your source member and re-type it, can you
please send the source member as a .TXT file? Containing only the source,
nothing else? (No line numbers, page headings, or anything like that?)
One easy way to get this is to FTP the member to your PC in ASCII mode.
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------
-------------------------------------------------------------------------------------
Email Confidentiality Notice and Disclaimer
This email message contains information which may be confidential and
or legally privileged. Unless you are the intended recipient (or have
been authorised to receive on behalf of the intended recipient), you
may not use, copy or disclose to anyone the message or any information
contained in the message or from any attachments that were sent with
this email. If you have received this email message in error, please
advise the sender by email, and delete the message.
All business and transactions of whatsoever nature be it as agent or
as principal with any party whatsoever shall solely be conducted in
accordance with our Standard Trading Conditions. These conditions have
clauses that may limit our liability. A copy of our Standard Terms is
available on request. When an air waybill or bill of lading or any
other international consignment note is issued, the conditions that
apply for such a document will be in addition to our Standard Trading
Conditions, and for the relative air or sea or other mode of transport
leg / movement only, they will be paramount.
-------------------------------------------------------------------------------------
F*-------------------------------------------------------------------|
F* Program: DPCSOCKET2 Title: Denied Party socket to FCS |
F* Date: 01/03/06 Programmer: AS_UT |
F*-------------------------------------------------------------------|
H DFTACTGRP(*NO) ACTGRP(*NEW) BNDDIR('LIBHTTP/HTTPAPI') BNDDIR('QC2LE')
H OPTION(*nodebugio:*srcstmt)
*---------------------------------------------------------------------
**
** This program uses HTTPS POST operation with data from a stream file.
** The Outbound xml file is sent to FCS and the Inbound xml file
** is received.
*---------------------------------------------------------------------
D/copy libhttp/qrpglesrc,httpapi_h
D/copy libhttp/qrpglesrc,ifsio_h
D/copy libhttp/qrpglesrc,errno_h
D/copy libhttp/qrpglesrc,private_h
D cmd pr extpgm('QCMDEXC')
D command 200A const
D length 15P 5 const
D rc s 10I 0
D url s 32767A varying
D WorkData s 32767A varying
D p_data S *
D Empty S 1a inz(' ')
D DataLen S 10i 0
D mystat S like(statds)
D stmf S 256A
D instmf S 256A
D sf s 10I 0
D Ref# s 12
D Error s 2
D userid S 50A
D pass S 50A
D wwEncLen S 10i 0
D wwEncoded S 32767A
*---------------------------------------------------------------------
c *entry plist
c parm Ref#
c parm Error
c eval *inlr = *on
** whatever data is in this stream file will
** be POSTed to the URL below.
c eval stmf = '/UTi_XML/FCS'
c + '/tmp/Outbound'
c + %trim(Ref#)
c + '.xml'
c exsr GetStmfSiz
c if st_size < 32000
c exsr GetStmfData
c exsr Signon
c callp http_xlatep(DataLen:p_data:TO_ASCII)
c eval wwEncLen = base64_encode(p_data:
c DataLen:
c %addr(wwEncoded):
c %size(wwEncoded))
c eval url = 'https://apps2.tradegate2000.com'
c + '/import2000deniedparties/dp_xml'
c + '_process.cgi?'
c + %subst(wwEncoded:1:wwEncLen)
c eval instmf = '/UTi_XML/FCS/tmp/Inbound'
c + %trim(Ref#)
c + '.xml'
c eval rc = http_url_post(url:
c %addr(Empty):
c %len(Empty):
c instmf)
c if rc <> 1
* Error call http_utl_post. It can be failed connection to FCS
c move '01' Error
c endif
c end
c return
*---------------------------------------------------------------------
C* Get stream file size. The resulting size (from the stat DS)
C* will be placed in the ST_SIZE variable.
*---------------------------------------------------------------------
c GetStmfSiz begsr
c eval p_statds = %addr(mystat)
c if stat(%trimr(stmf): %addr(mystat)) <> 0
* Can't find outbound stream file
c move '02' Error
c return
c endif
c endsr
*---------------------------------------------------------------------
C* Copy all of the data from the stream file to program variable
*---------------------------------------------------------------------
c GetStmfData begsr
c eval p_data = %addr(WorkData)
c eval %len(WorkData) = st_size
c eval DataLen = %len(WorkData) + 4
c eval sf = open(%trimr(stmf):
c O_RDONLY + O_TEXTDATA)
c if sf < 0
* Cannot open Outbound file
c move '04' Error
c return
c endif
c if read(sf: p_data: st_size) < st_size
* Unable to read the entire outbound file
c callp close(sf)
c move '05' Error
c return
c endif
c callp close(sf)
c eval WorkData = 'xml=<?' + %trimr(WorkData)
c endsr
*---------------------------------------------------------------------
C* HTTPS requires userid and password
*---------------------------------------------------------------------
c Signon begsr
c eval userid = 'utieditestuser'
c eval pass = 'usertestediuti'
c callp http_setauth(HTTP_AUTH_BASIC:
c userid: pass)
c endsr
*---------------------------------------------------------------------
/define ERRNO_LOAD_PROCEDURE
/copy libhttp/qrpglesrc,errno_h