Re: Can a Web Service know where itself is deployed??

From: Guadalupe Ortiz <>
Date: Mon, 10 May 2004 16:19:07 +0200

I still have doubts. I eliminated the errors (I didnt include comom\lib
before) and "it worked", bit it return me back the context where it is
suposed to be, but where it is not. I mean, I have got only one service and
so only one web.xml. In the web.xml we specify the context name. ut I deploy
the service in two different contexts. So when I invoke it I get the context
indicated in the web.xml file (name "lib"), but not the real one where I am
invoking it (lib2). Can I solve this??
Thank you very much
----- Original Message -----
From: "Andy Wolf" <>
To: <>
Sent: Monday, May 10, 2004 12:29 AM
Subject: Re: Can a Web Service know where itself is deployed??

> Hello,
> Guadalupe Ortiz wrote:
> > I get the next compilation error "This compilation unit indirectly
> > references the mising type javax.servlet.ServletContext" How can I solve
> > please? and how do I use the information you provided me for example
> > the method "bookAvailability" to get the context if it is posible in
> > way??
> What JAX-RPC runtime do you use ? You should have
> javax.servlet.ServletContext within your classpath. In the JWSDP 1.3 it
> is in common/lib/servlet-api.jar. And you have to import the
> ServiceException as well...
> > public boolean bookAvailability (String ISBN) {
> > boolean Result=false;
> String contextName =
> sec.getServletContext().getServletContextName;
> if(contextName.equals("/english")) {
> System.err.println("English context used...");
> }
> > if ((ISBN.compareTo("1111"))==0)
> > Result=true;
> > return Result;
> > }
> See the JavaDocs for ServiceLifecycle, ServletEndpointContext and
> ServletContext for more details.
> Please bear in mind that from a design point of view it might not be a
> good idea to have a service with an identical WSDL interface description
> to behave differently according to the endpoint address. I would rather
> encourage you to use a separate method parameter for this purpose.
> regards...Andy
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail: