[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
http_url_post with http_url_encoder_getptr
Hi! Mr. SCOTT I enclose them mine pgm. Modified EXAMPLE2 is following:
H DFTACTGRP(*NO) ACTGRP(*NEW) BNDDIR('HTTPAPI')
FDOCXML IF F32740 DISK
D/copy qrpglesrc,httpapi_h
D cmd pr extpgm('QCMDEXC')
D command 200A const
D length 15P 5 const
D CRLF C CONST(x'0D25')
D rc s 10I 0
D msg s 52A
D Enc s like(HTTP_URL_ENCODER)
D myPointer s *
D datasize s 10I 0
IDOCXML NS
I 1 5 Tipo
I 632740 Xdoc
c open(e) DOCXML
c read DOCXML
**
** CHANGE THIS TO THE MESSAGE YOU'D LIKE SENT TO ME:
**
**
** To do URL encoding data, you must create a "URL Encoder
** and then use it to encode each variable of the web form
** as follows:
**
C eval tipo = 'MRO'
C eval Enc = http_url_encoder_new
c callp http_url_encoder_addvar_s(
Enc
c : 'xmlString'
c : Xdoc )
c callp http_url_encoder_addvar_s( Enc
c : 'type'
c : Tipo )
**
** The http_url_encoder_getptr() routine can be used to get a
** pointer to the encoded data. This is especially useful for
** the http_url_post() function.
**
c callp http_url_encoder_getptr( Enc
c : myPointer
c : datasize )
**
** The http_url_post() function does an HTTP POST
operation
** sending any data at the pointer you
specify.
**
** The results, in this case, are saved to the IFS in a
file
** called
'/tmp/testpost.html'
**
*
c eval rc =
http_url_post(
c 'http://192.168.100.1:9081/Web/'
+
c
'FileUploadServlet?'
c +
http_url_encoder_getstr(Enc)
c :
myPointer
c :
datasize
c : '/tmp/testpost.html'
)
c if rc <>
1
c eval msg =
http_error
c dsply
msg
c
else
c callp cmd('DSPF ''/tmp/testpost.html''':
200)
c
endif
**
** When done, make sure you call this function to free
up
** the memory that the URL Encoder
used.
**
c callp
http_url_encoder_free(Enc)
c close DOCXML
c eval *inlr = *on
Putting it under debug my variable XDOC that contains a XML after to
have it last to the function http_url_encoder_getptr it returns me to
the maximum until 256 characters. I make sure of the errors, I would
have need of an aid
Thanks
Antonio
__________________________________________________
Do You Yahoo!?
Poco spazio e tanto spam? Yahoo! Mail ti protegge dallo spam e ti da
tanto spazio gratuito per i tuoi file e i messaggi
http://mail.yahoo.it
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------