Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dynamically calling WebServices

 
Will Myers
Ranch Hand
Posts: 381
Java jQuery Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't you expect these new web services to publish their WSDL?

Bill
 
Will Myers
Ranch Hand
Posts: 381
Java jQuery Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 381
Java jQuery Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 381
Java jQuery Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In case you are interested here's my code:



and the config file:



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic