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

Trouble Parsing Soap Request


Trouble Parsing Soap Request

I am able to submit a Soap request, using this command:

var xmlPage = Resources["ContentLoaderFunctions"].PostXML(params);

and I receive a response in the form of:


      <GetObservationsResponse xmlns="<somenamespace>">

         <GetObservationsResult xsi:type="s01:ObservationResponse" xmlns:s01="somenamespace">

            <_Response xsi:type="s:string"/>

            <Message xsi:type="s:string"/>


               <Observation xsi:type="s01:Observation">

                  <_TimeCreated xsi:type="s:dateTime">2014-02-19T08:38:41Z</_TimeCreated>

                  <rank xsi:type="s:string">6</rank>

          <observation_type xsi:type="s:string">SomeObservation</observation_type>

                  <value xsi:type="s:string">84</value>



When I have the output type of String, I am able to view the entire response. When I change response type to XML, I get the result "XML"

I'm trying to parse it similar to the examples we've seen (i.e. xmlPage.GetObservationsResult), but it is completely empty. Can someone please tell me how I can get to the list of observations?

5-Regular Member

Hi Christopher,

When testing a Service from Composer that returns XML, you will have to set the output type to STRING, in order to view the XML. Your other option is to set the output type to XML and view the response through a REST call (eg. http://localhost/Thingworx/Things/ThingName/Services/ServiceName?method=post&amp;Accept=text/xml). Regardless of the output type, the xmlPage variable will still contain XML that you can parse.

You mention some examples – be sure to check out the

ThingWorx Consuming a SOAP Web page (XML Parsing with a Namespace example)

 in the Examples section and

Exercise 26 – Create a Service to Consume an XML Web Page

 of the Training Workbook.



Thank you for your kind response. I'm able to get the example from the Workbook to work just fine. 

When I do result =, I get the latest title.

Where I'm running into trouble is when I try to use the same technique on the XML returned in the Soap response. I tried doing things such as result = xmlPage.GetObservationsResponse, result = xmlPage.GetObservationsResult, etc. I always get an empty result.

As for the snippet from the Examples section, I guess I ran into trouble with this part:

var latestSensorPointValues = Things['Thing_Connection_Test'].GetLatestSensorPointValues({

DeviceID : Things['SolarPanel001'].DeviceID


It's giving an error. I should obviously be replacing the Things['Thing_Connection_Test'] portion, but I'm at a loss of what should replace it. 

Hi Christopher, for now I would focus on the initial part that focuses on defining the Name Spaces.

Once you have those properly specified, then you can first test out getting values from nodes by keeping the output of the service as STRING and setting your result output to a node that you are trying to get information from.

The continuation of that example is more about how that information to return it to the mashup in a meaningful way.

That part is for you to decide.

Are you going to parse out the values and update properties with them, are you going to send it all to an InfoTable directly to the Mashup environment etc.

Hi Pai,

I am able to get requests, as an XMLList, but can't seem to step through nodes as in the example from the workbook. 

When you say, "focus on the initial part that focuses on defining the Name Spaces", are you referring to using the example from 

ThingWorx Consuming a SOAP Web page (XML Parsing with a Namespace example)

 in the Examples section?

If so, what object should I use to perform the actual request? I don't have a Things['Thing_Connection_Test'] object to perform the request. Is there further documentation I can read up on to see how to do it that way? 

That Thing that executes that Service is just a Post/LoadXML Service. That part you already have.

So your xmlPage is exactly the same as latestSensorPointValues in the example

So your focus should be on the part that shows you how it uses the declared name spaces and then goes into the parsing.

Thank you so much. That did it!!