How to access ServletContext from SOAP web service method?

Discussion in 'Java' started by RJGraham, Nov 24, 2003.

  1. RJGraham

    RJGraham Guest


    I have a method in a class exposed as a SOAP web service in a web
    application running under TomCat 4.x and would like this method to get
    access to the web app ServletContext.

    Is this possible?

    I've done a Google search and scoured the SOAP and Servlet javadocs but
    can't see how to do this.

    Thanks for any help.

    RJGraham, Nov 24, 2003
    1. Advertisements

  2. RJGraham

    Sudsy Guest

    I don't think you can since the class will have no idea that it's
    running in a servlet container. Nor should it! That's the whole
    point of the architecture you've chosen. If you want it to know
    about the calling context then implement it some other way.
    You can't have it both ways, you know.
    Sudsy, Nov 25, 2003
    1. Advertisements

  3. RJGraham

    RJGraham Guest

    I want my web service method to share an object with my servlets.
    I can do this with a static but was wondering if ServletContext was

    RJGraham, Nov 25, 2003
  4. RJGraham

    Huang Kai Guest

    why not just use JNDI, to get resource directly from tomcat's configuration?
    Huang Kai, Nov 27, 2003
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.