XML string to Mendix object

Hi there, I am doing a call to a web service that returns a single string value. This string value is in XML format. My question is, what would be the best way of converting this XML string into an object? Example : Return Value of the Web service is '<TestClass><inValue1>15</inValue1><inValue2>21</inValue2></TestClass>'. I would like to convert this string to a "TestClass" Entity.
2 answers

The web service you're calling returns just one string value, which happens to contain XML? So the actual response looks like this? :


I've seen web services like this before, and here are a few options to handle them with Mendix:

  • Change the web service (if possible) to return "real" XML: while I've seen the above being used in some systems, it really isn't the way a "good" SOAP web service should function.
  • Do you have any tooling available that you can put between Mendix and the web service you're trying to call that can transform the result into a normal XML message? In cases like this we're using a custom ESB-like messaging framework for transforming these weird formats in normal, "Mendix friendly", XML.
  • You can add a bit of Java code to your Mendix project that stores that string value as the content of a System.FileDocument object, which you can then use in a Mendix XML-to-Domain mapping as you'd normally do.

You want to convert the inValue to a Test Class entity. Why not mapping to a TestClass object with a InValue attribute?