1 Reply Latest reply on Mar 18, 2013 4:19 PM by Daniel Cote

    Annotate WebService methodwith optional Header

    samhain Newbie

      I have a Web Service that needs an optional soap header on its methods, but I don't want to have it required(i.e. nullable ).  The reason for this is because my service will be deployed to multiple environments, some of which will require the header while others will not.


      Is it possible to use Java annotations to mark a soap method's header parameter as optional?  If not, can it be accomplished via WSDL modification?


      Or is the "correct" way to accomplish this by not defining the header in the WSDL, but instead to tell the clients to send the header with mustUnderstand="0".

        • 1. Re: Annotate WebService methodwith optional Header
          Daniel Cote Newbie

          Hi Samhain,


          I always use a SOAPHandlers to make the majority of the adaptations regarding the SOAP headers.

          There is an annotation that makes possible to say that a parameter SHOULD be conveyed using headers (@WebParam (header=true) but that is all I'm awared of.  By its nature, it does not seems to express what you were looking for...

          By default, not providing a mustUnderstand attribute, the WS stack should recognize the header as optionnal.


          This was my 2 cents...