Hi
 I have implemented the ServiceLifecycle interface method in my web service 
implementation class and trying to read some input parameters from my web.xml. But, I 
don't see the input parameters at all in my "init" method even though I am able to 
print out other details like the real path to a couple of folders. Any ideas? Would be 
extremely grateful if somebody can take a quick look at this and help. I looked for 
typos in the web.xml but couldn't find any. Went to the extent of copying the init 
parameter section from the "SOAPMonitorService" of the web.xml.   Please see below for 
complete details -

Configuration - Axis 1.1; Tomcat 4.1.27; Java version is 1.4.2.

Output that comes on the console ( web.xml and code snippets are pasted after the 
output)-
--------------------------------------------------------------------------------------------------------------------
This is the init method of the service implementation-----
parameter names ----


attribute names ---
org.apache.catalina.jsp_classpath
javax.servlet.context.tempdir
org.apache.catalina.resources
AxisEngine
org.apache.catalina.WELCOME_FILES


Getting parameter values......
firstParam null
secondParam null


Misc values extracted from context......
server into Apache Tomcat/4.1.27
real path of / C:\workarea\ebtcWebServices\
real path of /docs C:\workarea\ebtcWebServices\docs
ctx.getMajorVersion() 2
ctx.getMinorVersion() 3
--------------------------------------------------------------------------------------------------------------------

The relevant snippet from my web.xml - 
----------------------------------------------------------------------------------------
<web-app>
  <display-name>Apache-Axis</display-name>
  <servlet>
    <servlet-name>AxisServlet</servlet-name>
    <display-name>Apache-Axis Servlet</display-name>
    <servlet-class>
        org.apache.axis.transport.http.AxisServlet
    </servlet-class>

    <init-param>
      <param-name>firstParam</param-name>
      <param-value>firstValue</param-value>
    </init-param>

    <init-param>
      <param-name>secondParam</param-name>
      <param-value>secondValue</param-value>
    </init-param>
  </servlet>
----------------------------------------------------------------------------------------

My init method looks like this-
-----------------------------------------------------------------------------------------
  public void init(Object context)
  {
    System.out.println("This is the init method of the service implementation-----");

    ServletEndpointContext servletEndPointCtx = (ServletEndpointContext) context;
    ServletContext ctx = servletEndPointCtx.getServletContext();

    System.out.println("parameter names ----");
    Enumeration paramNames = ctx.getInitParameterNames();
    while (paramNames.hasMoreElements())
    {
      System.out.println(paramNames.nextElement());
    }
    System.out.println("");
    System.out.println("");

    System.out.println("attribute names ---");
    Enumeration attributes = ctx.getAttributeNames();
    while (attributes.hasMoreElements())
    {
      System.out.println(attributes.nextElement());
    }
    System.out.println("");
    System.out.println("");

    System.out.println("Getting parameter values......");
    System.out.println("firstParam "+ctx.getInitParameter("firstParam"));
    System.out.println("secondParam "+ctx.getInitParameter("secondParam"));
    System.out.println("");
    System.out.println("");

    System.out.println("Misc values extracted from context......");
    System.out.println("server into "+ctx.getServerInfo() );
    System.out.println("real path of / "+ ctx.getRealPath("/"));
    System.out.println("real path of /docs "+ ctx.getRealPath("/docs"));
    System.out.println("ctx.getMajorVersion() "+ctx.getMajorVersion());
    System.out.println("ctx.getMinorVersion() "+ctx.getMinorVersion());
  }
----------------------------------

Thanks
Srinivas

Reply via email to