How to capture binary data from the web service (REST or SOAP)

How to capture binary data from the web service (REST or SOAP)


Hi ,

I need to capture the pdf file from the web service and store in database . Is there any way to achive this. Iam working on JAVA stacks.

Sattibabu Vatti.
Hi Sattibu,

It would help if you explained what you already tried to do, and where you need help exactly. The short answer is yes, you can do that, and it should be fairly trivial. If you need any specific help, please let us know!

We need to host  a rest service for client - to accept a multipart attachment. Thats the requirement .

Please let me know if you need more information.

Sattibabu Vatti.
Hi Sattibabu,

Again, what did you try already? We're here to help you, not write solutions for you. Did you already create the REST service? If so, what problem do you have receiving the binary?
Hi Kilian,

      I have created a rest end point as follows  
1. Exposed Rest API - named as document
2. Added Rest API Method - postDocument
3. Added input parameter - doc and changed data type to Binary Data
Within the service we have an action to write the file to a location.
Tried posting to above rest point with the m/c url that ends with /module_name/rest/document/postDocument via Advance Rest Client (google chrome) - it gave 200 OK. But we couldnt find the file in the location.

Please help


Have you tried to provide the PDF file on the endpoint as a base64?

So in the client you convert it to binary using BinaryData extension.

As far as the REST service is concerned, it seems you did the right thing. I'm a bit confused about your remark "we couldn't find the file in the location". Have you debugged the REST service to see if the binary file is received? And/or have you set the Logging Level of the REST service to "Full", and checked the logging to see if the binary file has been sent? Or did you only check whether the file was in the expected directory, then threw your hands in the air and debugged nothing???