This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setting nillable and minOccurs Values in AXIS2 service.xml

 
Mathias Schmidt
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 88
Java Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please at least search before posting, see here
 
Naren Chivukula
Ranch Hand
Posts: 577
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Mathias Schmidt
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 577
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 577
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 577
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic