Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: Version 3.0 com.HTTPRequest.doFileRequest  (Read 13353 times)
Francois L.
Posts: 8


« on: May 05, 2017, 09:48:37 pm »

Gentlemen,

I just saw that method in BDL version 3.0. Before version 3.0, was there another way to send a file through an HTTP POST???

I mean was there a combination of methods that could be used to achieve the same purpose ??

Currently on version 2.41. 

Thanks

Francois

P.S. Obviously my first web service call in BDL with the com methods.
Frank G.
Four Js
Posts: 48


« Reply #1 on: May 09, 2017, 09:17:27 am »

Hi, with a prior version you can use doDataRequest() method and load the file in a BYTE. I should be something like following :

MAIN
 DEFINE req com.HTTPRequest
 DEFINE resp com.HTTPResponse
 DEFINE out,in BYTE
 LOCATE out IN MEMORY
 LOCATE in IN MEMORY
 CALL out.readFile("myfile.jpg")
 LET req = com.HTTPRequest.Create("http://your/url")
 CALL req.setMethod("POST")
 CALL req.doDataRequest(out)
 LET resp = req.getResponse()
 IF resp.getStatusCode()==200 THEN
   CALL resp.readDataResponse(in)
   CALL in.writeFile("myresponse.jpb")
 ELSE
   DISPLAY "ERROR :",resp.getStatusDescription()
 END IF
END MAIN

Regards,

Frank
Francois L.
Posts: 8


« Reply #2 on: May 09, 2017, 02:53:43 pm »

Thank you Frank but that won't fit.

Genero 2.41 does not have the methods described with your solution.
I saw that it starts with version 2.50.
I also read in the server-side documentation that I would probably have to manually code some params such as file boundaries and return line feed in the HTTP forms.

The file that needs to be received is a csv file.


Tanks again.

François
Frank G.
Four Js
Posts: 48


« Reply #3 on: May 09, 2017, 03:56:40 pm »

If you want to gain some time. Use version 3.00 :), most of the operations are done automatically, such as setting the correct content-type according to the file extension.

Regards,
Frank

Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines