axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guerai x <rino.raim...@gmail.com>
Subject Re: Web Service reading file from disk
Date Fri, 08 Jul 2005 14:57:01 GMT
If you want to read a file from a specified path you can use in yor server

MessageContext msgContext = MessageContext.getCurrentContext();
		 HttpServlet servlet =
					(HttpServlet)msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLET);
		 ServletContext ctx = servlet.getServletContext();
			
		 String file = ctx.getRealPath(*** FILE NAME ***);

with this tecnique you arrive to your axis folder and you can put your
file there or if you want you can use axis folder as base folder to
arrive where you want



2005/7/7, Miller, Janet <MillerJa@pbworld.com>:
>  
> I am developing a test web service and I would like it to read a test input
> data file from disk. 
> I have successfully deployed my web service and have been able to access it
> via a client. 
> However, when I modify the code to read an input file, it cannot find the
> file and I get a 
> FileNotFoundException.  I've tried putting the input file in various places
> including Tomcat/common/libs 
> Tomcat/webapps, Tomcat/webapps/axis, Tomcat/webapps/axis/WEB-IN,
> Tomcat/webapps/axis/WEB-INF/classes, 
> Tomcat/webapps/axis/WEB-INF, ... 
>   
> I'm using Tomcat 5.5.9 and Axis 1.2.1 on Windows 2000.  Does anyone know if
> it is possible 
> to do this and if so, where I need to put the file?  I'm not specifying a
> directory name in my code 
> when I try to open the file, but maybe I need to. 
>   
> Thanks, Jan 
>   
>  
> 
> Exception in thread "main" AxisFault 
> 
> faultCode:
> {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
> 
> faultSubcode: 
> 
> faultString: java.rmi.RemoteException: Data source file
> 'TollTransactionRecord.xml' does not exist or cannot be opened. Reason:
> java.io.FileNotFoundException: TollTransactionRecord.xml (The system cannot
> find the file specified) 
> 
> faultActor: 
> 
> faultNode: 
> 
> faultDetail: 
> 
> {http://xml.apache.org/axis/}hostname:W-ROCSOF035

Mime
View raw message