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

Re: AW: Sending binary data to a web service



http_url_post_stmf() always posts in binary. It never attempts to translate your data.

You need to understand what the web service is looking for.

Many sites use a form of MIME called "multipart form data" for uploading files. If you need that, HTTPAPI provides a set of routines that begin with "http_mfd" that you can use to encode in that format.

Thomas said something I don't understand about using base64. Usually you would not need that in HTTP unless the file is embedded inside an XML document or some other strange situation. HTTP is already an 8-bit safe binary protocol, so there's no need for base64 encoding, normally.

But, it all depends on what the web service is expecting -- something you have told us nothing about.


On 10/7/2016 2:25 PM, James H. H. Lampert wrote:
On 10/6/16, 10:46 PM, Thomas Raddatz wrote:

a) You can create a MIME message and send your binary data as an
attachment. Depending on the size of the binary data, it might be
better to use a stream file to prepare the post data aka the MIME
message. That is where http_url_post_stmf() comes into play.

b) You can encode your binary data to Base64 and send the Base64
string as the value of an XML element or (in your case) assign the
Base64 string to a Json attribute.


Ok. Here is what we know, so far:

1. The binary data is in the form of ZIP files, uploaded to the IFS via a proprietary protocol.

2. We now have web services that can accept binary files, but so far, all I've been able to call them from is the Swagger Playground, and unlike every other web service I've tried through it, the Playground shows absolutely nothing about what's really going on. I've passed on the gist of what you said about MIME or Base64 being known ways to do it, and asked the web service developer to let me know what's actually being sent, and in what form, out of the Playground.

--
JHHL
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------


-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------