aspose file tools*
The moose likes Web Services and the fly likes setting nillable and minOccurs Values in AXIS2 service.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "setting nillable and minOccurs Values in AXIS2 service.xml " Watch "setting nillable and minOccurs Values in AXIS2 service.xml " New topic
Author

setting nillable and minOccurs Values in AXIS2 service.xml

Mathias Schmidt
Greenhorn

Joined: Dec 09, 2010
Posts: 8
Hello there,
i use a pojo based AXIS2 WS(AXIS2 1.5.4, Java 1.6) and want to set the nillable and minOccurs values (which show up in the generated WSDL) for the operation parameters. Can this values be set in the service.xml? If not where can this be set?

thanks in advance
Shashank Ag
Ranch Hand

Joined: Dec 22, 2009
Posts: 88

Please at least search before posting, see here


SCJP 91%, SCWCD 97%
Naren Chivukula
Ranch Hand

Joined: Feb 03, 2004
Posts: 577

Hi Mathias,
I understand from your post you know how nillable and minOccurs are generated in WSDL and you'd like to set these values to implement restrictions on your web service incoming request. Is that right? If so, you can straightaway change these values in your generated WSDL and re-generate your web service. If you think this is a hassle, then in your web service implementation class, you can check if the expected element is null or empty String.


Cheers,
Naren
(OCEEJBD6, SCWCD5, SCDJWS, SCJP1.4 and Oracle SQL 1Z0-051)
Mathias Schmidt
Greenhorn

Joined: Dec 09, 2010
Posts: 8
Hello, thanks for your answeres.

the WSDL is generated at runtime from the pojo i specify in the service.xml, so i cannot and want to make any changes to it. I just need a way to tell AXIS2 to use custom nillable and maxoccour values for the WSDL generation.
Naren Chivukula
Ranch Hand

Joined: Feb 03, 2004
Posts: 577

Hi Mathias,
the WSDL is generated at runtime from the pojo i specify in the service.xml, so i cannot and want to make any changes to it

If you can't change WSDL, why don't you change your POJO for Axis2 to pick up and generate accordingly in WSDL?
Mathias Schmidt
Greenhorn

Joined: Dec 09, 2010
Posts: 8
Hi Naren,
sorry i am not quite sure if i understood your posting so i clear out my ploblem. I want to keep my Webservice based on the pojo class not on the WSDL. So AXIS2 generates the WSDL by looking at the pojo. Due to WSDL is more complex than the pojo, the AXIS2 engine makes assumptions to generate the WSDL. This assumptions include the nillable and minOccurs values. I want to keep the pojo base just because i think it is more easy to understand and maintain than a WSDL. I just need a way to tell the engine which default values he should take as nillable and minOccurs values. If this is can be achived via editing the pojo or the service.xml (or anythink else but the WSDL) i want to do this.

thanks in advance
Naren Chivukula
Ranch Hand

Joined: Feb 03, 2004
Posts: 577

Hi Mathias,
If this is can be achived via editing the pojo or the service.xml (or anythink else but the WSDL) i want to do this.

I don't know if there is a way to set nillable and minOccurs values in Axis2 services.xml. These attributes are intended to be used at the application level rather at deployment level. So, only way I think is to either change in WSDL/XSD or in POJO classes. As you are saying changing WSDL could be complex, all I was suggesting is to do in your POJO class.
Mathias Schmidt
Greenhorn

Joined: Dec 09, 2010
Posts: 8
again thanks for the response Naren,
i already thought about modifing the pojo but i dont know what to do exactly. I tried JAX-WS annotations but this doesnt offer the ability to set the nillable and minOccurs Values....
Naren Chivukula
Ranch Hand

Joined: Feb 03, 2004
Posts: 577

Hi,
I tried JAX-WS annotations but this doesnt offer the ability to set the nillable and minOccurs Values....

As I mentioned in my earlier replies, services.xml is meant to configure deployment details but not at the business logic level. If you don't have annotations for these, other than changing WSDL you can have conditional blocks in your implementation code, which check for nillable and minOccurs and take measures accordingly.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: setting nillable and minOccurs Values in AXIS2 service.xml