4 Replies Latest reply on May 10, 2011 4:07 PM by bech

    How to set a parameter mandatory for a given operation

      Dear,

      Could you please tell me how can I set a parameter mandatory in my WS. Below is the code of my WS

      @WebService
      @SOAPBinding(style=SOAPBinding.Style.DOCUMENT)
      public class GenericWS {
       public boolean postMessage(@WebParam(name = "message")Message inMessage){
      
      
       System.out.println(inMessage);
      
      
       return true;
      
       }
      }
      


      Here is the code of my Message Bean :

      public class Message implements Serializable{
       /**
       *
       */
       private static final long serialVersionUID = 1L;
      
       private String theField;
      
      
       @XmlElement(required=true)
       public String getTheField() {
       return theField;
       }
      
      
       public void getTheField(String value) {
       this.theField = value;
       }
      
      }


      Here is a part of the generated WSDL

       <xs:complexType name="postMessage">
       <xs:sequence>
       <xs:element minOccurs="0" name="message" type="ns1:message"/>
       </xs:sequence>
       </xs:complexType>
      
      


      My question is : Is it possible to remove the minOccurs="0" ?

      Many thanks in advance