This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Axis2 question

 
Melinda Savoy
Ranch Hand
Posts: 387
Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Eclipse 3.6.1-SR1, if I have 2 constructors in my service class and then create a new Web Service Client using Axis2, will the stub account for the 2 constructors?

Any help/direction would be appreciated.

Regards.
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The service class should have just one constructor - it's public, and takes no parameters. How would any other constructors be called? What's more, constructors are not part of the WSDL. Maybe we're talking about different things?
 
Melinda Savoy
Ranch Hand
Posts: 387
Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf, thanks for the reply. I have an additional constructor that is called for my DAO code and I don't have any idea how to call that if it is not in the stub? Being a newbie to Web Services, can you please give me some direction here?

Again, your reply is appreciated. Regards.
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by "called for my DAO code"? The DAO code wouldn't call the web service class; maybe the web service class calls the DAO code.

But again, constructors are not part of the WSDL - the web service engine uses the no-argument constructor to instantiate the web service class; no other part of the software should be using (or instantiating) the web service class. The methods of the service class are then called via the web service operations (which are listed in the WSDL).

Maybe you can provide some more detail on why and how you intend to use constructors.
 
Melinda Savoy
Ranch Hand
Posts: 387
Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I meant to say that I needed the 2nd constructor set by the web service and that the constructor has a parameter. If the WSDL web service engine uses the no-argument constructor what can I use to call the DAO constructor? Again, thank you very much for any help/direction. Regards.

Here is my service class:



 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There will not be another constructor, period. Or, to be more precise, you can put one there, but it won't get used. Your code is not in charge of instantiating service classes - the WS engine is, and it will use the no-argument constructor.

What it looks like is that the service class needs a DAO object to do its work. Since you can't pass it in via a constructor, you need to find some other way to do so. Maybe the service class could call a static factory method that retrieves the object (assuming that DAO objects are thread-safe and can be reused):

If DAOs are not threadsafe, or can't be reused, you need to get a new one each time:
 
Melinda Savoy
Ranch Hand
Posts: 387
Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf, thanks again for the help/clarification on how this works. I will try what you've suggested and see if that works. If you don't mind one additional question. If I add another method, like validatingUserID and validateNECCode, etc how can I update the web service client and the WSDL that is in my Eclipse dynamic web project?

Again, thank you for your help. Regards.
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not an Eclipse user, so I can't help with that. I would expect the Axis plugin (or SOAP plugin, or whatever it is) either to regenerate the WSDL automatically whenever it detects changes to the service class, or there to be a menu option to regenerate the WSDL.
 
Melinda Savoy
Ranch Hand
Posts: 387
Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
 
sweety kamal
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Right click on project ->select webservices regenertae client and server again and it will automatically generate the rest of the thing
 
Melinda Savoy
Ranch Hand
Posts: 387
Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. I appreciate the reply.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic