1 Reply Latest reply on Aug 9, 2004 12:10 PM by mschoning

    Accessing request url from the web service bean?

    neilblue

      Hello,

      I am trying to access the request url from within a web service bean. As the usual axis service message context returns a null:

      MessageContext.getCurrentContext();

      Thanks
      Neil

        • 1. Re: Accessing request url from the web service bean?
          mschoning

          If you with a web service bean refer to your EJB, then I don't think you can find the request URL there. You probably want to create an interceptor, by extending Basichandler and register your new interceptor in the web-service.xml file.

          In your interceptor you can then get the request object like this:
          HttpServletRequest req = (HttpServletRequest) msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST);

          The of course you can get the URL like this
          req.getRequestURI();

          If you need this information in the bean, you will have to pass it to the bean. I don't know a clean and nice way to do it. You might be able to add it to a field in the request object for the bean. But you are probably safer saving it to some db and then reading it from that db in the bean, You will have to come up with some key to identify the entry. But I don't think it sounds like a good design to have an ejb worrying about the URL that called a webservice maybe you can do what you intended the bean to do, in the interceptor instead?

          good luck, Mike