You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Adam Kurland <Ad...@biospace.com> on 2002/08/15 19:23:16 UTC

I'm a service; What's my endpoint?

I have a need for a web-service implementation class (jax-rpc service class)
to obtain its own serviceEndpoint URL.

I know that in Axis Beta 3, I can get to the ServletContext which "houses"
the class like this:

	MessageContext msgContext = MessageContext.getCurrentContext();
	if (msgContext != null) {
	    ServletContext sc = 
		((HttpServlet)msgContext.getProperty
		 (HTTPConstants.MC_HTTP_SERVLET)).getServletContext();
	    
	    System.err.println("got servletContext");
	    if (sc != null) {
		System.err.println("server info=" + sc.getServerInfo());

But how would I get URL that the client used to get to the this service,
from within the service?, i.e. the axis service endpoint.
Remember that the tail end of the endpoint is contained in a wsdd file as
the service name:
<service name="statefulFRED" provider="java:RPC">
and the first part of the endpoint is the URL to
http://machaine-where-I-installed-axis:port/axis-webapp-name/services 

A Jax-rpc "way" would be nice, but I'd settle for a axis-beta-3-sepcific
way.

By the way, my current workaround is to have the client pass the service
endpoint to the service as the first parameter.  Sort of like calling
someone and telling them their own phone number every time.

Thanks
Adam