When I have an anonymous complexType defined on a Jaxb2 service elemnt with an xsd:choice indicator, the WsGen task generates clients without parameters. For example, if I take the WeatherService example provided in the distribution and run WsGen on it, the resulting interface has the appropriate in parameters on the web method. Below are the relevant code snippets:
xsd:
<xsd:element name="GetWeatherByZipCode">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="1" name="ZipCode" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
generated interface:
@WebMethod(operationName = "GetWeatherByZipCode", action = "")
@WebResult(name = "GetWeatherByZipCodeResult", targetNamespace = "http://www.webservicex.net")
public WeatherForecastsType getWeatherByZipCode(
@WebParam(name = "ZipCode", targetNamespace = "http://www.webservicex.net")
String ZipCode);
However, if I add an xsd:choice to the above XSD for the GetWeatherByZipCode element and run WsGen, I get NO parameters for the resulting web method. See below for relevant code snippets:
xsd:
<xsd:element name="GetWeatherByZipCode">
<xsd:complexType>
<xsd:choice>
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="1" name="ZipCode" type="xsd:string"/>
</xsd:sequence>
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="1" name="TestZipCode" type="xsd:string"/>
</xsd:sequence>
</xsd:choice>
</xsd:complexType>
</xsd:element>
generated interface:
@WebMethod(operationName = "GetWeatherByZipCode", action = "")
@WebResult(name = "GetWeatherByZipCodeResult", targetNamespace = "http://www.webservicex.net")
public WeatherForecastsType getWeatherByZipCode();
Is this a bug with WsGen with an anonymous complexType?