Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Dynamically calling WebServices

 
Ranch Hand
Posts: 462
Scala jQuery Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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....
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't you expect these new web services to publish their WSDL?

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



and the config file:



 
Poop goes in a willow feeder. Wipe with this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic