Extracting Attachments into webMethods,which are sent through RESTFul webService

Hi All,

Could you please help me with the steps required to download attachments, which are sent through RESTFul webservices to webMethods (9.12) ?

Requirement:

  1. Client will be sending the attachments ( pdf,tif etc) through the REST service POST methods.
  2. webMethods need to download the attachment and save it into local machine.

Thanks in Advance, Manjunath

Hi Manjunath,

Any luck in here. If yes, please help me out for the same.

Thanks,
Deepika

If client can send attachment as Base64 stream, along with Mime type and file name, attachment can be handled as string under JSON.

In this way client may send attachment with limited size.

Hi Farid,

Thanks for your reply. I tried sending data from SOAP-UI, but I am not aware how to handle it in webMethods flow service level.

If you have any examples could you share them with me.

Thanks in advance.

Deepika

Was anyone able to do this? I have a scenario too, sending a PDF attachement via SOAP UI to a service using invoke URL and download it and save it locally.

This can be done in multiple ways and it completely depends how sender is sending the file. I have doen this using webMethods invoke where file was being pushed as content stream object.

This object can be received as an input streamed and stored locally. Since contents are used as binary , one may use any file.

In my case the sender is already sending a xml node to us via http post. In the same service call they want to include PDF attachments too. how do i receive those attachments in IS?

@Anjni Gupta.

I believe the content/type of your client is currently text/xml.

They may change this to multipart/form-data and send any file as an attachment. However, you will not longer receive a node as input instead you will receive a contentStream as input which will contain both your XML as well as your attachment.
You will have to use a different Parser, like HTTPServletRequest parser or apache file upload API. Refer FileUpload – Home.