wood burning stoves 2.0*
The moose likes Web Services and the fly likes Dynamically calling WebServices Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Dynamically calling WebServices" Watch "Dynamically calling WebServices" New topic
Author

Dynamically calling WebServices

Will Myers
Ranch Hand

Joined: Aug 05, 2009
Posts: 319

Hi,
I'm trying to write a simple(!) application that will call a webservice depending on the arguments passed into the main method. The idea is that the app loads an xml file on start-up and uses that to bind to a webservice, something like:



The xml file needs to be able to change to accomodate new webservices as when they are added so I don't want to have to rebuild everytime.

Is there a way to do this? Everything I've read so far all involve hard coding a wsdl somwhere and generating the endpoints via a build tool....
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12757
    
    5
Don't you expect these new web services to publish their WSDL?

Bill
Will Myers
Ranch Hand

Joined: Aug 05, 2009
Posts: 319

Ths WSDLs are published but what I want to do is write the code once and then if I want to add another webservice later just add to the xml not rebuild the app.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12757
    
    5
Many SOAP toolkits provide tools for automatically creating client-side code by reading a WSDL published by a service.

Now, how do you plan to make any use of an added service without additional programming?

Bill

Will Myers
Ranch Hand

Joined: Aug 05, 2009
Posts: 319

ok, I have got it all working. What I did was 'borrow' the code from here http://faq.javaranch.com/view?WebServicesHowTo#saaj-client.

To access a new web service all I do is add it to the config file and then pass the correct params to the executable jar which loads the config file and calls the web service.
Will Myers
Ranch Hand

Joined: Aug 05, 2009
Posts: 319

In case you are interested here's my code:



and the config file:



 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dynamically calling WebServices
 
Similar Threads
What value to use for <j2ee:param-type> in webservices.xml for Arrays?
on Tproblem while deploying web omcat + JWSDP 1.5
Problem while deploying WebService on Tomcat + JWSDP 1.5
wscompile generating a bad jax-rpc mapping file
Confusion in writing web service client + jax-ws