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

RE: https with userid and password



No problem, here it is.
Thanks for your help.
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: DPCSOCKET1      Title: Denied Party socket to FCS        |
     F* Date: 12/30/05           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 cmd             pr                  extpgm('QCMDEXC')
     D  command                     200A   const
     D  length                       15P 5 const

      *
      * Create User Space API
      *
     D QUSCRTUS        PR                  ExtPgm('QUSCRTUS')
     D   UserSpc                     20A   const
     D   ExtAttr                     10A   const
     D   InitSize                    10I 0 const
     D   InitVal                      1A   const
     D   PublicAuth                  10A   const
     D   Text                        50A   const
     D   Replace                     10A   const
     D   ErrorCode                32766A   options(*varsize)

      *
      * retrieve pointer to user space API
      *
     D QUSPTRUS        PR                  ExtPgm('QUSPTRUS')
     D   UserSpc                     20A   CONST
     D   Pointer                       *

     D dsEC            DS
     D  dsECBytesP                   10I 0 INZ(%size(dsEC))
     D  dsECBytesA                   10I 0 INZ(0)
     D  dsECMsgID                     7A
     D  dsECReserv                    1A
     D  dsECMsgDta                  240A

     D rc              s             10I 0
     D p_data          S               *
     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
      *---------------------------------------------------------------------

     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                   exsr      CrtUsrSpc
     c                   exsr      CopyToSpc

     c                   eval      userid = 'utieditestuser'
     c                   eval      pass = 'usertestediuti'
     c                   callp     http_setauth(HTTP_AUTH_BASIC:
     c                                          userid: pass)

     c                   eval      instmf =  '/UTi_XML/FCS/tmp/Inbound'
     c                                  + %trim(Ref#)
     c                                  + '.xml'
     c                   eval      rc=http_url_post(
     c                                 'https://apps2.tradegate2000.com'+
     c                                 '/import2000deniedparties/dp_xml'+
     c                                 '_process.cgi':
     c                                  p_data: st_size:instmf)
     c                   if        rc <> 1
      * Error call http_utl_post. It can be failed connection to FCS
     c                   move      '01'          Error
     c                   return
     c                   endif

     c                   return


      *---------------------------------------------------------------------
     C*  Get stream file size.   The resulting size (from the stat DS)
     C*  will be placed in the ST_SIZE variable.
      *---------------------------------------------------------------------
     csr   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
     csr                 endsr
      *---------------------------------------------------------------------
     C*  Create a user space that's ST_SIZE bytes long, and
     C*  get a pointer to that user space as 'p_data'
      *---------------------------------------------------------------------
     csr   CrtUsrSpc     begsr
     C** Create the user space
     c                   callp     QUSCRTUS('DPCSOCKET QTEMP':
     c                                      'HTTPAPI':
     c                                      st_size: x'00':
     c                                      '*ALL':
     c                                      'HTTPAPI DPCSOCKET User Space':
     c                                      '*YES':
     c                                      dsEC)

     c                   if        dsECBytesA > 0
      * Error occurred while creating user space.
     c                   move      '03'          Error
     c                   return
     c                   endif

     C** Get pointer to user space
     c                   callp     QUSPTRUS('DPCSOCKET QTEMP': p_Data)

     csr                 endsr
      *---------------------------------------------------------------------
     C*  Copy all of the data from the stream file to the user space
      *---------------------------------------------------------------------
     csr   CopyToSpc     begsr
     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)
     csr                 endsr
      *---------------------------------------------------------------------
      /define ERRNO_LOAD_PROCEDURE
      /copy libhttp/qrpglesrc,errno_h