Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Dynamically creating client Stubs based on wsdl

 
Shaan Shar
Ranch Hand
Posts: 1249
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
*** I don't intend to ask direct coding******

I am trying to understand Web services architecture and it's working. Basically I have so many Wev services in my application and very frequently we receive updated wsdl's from services. As of now, once we receive it, we create stubs on compile time and update in our code base. I was wondering, if there could be a way where I can create client-stubs on run time based on latest wsdl. This would also help me to not create multiple code bases depending on wsdl.

As I said, if you come across any tutorial/pointers towards it, please share.
 
Ganesh Malaichamy
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) Creating stubs dynamically means you need to run the standard wsdl2java utility to create the stubs and then load the classes using reflection.
But this is not a clean approach. If your consuming application requires those new changes then recompiling and modifying your application is the standard approach.

2) There is Dispatch Client model in JAX-WS programming allows you to create the request messages dynamically from the end points. But the intended use of this feature is different
Take a look at http://www.ibm.com/developerworks/websphere/library/techarticles/0707_thaker/0707_thaker.html

3) If you are concerned more about the code base maintenance then just create a interface to access the client stubs. That way you can treat and maintain the client stubs as a separate artifact.
Then changing the client stub dependency version will solve the problem.
 
Kesava Krishna
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ganesh,

I agree to Ankur. Consider a scenario where the return type of operation has changed in the wsdl, since you said frequently the wsdl's are changing, then suppose if there is a provision to create stubs dynamically at runtime then you would run into class cast exceptions at run time.

Alternatively to totally avoid creating stubs you can try for DII(Dynamic invocation interface) approach. With this approach you don't even need to create stubs.

Thanks,
Kesava
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!