users@jax-rpc.java.net

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

From: Guadalupe Ortiz <gobellot_at_hotmail.com>
Date: Thu, 13 May 2004 12:28:46 +0200

I got it!!! I got it using one servlet context attribute value. Thank-you
very much for your help, it was very useful for me!
Gobellot
----- Original Message -----
From: "Andy Wolf" <andy.wolf_at_schwaben.de>
To: <users_at_jax-rpc.dev.java.net>
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
it,
> > please? and how do I use the information you provided me for example
inside
> > the method "bookAvailability" to get the context if it is posible in
this
> > 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: users-unsubscribe_at_jax-rpc.dev.java.net
> For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net