i have been trying to find a solution for this particular topic:
It is possible to define a default value in a @webParam annotation for a SOAP/WSDL based Web Service? What i want is exactly the following result:
I Have a @WebMethod in my web service called getCustomers with the following signature:
@WebMethod(operationName = "getCustomers")
@WebResult(name = "customer")
public Customer[] getCustomers(@WebParam(name = "company") String company,
@WebParam(name = "limitTop") int limitTop){
//Logic of getting customer be here
}
Particularly, the parameter limitTop is not optional in this method, this number indicates how many customer records you want the response returns, but i want that in my xml schema, this particular element has a default value, something like this:
<xs:complexType name="getCustomers">
<xs:sequence>
<xs:element name="company" type="xs:string" minOccurs="0"/>
**<xs:element name="limitTop" type="xs:int" default="100"/>**
</xs:sequence>
</xs:complexType>
Please notice the default attribute in the element named limitTop
This is in order to allow to the client application send a SOAP message without the limitTop element, but still limit the number of records returned to the default value given in the limitTop element.
I am using Java, JAX-WS, and GlassFish Server Open Source Edition.
Thanks for your help.
Carlo Yañez