• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Dynamically creating client Stubs based on wsdl

 
Ranch Hand
Posts: 1252
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic