I have a @WebMethod call
@WebMethod
public int cancelCampaign(String campaignId, String reason);
I'd like to make the campaignId field marked as mandatory. Not sure how to do that.
I'm using a JBOSS 7.1 server.
I have a @WebMethod call
@WebMethod
public int cancelCampaign(String campaignId, String reason);
I'd like to make the campaignId field marked as mandatory. Not sure how to do that.
I'm using a JBOSS 7.1 server.
The only way to do this with
JAX-WS
is to write some wrapper classes that specify therequired=true
flags on theXmlElement
annotations. Your request element should look something like this:And your web method should look like this:
This will tell
JAXB
to generateminOccurs=1
in yourXSD
forcampaignId
element.I had a similar requirement, and from SoapUI I noticed I was getting
instead of
A way out in JAX-WS Metro 2.0 RI is to annotate each parameter with
In my case, I had to do this to required WebMethod parameters and getters of all my required custom types, like so:
In the WebService:
And in my POJO class: