0 Replies Latest reply on Aug 23, 2017 2:25 AM by mlähde RSS
    mlähde Explorer

    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