How can i provide run time parameters to webservice


XML & Web services: How can i provide run time parameters to webservice

  1. I am using weblogic workshop 8.1 for developing a web service. I want to provide some run time environment specific parameters to the web service to avoid the hard coding. the web service (jws file) talks a EJB. the ejb is deployed on certain host. I do not want to hard-code this lookup url in the jws file. I want to keep it in some descriptor as a env entry. At run-time i shd be able to look up this env entry from jws file and use the url for looking up the home interface.

    Now my problem is : using weblogic workshop, the webservice (jws file) gets wrapped into a war. I tried providing env entries in the web.xml of the war. that did not helped. So what i want to know where do i specify this env entry so that the jws files can look up
  2. Here is a standard trick:

    1) Write your own custom config file. A .properties file or an XML file is common.

    2) Load that file using the class loader. The Class.getResourceAsStream() method will do the trick.

    3) Deploy the property file in the same JAR/WAR/EAR as your class/jws file.