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

@XmlElement on parameter and clarification of mapping to nillable #209

Open
Tomas-Kraus opened this issue Jun 2, 2022 · 0 comments
Open

Comments

@Tomas-Kraus
Copy link
Contributor

The following

@javax.jws.WebService
public class ComplexDataTypesImpl {

public int[] retArrayInt1D(int[] intArray)

{ return intArray; }
}

results in the XSD mapping

<xs:complexType name="retArrayInt1D">
xs:sequence
<xs:element name="arg0" type="xs:int" nillable="true" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>

Since the array item type is a primitive, nillable should be false.
Additionally, permitting @xmlelement would allow customization
It could be used to override the current default mapping (of nillable
=true). For.e.g

@javax.jws.WebService
public class ComplexDataTypesImpl {

public int[] retArrayInt1D(@xmlelement(nillable=false) int[] intArray){ return intArray; }

}

would result in

<xs:complexType name="retArrayInt1D">
xs:sequence
<xs:element name="arg0" type="xs:int" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>

The use of the XmlElement on a parameter requires a spec change. Looks there is
an already an issue for that https://jaxb.dev.java.net/issues/show_bug.cgi?id=444 .

Since the parameter -> element mapping is done by JAX-WS not JAXB, JAX-WS spec
also needs to specify when the nillable is true or false for both the default
case (which is not clear in the spec) as well as the case when @xmlelement is
used on a parameter.

Environment

Operating System: All
Platform: Sun

Affected Versions

[2.1.2]

Source: javaee/metro-jax-ws#483
Author: glassfishrobot

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

No branches or pull requests

1 participant