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

Re: Emulate cURL file upload with HTTP API



   So I found the http_mfd_encoder_xxxx routines...
   Looking into them they would appear to be what I'm looking for..
   But unless I'm missing something, it appears my desire to avoid writing
   to the IFS is doubly shot.  The http_mfd_encoder_xxxx routines write to
   there own temporary IFS file, plus I have to write my data out to an
   IFS file before using the http_mfd_encoder_addstmf() procedure..
   It doesn't seem to me that HTTP API will breakup the transfer on the
   boundaries like cURL did...But I'd assume that's not going to be an
   issue.
   Charles

   On Sun, Mar 23, 2014 at 7:37 PM, Charles Wilt
   <[1]charles.wilt@xxxxxxxxx> wrote:

   All,
   I'm trying to integrate with a web service where I was given the
   following cURL example:
   Curl --form request=batch --form orderfile=@orderfilename
   [2]https://somitctest1.richmondanalytics.com/rtdc.php -b cookie-file
   I downloaded cURL for windows in order to see what was going on.  The
   cURL trace shows
   => Send header, 275 bytes (0x113)
   POST /rtdc.php H
   TTP/1.1..User-Ag
   ent: curl/7.35.0
   ..Host: mlsom.ri
   chmondanalytics.
   com..Accept: */*
   ..Cookie: PHPSES
   SID=uudk76dak41h
   jqec4i0mk9ojo4..
   Content-Length:
   378..Expect: 100
   -continue..Conte
   nt-Type: multipa
   rt/form-data; bo
   undary=---------
   ---------------3
   243c9a6b3e4a2c9.
   ...
   <= Recv header, 23 bytes (0x17)
   HTTP/1.1 100 Con
   tinue..
   => Send data, 245 bytes (0xf5)
   ----------------
   ----------3243c9
   a6b3e4a2c9..Cont
   ent-Disposition:
    form-data; name
   ="request"....ba
   tch..-----------
   ---------------3
   243c9a6b3e4a2c9.
   .Content-Disposi
   tion: form-data;
    name="orderfile
   "; filename="ord
   er.txt"..Content
   -Type: text/plai
   n....
   => Send data, 85 bytes (0x55)
   0000001|023510|B
   R6315421|2014-03
   -23-18.46.47.039
   000..1|006033891
   28|1..2|59762371
   903|2
   => Send data, 48 bytes (0x30)
   ..--------------
   ------------3243
   c9a6b3e4a2c9--..
   <= Recv header, 17 bytes (0x11)
   HTTP/1.1 200 OK.
   .
   I'm trying to understand what I'd need to do with HTTP API to emulate
   this.
   As an added bonus, I'd really prefer to do directly from a variable in
   RPG without actually writing out an IFS stream file to send.
   I feel I understand what's going on, I'm just not enough of an expert
   with HTTP API to know what I need to do inside HTTP API.
   Thanks!
   Charles

References

   1. mailto:charles.wilt@xxxxxxxxx
   2. https://somitctest1.richmondanalytics.com/rtdc.php
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------