Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating a soap message based on xs:choice #258

Open
Stephan972 opened this issue Feb 24, 2017 · 3 comments
Open

Generating a soap message based on xs:choice #258

Stephan972 opened this issue Feb 24, 2017 · 3 comments

Comments

@Stephan972
Copy link

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
Copy link
Member

predic8 commented Feb 24, 2017 via email

@Stephan972
Copy link
Author

Stephan972 commented Feb 25, 2017

@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?

@keshavarzi
Copy link

keshavarzi commented Mar 1, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants