Thanks for the replay Dan. I was looking through the documentation and I 
did see that you can run the java2ws tool to get prototype wrapper 
classes. I guess I was hoping for some form of annotation to be able to 
express this on the interface. Seems like something that should have been 
defined in the JAX WS spec. 

Chris 




Daniel Kulp <[EMAIL PROTECTED]> 
04/03/2008 03:27 PM
Please respond to
[email protected]


To
[email protected]
cc
cmathrusse <[EMAIL PROTECTED]>
Subject
Re: How to make paramters on WebMethod required







In all honesty, the ONLY way to do this with JAX-WS is to write some 
wrapper classes that specify the required=true flags on the XmlElement 
annotations.   For the most part, you can run the java2wsdl/java2ws tool 
with the -wrapperClasses flag to have it generate prototype .java files 
that you can hand edit. 

I keep thinking about creating a special @NotNull or @Required annotation 
or something that could be used to extend the jaxws stuff, just haven't 
had any time to do it.  :-(


Dan




On Thursday 03 April 2008, cmathrusse wrote:
> I've got my WebService defined as follows:
>
> @WebService(targetNamespace = "http://cosmos.it.sybase.com";, name =
> "CosmosBroker")
> @SOAPBinding(parameterStyle = ParameterStyle.WRAPPED, style =
> Style.DOCUMENT, use = Use.LITERAL)
> public interface CosmosBroker { ...
>
> And I have a method defined:
>     @WebMethod(operationName = "isCustomerActive", action = "")
>     @WebResult(name = "isCustomerActiveReturn")
>                Boolean isCustomerActive(
>                                @WebParam(name = "customerId")
>                                                String customerId) ;
>
> But when the wsdl is generated my complex type looks as follows:
> <xs:complexType name="isCustomerActive">
>   <xs:sequence>
>                <xs:element minOccurs="0" name="customerId" 
type="xs:string"/>
>   </xs:sequence>
> </xs:complexType>
>
> So what do I need to do to make my customerId parameter required?
> (minOccurs="1") or is there even a way to accomplish this?
>
> Thanks for the help...



-- 
J. Daniel Kulp
Principal Engineer, IONA
[EMAIL PROTECTED]
http://www.dankulp.com/blog


Reply via email to