Hi everyone,
I’m working on a use case where our SAP team wants to send data to ThingWorx via an HTTP API call. They will post the data as XML, and ThingWorx should receive it in a service, parse it, and store the information in a DataTable or Dataset.
However, I’m not sure how to receive the XML payload properly inside a ThingWorx service. When SAP calls my service endpoint, I don’t see any way to directly access the raw XML content — it’s either not recognized or comes as an empty input parameter.
What’s the correct approach to handle this in ThingWorx?
Specifically:
How can I receive XML from an external system in a ThingWorx service?
Do I need to configure a specific Content-Type header (like application/xml)?
If anyone has done SAP → ThingWorx integration with XML payloads, I’d really appreciate an example or best-practice recommendation.
Thanks in advance!
We solved it by setting the Content-Type to text/xml and accept text/xmland creating a ThingWorx service with an input parameter content of type XML.
In the REST API call, I added the flag ?postParameter=content — and now the XML payload from SAP is correctly received inside the service.
I am facing another issue now while processing the XML payload received from SAP. There are several tags (around 4–5) that contain the % character. When these tags include the % sign, the request fails with an “unable to parse XML request” error.
I am already sending the correct headers:
Accept: text/xml
Content-Type: text/xml
If the % character is removed from the payload, the request is processed successfully and I receive the expected XML response.
Could anyone please advise how we should handle or encode the % character in the XML so that the request can be parsed correctly?
Tagnames in XML can't contain the % character per definition. That problem should be solved at the source, not the destination.
I did not find that % sign should not be in the XML. I have seen that operator like & must not be in the xml in the specifications of the XML. Would you please let me know more about it?
So you meant that i should inform SAP team that not to send me % sign in the XML?
You wrote about tags containing "%". Like <AA%AA></AA%AA> This is not allowed.
% in the payload is allowed.
its in payload actually. then what can be the solution to this issue?
Hard to say. You could dig into finding out where the % gets removed, you could try to introduce encoding or check if the encoding is correct (UTF-8?).
You could also try to switch from text/xml to text/plain and transform/parse the XML yourself.
403 forbidden error when i try to use text/plain only without UTF-8.
and with UTF-8 text/xml is also error unable to parse xml request.
with UTF-8 text/plain 403 forbidden.
% is an XML entity, try encoding it as % on SAP side.
See https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references
With CDATA it works as below
![CDATA[%]]
but if i write &percnt in a tag then error as below
406 not acceptable
I ll contact SAP team about it Thank you!
Maybe also check you are not running into the ESAPI validation issue as earlier. https://support.ptc.com/help/thingworx/platform/r10.0/en/#page/ThingWorx/Help/Installation/ConfiguringESAPIValidatorSettings.html
