Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
I am sending a SOAP Request from Thingworx to FactoryTalk Pavilion 8. I run the following script but get nothing back. The ldp in the code below is a tag whose value the SOAP call is supposed to retrieve. Thingworx 9.3
var content ='<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\
<soapenv:Body>\
<getTimeSeries>\
<ldps>\
<ldp>MAIN/Line1APQC/L1_QualityCtrl_KPIs/CV___Peel/data::output/Utilization/UnitUptime</ldp>\
</ldps>\
<starttime>2023-01-06T20:45:00</starttime>\
<endtime>2023-05-26T00:10:00</endtime>\
</getTimeSeries>\
</soapenv:Body>\
</soapenv:Envelope>';
var resultXML = Resources["ContentLoaderFunctions"].PostXML({
url: "http://xxxxxxxx/integration/services/TimeSeriesPagingService" /* STRING */,
content: content,
password: 'xxxx' /* STRING */,
username: 'xxxx' /* STRING */
});
var data = resultXML.*::Body.*::getTimeSeriesResponse.*::rows.*; //See Postman results below.
.....
Some code to put in a table.
......
The result I get back in Postman looks like the following:
Solved! Go to Solution.
I just figured it out with the following. Adding the header variable and then assigning that variable to the headers field in resultXML. See bold below:
var content ='<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\
<soapenv:Body>\
<getTimeSeries>\
<ldps>\
<ldp>MAIN/Line1APQC/L1_QualityCtrl_KPIs/CV___Peel/data::output/Utilization/UnitUptime</ldp>\
</ldps>\
<starttime>2023-01-06T20:45:00</starttime>\
<endtime>2023-05-26T00:10:00</endtime>\
</getTimeSeries>\
</soapenv:Body>\
</soapenv:Envelope>';
var headers = {"Content-Type": "text/xml","SOAPAction":"http://xxxxxxxxxx/integration/services/TimeSeriesPagingService"};
var resultXML = Resources["ContentLoaderFunctions"].PostXML({
headers: headers,
url: "http://xxxxxxxx/integration/services/TimeSeriesPagingService" /* STRING */,
content: content,
password: 'xxxxx' /* STRING */,
username: 'xxxxx' /* STRING */
});
result = resultXML;
Don't have an answer but have you searched the community? There are quite a few posts around SOAP calls.
What is the content of 'resultXML' after the request was sent? This should hold the content you also receive via postman but you did not say what it actually is.
Hi @AndyHilton.
Are getting a response to this statement?
var resultXML = Resources["ContentLoaderFunctions"].PostXML({
For troubleshooting, you can change "resultXML" to "result" and comment out the rest of the code to see if you get any results back. That will give you some idea of how to proceed for resolving the issue.
Let us know and we'll be happy to assist further.
Regards.
--Sharon
You can also set the output to string after setting it to Result to see the 'raw' return, potentially if it can't be interpreted.
Hey everyone,
Apologies for the late reply. I get the following XML response from resultXML in Thingworx where xxxxxxxx is the server address of my Pavilion 8 instance.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" headers="" responseHeaders="Server=Apache-Coyote/1.1Set-Cookie=JSESSIONID=B540CEC8FCAC7369323EBCB2C760EDB8; Path=/; HttpOnlyContent-Type=text/xml;charset=utf-8Transfer-Encoding=chunkedVary=Accept-EncodingDate=Thu, 15 Jun 2023 16:43:19 GMTConnection=close" responseStatus="protocolVersion=HTTP/1.1:statusCode=500:reasonPhrase=Internal Server Error"> <soapenv:Body> <soapenv:Fault> <faultcode xmlns:ns1="http://xml.apache.org/axis/">ns1:Client.NoSOAPAction</faultcode> <faultstring>no SOAPAction header!</faultstring> <detail> <ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">xxxxxxxx</ns2:hostname> </detail> </soapenv:Fault> </soapenv:Body> </soapenv:Envelope>
I'm assuming this means I need a specific header by not sure how I would format it or what properties I would put in that SOAPAction header.
I just figured it out with the following. Adding the header variable and then assigning that variable to the headers field in resultXML. See bold below:
var content ='<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\
<soapenv:Body>\
<getTimeSeries>\
<ldps>\
<ldp>MAIN/Line1APQC/L1_QualityCtrl_KPIs/CV___Peel/data::output/Utilization/UnitUptime</ldp>\
</ldps>\
<starttime>2023-01-06T20:45:00</starttime>\
<endtime>2023-05-26T00:10:00</endtime>\
</getTimeSeries>\
</soapenv:Body>\
</soapenv:Envelope>';
var headers = {"Content-Type": "text/xml","SOAPAction":"http://xxxxxxxxxx/integration/services/TimeSeriesPagingService"};
var resultXML = Resources["ContentLoaderFunctions"].PostXML({
headers: headers,
url: "http://xxxxxxxx/integration/services/TimeSeriesPagingService" /* STRING */,
content: content,
password: 'xxxxx' /* STRING */,
username: 'xxxxx' /* STRING */
});
result = resultXML;