Expose a SOAP webservice:choice element

I'm having some trouble formatting the response of a SOAP webservice we need to expose. The response should contain a choice element. So response 1 should for example look like this:







And response 2 should look like this:




I can't find the correct way of doing this. In the documentation about consuming a webservice the choice element is mentioned (see https://success.outsystems.com/Documentation/11/Reference/OutSystems_Language/Extensibility_and_Integration/SOAP_Web_Services/Consumed_SOAP_Web_Service/Mapping_XML_Data_Types_to_OutSystems_Data_Types) But how to achieve this when exposing a webservice ?

I've tried some quick & dirty workarounds:

  • put XML in a text field; the xml-tags are misformed a "<" becomes a "ampersand lt;"; the ">" comes out ok ....
  • using a structure and then use RecordToXML; that way the result contains ugly CDATA tags, not what you want

Suggestions on how to use a choice element in an exposed webservice would be appreciated!

What's the reason behind the requirement? Is this to maintain compatibility with an external consumer?

Perhaps a little more explanation around what you're trying to achieve in the big picture would help spur ideas for workarounds?

HI Andrew,

We have a wsdl specification from a party we have expose a webservice to. This party will use our webservice to get some information about our clients. This party will not only be using our webservice, but webservices identical to ours to gather information from different suppliers. So, the specification of the webservice we have to expose is non-negotiable, every party uses the same wsdl.

So, if anyone has ideas how to put a choice element in a response of a exposed webservice, I really appreciate it.

Hi Martijn,

Not sure if I fully understand the problem. Does the 3rd party expect the WSDL generated by OutSystems to conform to the WSDL that's supplied to you? As I understand, the "choice" element appears in the XSD, but it seems you expect it to be in the response?

Hi Kilian, 

The choice element is specified in the xsd of the wsdl we must conform to. The specification of the webservice also includes some examples of requests and expected responses.

For example a response (from the webservice we have to expose) looks like this:

A different response looks like this:

As you can see, the "Resultaat" part of the repsonse can be "Actief", with some child-elements, or it can be "NietActief" without any childelements. "Actief" and "NietActief" may not appear both in the "Resultaat".

So my question is: how can I make a structure in OutSystems that is mappable to the "Resultaat" part.