0 Replies Latest reply on Nov 22, 2008 8:56 PM by Anthony Whitford

    How to avoid optional parameters (wsgen)

    Anthony Whitford Newbie

      Consider a simple web service method:

      @WebMethod
      void foo (@WebParam(name="param") String param)
      

      When generating the WSDL using wsgen, and inspecting it in SoapUI, I notice that a primitive type (like an int) won't appear as optional, but an object reference does. In some cases, I would like to declare the parameter as required. I thought I could do something like:
      @WebMethod
      void foo (@WebParam(name="param") @XmlElement(nillable=false, required=true) String param)
      

      Alas, this doesn't even compile because I can't use XmlElement for a method parameter...

      I'm pretty sure that the optional interpretation is coming from the minOccurs="0" attribute on the xs:element.

      Is there a way that I can control this?