Good to see you already are successful with the call.A lot of browsers will interpret XML and render it as a regular web page, you can look at the page source to see if it is actual XML vs. Text.One little tip, to truly check the content that is coming back from a call, I set the output type of my Service to String first, this will show you exactly what you are returning. And since you are looking to parse the content, you don't actually need to have the service return XML, once you have verified the content is read in properly, you can go ahead and create your parsing logic.
Thanks for your tip. When I return my XML (output of as String from Resources["ContentLoaderFunctions"].GetXML(params);), I get "Unable To Convert From com.sun.org.apache.xerces.internal.dom.DocumentImpl to STRING".
I used to GetText and returning that as String shows what I expect.
I added some debug statment and tried to get them as XML and Text. The following are the outputs.
// result: XML
var xmlPage = Resources["ContentLoaderFunctions"].GetXML(params);
// result: STRING
var txtPage = Resources["ContentLoaderFunctions"].GetText(params);
xmlPage returns only my top node name.
txtPage returns the entire XML as expected.
If I parse txtPage as XML, I see undefined variable when I assign the values to datashape. In case of XML, it is not going through my for loop as there is no content inside it.
I would appreciate your help.
We are also looking for solution where external application needs json as response , where thingworx is returning JSON, XML and Text wrapped up with HTML.
Could you please provide any alernative solution to return as JSON. We have tested with Multiple REST clints and results comes back as HTML
ideaally it should be JSON if your return type is JSON..