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

Re: Help with HTTP API



Sender: Scott Klement <sk@xxxxxxxxxxxxxxxx>


the Development iSeries that I'm working on in, is on V4R4M0 , I got an
error with  the /free ...... /end-free stuff.
Do I have to use diferent code no?

I don't have access to a computer that's as far out of date as V4R4, so I don't know exactly what needs to be changed. I think all you'll need to do is convert it to fixed format.


Here's a fixed format version of the same program:

H dftactgrp(*no) bnddir('LIBHTTP/HTTPAPI')

/copy libhttp/qrpglesrc,httpapi_h

     D cmd             pr                  extpgm('QCMDEXC')
     D  command                     200A   const
     D  length                       15P 5 const

     D rc              s             10I 0
     D msg             s             52A
     D Enc             s                   like(HTTP_URL_ENCODER)
     D data            s               *
     D size            s             10I 0

C eval *inlr = *On

     C                   eval      Enc = http_url_encoder_new
     c                   callp     http_url_encoder_addvar_s(
     c                                Enc  : 'sUsuario': 'bancon')
     c                   callp     http_url_encoder_addvar_s(
     c                                Enc  : 'cClave': 'bancon')
     c                   callp     http_url_encoder_addvar_s(
     c                                Enc  : 'iNumeroDeCliente': '2356')

     c                   callp     http_url_encoder_getptr(
     c                                Enc  : data : size )

     c                   eval      rc = http_url_post(
     c                                 'http://200.30.178.70'
     c                               + '/service.asmx'
     c                               + '/BuscarClientePorNumeroCliente'
     c                               : data
     c                               : size
     c                               : '/tmp/httptest.html' )

c callp http_url_encoder_free(enc)

     c                   if        rc <> 1
     c                   eval      msg = http_error
     c                   dsply                   msg
     c                   return
     c                   endif

     c                   callp     cmd('DSPF ''/tmp/httptest.html''': 200)
     c                   return


Please compare the original program with this one so you can see how easy it was to convert from free format to fixed format. Almost all of the examples you'll see posted in the future will be in free format, so understanding how to convert between them will be a good thing to know.



----------------------------------------------------------------------- This is the FTPAPI mailing list. To unsubsribe from the list send mail to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr -----------------------------------------------------------------------