users@jax-ws.java.net

Making Input Parameters Required

From: Christopher Moesel <christopher_moesel_at_avid.com>
Date: Wed, 27 Dec 2006 10:26:26 -0500

Hello,

Is there a way to specify that input parameters should be required
(minOccurs="1" in the XSD/WSDL)? Here is an example of my Java code
w/Annotations:

@WebMethod(operationName = "myMethod", action = "urn:MyMethod")
@WebResult(name="MyResult")
MyResult myMethod( @WebParam(name="myParam1") String param1,
                   @WebParam(name="myParam2") String param2 );

This results in the following declaration in the generated XSD:

<xs:complexType name="myMethod">
  <xs:sequence>
    <xs:element name="myParam1" type="xs:string" minOccurs="0"/>
    <xs:element name="myParam2" type="xs:string" minOccurs="0"/>
  </xs:sequence>
</xs:complexType>

In this example, however, I want the generated XSD to indicate that myParam1
and myParam2 are required (minOccurs="1"). Is there a way to do this
without needing to create my own input wrapper object?

Thanks,
Chris