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

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



At least in what you have shown us, type is never defined.

On Wed, 2021-06-16 at 12:00 +0200, SaraBellucci@xxxxxxxxxxxxxxxxx wrote:
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


  Kevin  Bucknum
                   Senior Programmer Analyst
                   MEDDATA / MEDTRON
                   120 Innwood Drive
                   Covington LA 70433
                   Local: 985-893-2550
                   Toll Free: 877-893-2550
                 https://www.medtronsoftware.com



CONFIDENTIALITY NOTICE

This document and any accompanying this email transmission contain confidential information, belonging to the sender that is legally privileged.  This information is intended only for the use of the individual or entity named above.  The authorized recipient of this information is prohibited from disclosing this information to any other party and is required to destroy the information after its stated need has been fulfilled.  If you are not the intended recipient, or the employee of agent responsible to deliver it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or action taken in reliance on the contents of these documents is STRICTLY PROHIBITED.  If you have received this email in error, please notify the sender immediately to arrange for return or destruction of these documents.

-- 
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi