Question
Sending multipart request to external systems via ThingWorx service
Hi,
I want to send a multipart REST request to external system (out side the ThingWorx application) using a custom service, to send an xml file. This is the code snippet for the service-
There are no logs getting updated for the service execution, nor the request reaches the external system.
var now = Date.now();
var url = /*URL*/;
/*jshint multistr: true */
var body = /*XMLBODY*/
var table = Resources["InfoTableFunctions"].CreateInfoTable();
//Add new fields to the InfoTable:
table.AddField({name: "test", baseType: "XML"});
// add data row
table.AddRow({
test: body
});
var params = {
proxyScheme: undefined /* STRING */,
ignoreSSLErrors: true /* BOOLEAN */,
useNTLM: undefined /* BOOLEAN */,
partsToSend: table /* INFOTABLE */,
workstation: undefined /* STRING */,
useProxy: undefined /* BOOLEAN */,
repository: <repoName> /* STRING */,
proxyHost: undefined /* STRING */,
url: url /* STRING */,
timeout: undefined /* NUMBER */,
proxyPort: undefined /* INTEGER */,
password: undefined /* STRING */,
pathOnRepository: <path> /* STRING */,
domain: undefined /* STRING */,
username: undefined /* STRING */,
headers:{'Content-Type': 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW',
'X-XSRF-TOKEN':'TWX-XSRF-TOKEN-VALUE',
}
};
// result: JSON
var result = Resources["ContentLoaderFunctions"].PostMultipart(params);
logger.info(" XMLRequestThing.SendXMLRequest(): Results From Calling Service - " + JSON.stringify(result));
Can some one please help with understanding what might be going wrong here, thank you!

