web service and enumerations

0
Sorry for everyone if my question was not clear, I rephrased the question completly We have 2 Applications that should integrate with each other through web service Lets say we have an Application (A) which has an object that should be sent to the application (B) where it will be saved there. I made a publish web service in the application (B) that take the Object as a parameter that will be saved in it the Imported web service (caller WS) will call this published web service and send that Object to it the problem is the object parameter of the published web service has an enumeration and when i call , It shows me an error related to enumeration because the caller web service sent a string to this enumeration, so I expect a way to convert String to enumeration in the parameters of the published web service. I wish the rephrase to be clear :)
asked
3 answers
0

Enumerations will always be received as string, which is the most fail safe option. You can use in a microflow either an expressions such as:

if value='x' then x else if value='y' then y ....

or, if your enumeration has many values, you can use the following simple Java action:

return MyEnumerationname.valueOf(value).toString();

(Note that this will throw an exception upon an unknown value, so you might want to add an try catch, which returns null or some other sensible default)

update related to the comments

Mendix exposes strings, not enumerations in published webservices. As far as i know, primitive enumerations do not exist or are not very common in XSD.

It is possible to use a convert microflow, just define a 'convert using' in your XML to domain mapping. See for example the screenshots in this howto: https://world.mendix.com/display/howto25/Configure+an+XML-to-Domain+mapping

answered
0

OK Michel,I will tell you the steps that I did and you can tell me what is the wrong:

  1. I have a micro-flow that has an Object (A) as a parameter which has many relations (like, A-->B and C-->A (i mean has an object B and list of object c) and the micro-flow return object status.
  2. My published WS call this micro-flow and has that Object A as a parameter where I can select the published attributes , and one of those attributes is of type enumeration 3-I have another application where I use an imported micro-flow to call this published WS. Thanks in advance for your answer.
answered
0

If anyone has an answer please post it .

answered