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

[Ftpapi] In: HTTPAPI - Example 7 - Upload a file from IFS - No file attached!



Hello,

I need to send a PDF file from IFS to a server by calling an IBM webservice.

I saw the EXAMPLE7 of the HTTPAPI tool, and I tryed to use this but I received the error "No File Attached!".

This is my RPG code to test the upload of a test PDF file:

**free
ctl-opt dftactgrp(*no) bnddir('HTTPAPI');

/copy HTTPAPI_H
/copy IFSIO_H

dcl-s tempFile varchar(40);
dcl-s form pointer;
dcl-s type char(64);
dcl-s rc int(10);

tempFile = http_tempfile();

form = http_mfd_encoder_open(tempFile: type);


http_mfd_encoder_addvar_s(form: 'operation'  : 'VERIFY');
http_mfd_encoder_addvar_s(form: 'data_format': 'PDF'   );


http_mfd_encoder_addstmf( form
                        : 'handout'
                        : '/IFS_Path/Test.pdf'
                        : 'application/pdf' );


http_mfd_encoder_close(form);


rc = http_url_post_stmf( 'http://www.scottklement.com/httpapi'
                                    + '/upload.php'
                       : tempFile
                       : '/IFS_Path/http_result.txt'
                       : HTTP_TIMEOUT
                       : HTTP_USERAGENT
                       : type );


unlink(tempFile);

// handle any errors during post here... etc..

if rc <> 1;
   http_crash();
endif;

*inlr = *on;
                                         

Someone can help me?

Thanks in advance.


_________________________________________________________
Sara Bellucci

SAS INFORMATICA srl

Tel: +39 075 5058160
Fax: +39 075 5058105
e-mail: SaraBellucci@xxxxxxxxxxxxxxxxx
http://www.sasinformatica.it
-- 
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi