Hi Chris, The code snippets I sent you were for my application. The idea was to show you how to get the ServletContext from the Axis MessageContext.
Basically I use the ServletContext to locate a property file I use that contains information on how my service locates a EJB on another server that I am exposing as a WebService. For you, once you have the ServletContext you are back in the J2EE world or Servlets and can now use the all features available from a ServletContext including getting servlet startup properties as defined in your web.xml file. Regards Steve Quoting Chris Aiken <[EMAIL PROTECTED]>: > Hi Steve! > > I always get: service.properties file not found. Will use defaults > with no further error message. > > What should I do now? > > > Thanks for help! > Chris > > > -----Urspr�ngliche Nachricht----- > Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Gesendet: Samstag, 20. M�rz 2004 15:37 > An: [EMAIL PROTECTED] > Betreff: Re: How I get the <AxisServlet URL> within Axis? > > Hi Chris, > > Here is some code I use from within my WebSevice to access a property file > within the Web Context. > > Hope this helps.... > > > org.apache.axis.MessageContext axisContext = > org.apache.axis.MessageContext.getCurrentContext(); > javax.servlet.ServletContext sc = > ((javax.servlet.http.HttpServlet)axisContext.getProperty > (org.apache.axis.transport.http.HTTPConstants.MC_HTTP_SERVLET)).getServletCo > ntex > t(); > > String path = sc.getRealPath("/WEB-INF/service.properties"); > // now get the properties for the server and EJB location > information > java.util.Properties props = new java.util.Properties(); > > try { > props.load(new java.io.FileInputStream(path)); > } > catch(java.io.FileNotFoundException fnfe) { > sc.log("service.properties file not found. Will use > defaults." + fnfe.getMessage()); > System.out.println("service.properties file not > found. > Will use defaults"); > } > > catch(java.io.IOException ioe) { > sc.log("service.properties file not loaded. Will use > > defaults." + ioe.getMessage()); > System.out.println("service.properties file not > loaded. > Will use defaults"); > } > > String server = props.getProperty("EJBServer", "127.0.0.1"); > String port= props.getProperty("EJBServerPort", "7001"); > String ejb= props.getProperty("EJBJNDIName", "SoapBean"); > > Regards > > Steve > > > Quoting Chris Aiken <[EMAIL PROTECTED]>: > > > Hi together! > > > > How I get the current <AxisServlet host>, <AxisServlet port> and <path to > > the AxisServlet> or the <AxisServlet URL> within Axis??? > > > > I had no success with <msgContext.getProperty("I_have_tried_all_keys")>. > > > > > > Thanks a lot for help, > > Chris > > > > > > > > > > > > > --------------------------------------------------- > This message was sent using Spansurf Web Mail > Internet access in Spain - http://www.spansurf.com/ > > --------------------------------------------------- This message was sent using Spansurf Web Mail Internet access in Spain - http://www.spansurf.com/
