java - What happens to all the hard-coded URIs when I move a Web Service? -


I am developing a test ws with JAX-WS and the demo works fine, but if I do it in production I try to move my code to the URL of my test environment. There are many instances for example:

  com.mycompany.testserver.ws.writer.WriterInterface service = new com. Mycompany.testserver.ws.writer.WriterInterface (); QN Port portName = New QN ("http://testserver.mycompany.com/ws/writer.php", "Writer Interface Support"); String REQ = "SOME_XML_HERE"; {// Call Web Service Operation Dispatch & lt; Source & gt; SourceDispatch = null; SourceDispatch = service.createDispatch (portQName, source.class, Service.Mode.PAYLOAD); Source result = sourceDispatch.invoke (new stream resource (new string header (rik)); } Hold (Exception preceding [// tax stuff here]  

What is the best practice to run such an app?

Read the connection URL from the configuration file. You may also have a strongly typed configuration object, which will cache the value, so that it only needs to be read once. Then when you take your app from the test to the production, you only need to update the configuration file.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -