Upload a file using pub.client.http

I have gone through a lot of posts on how to upload a file using post method of pub.client.http but still not able to get success. Below is my requirement from postman. I am uploading a dummy file by passing these two key value in Body in postman

I have uploaded the steps I tried to upload the file. I am getting http 200 but error from API response. I am using webmethods 9.10. I cannot use java service as per client’s requirement. Appreciate your help in this.

Screenshots.zip (273.0 KB)

Hi Akshay,

can you share the error message from the API response for further inverstigations, please?

Regards,
Holger

Hi Holger,

Below is the response from API.

There was an error executing your request.
Request made at 2022-08-30 18:36:10 +0000 from

If I change something in request or try to do it in some other way as mentioned in few similar posts I get a huge response in html form but the error message remains same. I get a json response with some data from postman when the file is successfully uploaded.

Without looking in any real detail - are you setting the right content-type (multipart/form-data) in the headers on the http service?
Postman tends to do this automatically for you, so sometimes I’ve seen people forget about this when they try to replicate a call into integration server.

Hello Akshay,

From the screen shot, it seems you are trying to send multipart data. To replicate this in IS, you need to build MIME data and then set it as a stream or byte to pub.client:http data variable.

  • Sumit

i always fail to send files with mime

Thanks & Regards
Maman H

Maybe start here, which is an old but decent resource in relation to this.
MIME-S/MIME Developer’s Guide (softwareag.com)

Similar thread - How to capture file upload Content from dsp page - #24 by mcser76
Retreive and Send input as Multipart/formdata with webmethods - #5 by John_Carter4

Hi @akshay.hans hope this thread help you Pub.client:http with mutiform-data, i have the same problem as you before, i’m trying to producing the postman form-data request from Integration Server, those above thread solved my case though, hope it helps