membrane/soa-model

Generating a soap message based on xs:choice

Opened this issue · 3 comments

I have a wsdl allowing the following elements:

(...)
<xs:complexType name="ExportType">
<xs:sequence>
  <xs:element name="Statements" type="statementstype:StatementsType" minOccurs="0" maxOccurs="1"/>
  <xs:element name="Operation" type="operationtype:OperationType" minOccurs="1" maxOccurs="1"/>
  <xs:element name="SelectedLanguageDescriptions" type="languagedescriptionstype:LanguageDescriptionsType" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
(...)
<xs:complexType name="OperationType">
<xs:choice>
  <xs:element name="Extract" type="extracttype:ExtractType"/>
  <xs:element name="Retrieve" type="retrievetype:RetrieveType"/>
  <xs:element name="SynchronisationExtract" type="synchronisationextracttype:SynchronisationExtractType"/>
</xs:choice>
</xs:complexType>
(...)

I use soa-model for generating a soap request from this wsdl. The resulting soap request is fine except for the Operation element. soa-model produces an element for each member of the xs:choice.

How can I instruct soa-model to generate only the SynchronisationExtract element?

@predic8 , Thanks for your quick reply !

Suppose we have the following code:

WSDLParser parser = new WSDLParser();
 
Definitions wsdl = parser.parse("http://example.com/path/to/wsdl/whith/choice.wsdl");
 
StringWriter writer = new StringWriter();
 
HashMap<String, String> formParams = new HashMap<String, String>();
formParams.put("xpath:/create/article/name", "foo");
formParams.put("xpath:/create/article/description", "bar");

//SOARequestCreator constructor: SOARequestCreator(Definitions, Creator, MarkupBuilder)
SOARequestCreator creator = new SOARequestCreator(wsdl, new RequestCreator(), new MarkupBuilder(writer));
creator.setFormParams(formParams);
 
//creator.createRequest(PortType name, Operation name, Binding name);
creator.createRequest("ArticleServicePT", "create", "ArticleServicePTBinding");

What is the class, under the hood, that will handle the xs:choice?