How to set pub.client:http parameters when it is a file

Hi Expert,
I am trying to send something to others.
The script is working fine when i run it directly on my server unix box :
curl -F data_1=A -F data_2=B -F data_3=@D:test\t1.json http://server/url

However, when i use pub.client:http, i am getting the error data_3 parameter empty.
It seems that data_3 should be a file, how do I set the data_3 parameter of pub.client:http to make it work? Or is there another way?

We use webMethods 912.

Looking forward to your reply.Thanks.

Please check this document and this post and let us know if you need any more information besides them.

Hi Jenny,
It appears you may not be fully understanding what that curl command is doing. It is not the case that data_3 should be a file. Indeed, given the extension it is probable that data_3 should be a json string. When a curl command sees @D:test\t1.json it replaces that with the content of the local file at D:test\t1.json before sending it to http://server/url

If you want to do the same, you can use pub.file:getFile with loadAs set to “string” to read the json string from the file sitting on the integration server (see this), then map the content in body/string to data_3.

1 Like

Hi Expert,
I did this at first, but I got this error data_3 parameter empty, so I thought the data_3 parameter had to be passed into a file. Yes,I don’t know much about curl command.
Or what else could I do?

headers/Content-Type: application/json、text/html、text/plain (I’ve tried all three Settings)