Janet
This
is a bit clunky, but it should do the job ...
Properties env = new
Properties();
env.load(Runtime.getRuntime().exec("env").getInputStream());
String webServHome = (String)env.get("CATALINA_HOME");
String absPath =
webServHome.concat("/webapps/axis/yourTargetDir/");
env.load(Runtime.getRuntime().exec("env").getInputStream());
String webServHome = (String)env.get("CATALINA_HOME");
String absPath =
webServHome.concat("/webapps/axis/yourTargetDir/");
// open file
stream
File filename = new File(absPath, "test.xml");
FileReader fis = new FileReader(filename);
BufferedReader br = new BufferedReader(fis);
StringBuffer buf = new StringBuffer();
String inp;
File filename = new File(absPath, "test.xml");
FileReader fis = new FileReader(filename);
BufferedReader br = new BufferedReader(fis);
StringBuffer buf = new StringBuffer();
String inp;
while (br.ready())
{
buf.append((char) br.read());
}
buf.append((char) br.read());
}
etc
...
Patrick
=00This e-mail and any attachments may be confidential and/or legally privileged. If you have received this e-mail and you are not a named addressee, please inform Evolving Systems TIS at [EMAIL PROTECTED] and then delete the e-mail from your system. If you are not a named addressee you must not use, disclose, distribute, copy, print or rely on this e-mail. To ensure regulatory compliance and for the protection of our clients and business, Evolving Systems may monitor and read e-mails sent to and from its servers. Although Evolving Systems routinely screens for viruses, addressees should scan this e-mail and any attachments for viruses. Evolving Systems makes no representation or warranty as to the absence of viruses in this e-mail or any attachments.-----Original Message-----
From: Miller, Janet [mailto:[EMAIL PROTECTED]
Sent: 07 July 2005 19:41
To: [email protected]
Subject: Web Service reading file from diskI 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 aFileNotFoundException. I've tried putting the input file in various places including Tomcat/common/libsTomcat/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 possibleto do this and if so, where I need to put the file? I'm not specifying a directory name in my codewhen I try to open the file, but maybe I need to.Thanks, JanException in thread "main" AxisFault
faultCode: {
http://schemas.xmlsoap.org/soap/envelope/}Server.userExceptionfaultSubcode:
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
Registered Office: One Angel Square, Torrents Street, London. EC1V 1PL. Registered number 2325854
