cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

POSTing XML file to external service using enctype multipart/form-data

mlähde
3-Visitor

POSTing XML file to external service using enctype multipart/form-data

Hello, community!


I need to make a POST call to an external (non-ThingWorx) service with enctype multipart/form-data and include an XML file/message with the call. In return I should receive a response in XML. I've included a screenshot of a working solution from Postman. How would I do the same in ThingWorx?


I have looked at ContentLoaderFunctions and tried the PostXML snippet where I've used the content parameter to pass the XML input as a string. This doesn't work though; I'm getting the same response as I would get if I didn't pass any content at all. This is probably because the external service is expecting the XML as a file.


The PostMultipart snippet also looks very promising, and I've tried it by saving my XML file in a file repository and setting up the repository and pathOnRepository parameters. However, according to the documentation the PostMultipart output result is JSON and I'm getting back only a blank object {}.


I'm running ThingWorx version 7.3.4-b37.


postman.png

3 REPLIES 3
bmehringer
12-Amethyst
(To:mlähde)

 Have you found any resolution to your problem?  I am experiencing the same thing.  I can get the POST request to work in Postman, but not by using "PostMultipart" in Thingworx.

 

Let me know if you have any advice.

sbt
13-Aquamarine
13-Aquamarine
(To:bmehringer)

Hello,

I am also in a similar situation where i need to send formdata with 4 key value pairs and two header information. Did anyone of you got the solution on this on how to send it.???

 

Thanks

Sunay

bmehringer
12-Amethyst
(To:sbt)

I called PTC tech support about this and they are supposed to be working on some documentation on how to use “PostMiltipart” and put it on the community.

Unfortunately, I still do not know how to use the service.
Top Tags