axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carolyn Vo" <>
Subject RE: dynamic web service location?
Date Thu, 02 Jun 2005 15:41:47 GMT

Hi Jan,

Thanks for the email.  I figured out how to do it finally, from both Java
and C# clients consuming the Java-based web service.  I wrote command-line
applications in both languages, and then for the Java client I used a
constructor I created in the Locator class generated that takes a server
name as a string as its only parameter.  If the user used the default
constructor with no parameters, then the default server of "localhost" is

	/** In my class ModelCalculationServiceLocator **/
	public ModelCalculationServiceLocator(String server) {
      	ModelCalculation_address = "http://" + server
            	+ "/acorneps/acornpa/services/ModelCalculation";

In the C# client, I had to implement a constructor in the Reference.cs class
that is generated by Visual Studio.NET so that it takes a server name as a
string as its only parameter.

	public ModelCalculationService(string server) 
		this.Url = "http://" + server +

All in all, it was extremely clean and simple to do (the hard part was
figuring out WHERE for the C# client) and I didn't have to call the
setTargetEndpointAddress method myself, since all I basically had to do was
override the variables that were used to reference as the endpoint.  No need
to go through UDDI or anything complicated like that.  Whew!

Thanks for everyone's help on this!  :)

-----Original Message-----
From: Jan Delannoy [] 
Sent: Thursday, June 02, 2005 12:43 AM
Subject: Re: dynamic web service location?

Hi Carolyn,

I can't really help you with the 'discovering' part (I think you just
have to implement it yourself for now), but once you know the address
there is a method setTargetEndpointAddress( address) on
the org.apache.axis.client.Call class.  If you use stubs generated by
WSDL2Java there will be a method on the ServiceLocator class that
takes a URL and will call this method for you.


On 6/1/05, Carolyn Vo <> wrote:
> Looks like there is something in the Axis docs but is not completed yet on
> how to accomplish this:
> "Dynamically Discovering and Binding to a Web Service
> When Axis generates client proxy classes code from WSDL, it binds the code
> to the endpoint URL specified in the WSDL -this is usually a URL generated
> from the URL of the inbound request. Using a http://localhost URL to fetch
> WSDL page will result in client code also bound to a service served up on
> the localhost, which is not what you want in a redistributable. Similarly,
> even if you use the hostname when fetching the WSDL, you need the fully
> qualified domain name, not any short name - and not
> http://s1/ -otherwise only callers in your own domain or subnet will be
> to find the server. Hand-written WSDL does not exhibit this problem; the
> endpoint in the WSDL is the one the author typed in.
> It is almost essential that you provide some way to update the URL on the
> clients. The simplest is some command line override option, as used in the
> Axis command line tools. More advanced is a dialog box for entering URLs,
> and more advanced yet is some automated discovery mechanism.
> Axis does not provide any discovery mechanism in the JAR. There is a
> project, jUDDI, that provides access to UDDI registries. There is also a
> multicast discovery jar that works with Axis in the Axis CVS tree; this is
> proof-of-concept mechanism that uses XML messages but is not compatible
> any existing standard. It works OK over LAN networks, but is not designed
> be used over wider area.
> TODO: how to set the URL in a service"
> Anyone have any ideas on how to accomplish this?  Thanks!
> -----Original Message-----
> From: James Taylor []
> Sent: Tuesday, May 31, 2005 6:03 PM
> To:
> Subject: Re: dynamic web service location?
> Think you may have to configure tomcat or your webapp to listen on a port
> and
> access your service through there. Not sure how to do this!!
> Quoting Carolyn Vo <>:
> > Hello,
> >
> >
> >
> > Is it possible to specify the server and port number for a web service
> > during runtime?  The default in my wsdl file is hardcoded to
> localhost:8080
> > but I want the user to be able to specify it during runtime.  How is
> > possible?
> >
> >
> >
> > Thanks,
> >
> > Carolyn
> >
> >
> --
> Between the question and the answer lies free will

View raw message