[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problem with HTTPS POST REQUEST
Hi all,
I m posting this message and i hope to find some help within the
LIBHTTP communauty.
My problem is quite simple. My customer must send an HTTPS
POST REQUEST to UPS for shipping. UPS give us the PLD format of such a
message and, to be honst, i don t know how to send th e request.
I send you the whole code of my app, based on the LIBHTTP HTTPS POST
example. I change the data to make the message, but i m sure that
something goes wrong. As i put some informations in the data area,
which must be in wrapper (Content-Type, Content-Length). but i find
nothin (but i m still working on it :p) in the tutorial to make
headers for HTTP request :(
Do you have any ideas?
Thanks in advance for comments.
Bruno
H DFTACTGRP(*NO) ACTGRP(*NEW) BNDDIR('HTTPAPI')
D /copy qrpglesrc,httpapi_h
D cmd pr extpgm('QCMDEXC')
D command 200 A const
D length 15 P 5 const
D rc s 10 I 0
D msg s 52 A
D CRLF C CONST(x'0d25')
D data S 4096 A varying
D long S 10 0
c eval *inlr = *on
/free
data = 'POST /hapld/tos/kdwhapltos HTTP/1.1'+CRLF;
data = data + 'Host: www.pld-certify.ups.com'+CRLF;
data = data + 'Content-type: multipart/mixed; boundary=BOUNDARY'+CRLF;
data = data + 'Content-length: 1040'+CRLF+CRLF;
data = data + '--BOUNDARY'+CRLF;
data = data + 'Content-type: application/x-www-form-urlencoded'+CRLF;
data = data + 'Content-length: 140'+CRLF+CRLF;
data = data + 'AppVersion=1.0&AcceptUPSLicenseAgreement=Yes&';
data = data + 'ResponseType=application/x-ups-pld&VersionNumber=';
data = data + 'V4R1&UserId=useridvalue&Password=passwordvalue'+CRLF;
data = data +CRLF;
data = data + '--BOUNDARY'+CRLF;
data = data + 'Content-type: application/x-ups-binary'+CRLF;
data = data + 'Content-length: 719'+CRLF+CRLF;
data = data + '020094 2.0 ';
data = data + '2007021700000000000010500 000000001*AA0A1754 US';
data = data + '1234567002000001*BA1z1234560100002352';
data = data + ' 00001+0000000000000010 +000';
data = data + '0000000000000LBS01PRE10';
data = data + ' 3INUSD000001';
data = data + '*CA18ATTENTION';
data = data + 'DELIVERY ';
data = data = '234 SOME LOCAL ST';
data=data+' ';
data = data + ' ';
data = data + 'SOME CITY NJ ';
data = data + '07652 US12015551212';
data = data + ' ';
data = data + '*PA1z1234560100002352';
data = data + ' 02+0000010';
data=data+' ';
data = data + ' ';
data = data + '+0000010 ';
data = data + '*SA000004'+CRLF+CRLF;
data = data + '--BOUNDARY--'+CRLF;
/end-free
C ** The only diff between using HTTPS and using HTTP is
C ** the URL that we pass. It starts with 'https://'
C eval long = %len(data)
C long DSPLY
c eval rc=http_url_post(
c 'https://www.pld-certify.ups.com/':
c * 'hapld/tos/kdwhapltos':
c %addr(data): %len(%trimr(data)):
c '/tmp/httptest.html')
c if rc <> 1
c eval msg = http_error
c dsply msg
c return
c endif
** This should be the XML data that UPS returns to us:
c callp cmd('DSPF ''/tmp/httptest.html''': 200)
c return
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------