You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Qlimax <en...@gmail.com> on 2008/11/02 18:34:54 UTC
WS package methods returns empty strings
hello this is my first post here...
I hope someone can help me.
So I have 3 classes that makes my WS.
The first class -ConfigReader-, read a config file. (The config file
contains the path of a data file)
The second class -DataReader- , read the data file.
The thirt class -Test- is my web service, that returns me the readed data in
a String format.
when I compile and Run from the console, all fork fine; data are returned.
when I run from Tomcat+Axis
(http://localhost:8080/axis/services/Test?method=getString) i have an Empty
String as Return.
here is the code of my classes:
package Xml;
import java.io.*;
import java.util.*;
public class ConfigReader{
private String nomefile;
public ConfigReader(String nomefile){
this.nomefile=nomefile;
}
public int getLineNumbers(){
int ret=0;
try{
File f=new File(nomefile);
FileInputStream fis=new FileInputStream(f);
InputStreamReader isr=new InputStreamReader(fis);
BufferedReader br=new BufferedReader(isr);
while(br.readLine()!=null) {
ret++;
}
}catch(Exception e){}
return ret;
}
public String getPath(int linenumber){
String path=null;
try{
File f=new File(nomefile);
FileInputStream fis=new FileInputStream(f);
InputStreamReader isr=new InputStreamReader(fis);
BufferedReader br=new BufferedReader(isr);
String linea=null;
for(int i=0;i<linenumber;i++){
linea=br.readLine();
}
String[] strarr=linea.split(" ");
path=strarr[0];
}catch(Exception e){}
return path;
}
}
------------------
package Xml;
import java.io.*;
public class DataReader{
private String Filename;
public DataReader(String name){
Filename=name;
}
public String readCpu(){
String linea=null;
try{
File f=new File(Filename);
FileInputStream fis=new FileInputStream(f);
InputStreamReader isr=new InputStreamReader(fis);
BufferedReader br=new BufferedReader(isr);
linea=br.readLine();
}catch(Exception e){
System.out.println(e);
}
return linea;
}
}
--------------
package Xml;
import java.util.*;
import Xml.*;
public class Test{
public String getString(){
Xml.ConfigReader conf=new Xml.ConfigReader("TestConf");
String s="";
ArrayList<DataReader> list=new ArrayList();
for(int i=0;i<conf.getLineNumbers();i++){
list.add(new Xml.DataReader(conf.getPath(i+1)));
}
for(int i=0;i<conf.getLineNumbers();i++){
s=s+" "+list.get(i).readCpu();
}
return s;
}
public static void main(String[] args){
Xml.Test t=new Xml.Test();
System.out.println(t.getString());
}
}
------------
the TestConf file contains the path of the data file.
TestConf:
C:\Programmi\ApacheSoftwareFoundation\Tomcat6.0\webapps\axis\WEB-INF\classes\Xml\data
the data file contains a number.
data:
214534534
I have deployed using this file wsdd
<deployment
xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="Test" provider="java:RPC">
<parameter name="className" value="Xml.Test"/>
<parameter name="allowedMethods" value="*"/>
</service>
</deployment>
and running the AdminClient.
I think the problem is that I make a list.
When I create Datareader object passing manually the path of the file, then
it works.But with a config file and a list, no.
:-((
pls If somone can help me...
now it's a week that I don't come out of this problem...
PS: sorry for my English
--
View this message in context: http://www.nabble.com/WS-package-methods-returns-empty-strings-tp20291859p20291859.html
Sent from the Axis - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: WS package methods returns empty strings
Posted by Qlimax <en...@gmail.com>.
problem solved
when I tryed to open a file in the same directory of the .class files ; I
made
File f=new File("TestConf");
(that's work with the console)
that's wrong in axis, because the current path of tomcat application is
<TomcatDir>/bin
so I tryed to open a file that does not existed in <TomcatDir>/bin
directory.
(I don't know why, none of exception was raised....)
so the problem is solved:
File f=new File("<the whole path>/TestConf");
:clap:
--
View this message in context: http://www.nabble.com/WS-package-methods-returns-empty-strings-tp20291859p20445521.html
Sent from the Axis - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: WS package methods returns empty strings
Posted by Qlimax <en...@gmail.com>.
Qlimax wrote:
>
> http://www.nabble.com/file/p20294220/Xml.rar Xml.rar
>
> here you can download the whole package, if you want testing my problem.
>
> Many Thanks and regards.
>
Any Ideas? you can try to download the package to test it...
--
View this message in context: http://www.nabble.com/WS-package-methods-returns-empty-strings-tp20291859p20324360.html
Sent from the Axis - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: WS package methods returns empty strings
Posted by Qlimax <en...@gmail.com>.
http://www.nabble.com/file/p20294220/Xml.rar Xml.rar
here you can download the whole package, if you want testing my problem.
Many Thanks and regards.
--
View this message in context: http://www.nabble.com/WS-package-methods-returns-empty-strings-tp20291859p20294220.html
Sent from the Axis - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
AW: WS package methods returns empty strings
Posted by Muthana Al-Temimi <mu...@gmx.de>.
Hi,
you have a problem with the mapping, send me the Test.java I will fix the
problem for you
regards
Muthana
-----Ursprüngliche Nachricht-----
Von: Qlimax [mailto:eneagerber@gmail.com]
Gesendet: Sonntag, 2. November 2008 18:35
An: axis-user@ws.apache.org
Betreff: WS package methods returns empty strings
hello this is my first post here...
I hope someone can help me.
So I have 3 classes that makes my WS.
The first class -ConfigReader-, read a config file. (The config file
contains the path of a data file)
The second class -DataReader- , read the data file.
The thirt class -Test- is my web service, that returns me the readed data in
a String format.
when I compile and Run from the console, all fork fine; data are returned.
when I run from Tomcat+Axis
(http://localhost:8080/axis/services/Test?method=getString) i have an Empty
String as Return.
here is the code of my classes:
package Xml;
import java.io.*;
import java.util.*;
public class ConfigReader{
private String nomefile;
public ConfigReader(String nomefile){
this.nomefile=nomefile;
}
public int getLineNumbers(){
int ret=0;
try{
File f=new File(nomefile);
FileInputStream fis=new FileInputStream(f);
InputStreamReader isr=new
InputStreamReader(fis);
BufferedReader br=new BufferedReader(isr);
while(br.readLine()!=null) {
ret++;
}
}catch(Exception e){}
return ret;
}
public String getPath(int linenumber){
String path=null;
try{
File f=new File(nomefile);
FileInputStream fis=new FileInputStream(f);
InputStreamReader isr=new
InputStreamReader(fis);
BufferedReader br=new BufferedReader(isr);
String linea=null;
for(int i=0;i<linenumber;i++){
linea=br.readLine();
}
String[] strarr=linea.split(" ");
path=strarr[0];
}catch(Exception e){}
return path;
}
}
------------------
package Xml;
import java.io.*;
public class DataReader{
private String Filename;
public DataReader(String name){
Filename=name;
}
public String readCpu(){
String linea=null;
try{
File f=new File(Filename);
FileInputStream fis=new FileInputStream(f);
InputStreamReader isr=new InputStreamReader(fis);
BufferedReader br=new BufferedReader(isr);
linea=br.readLine();
}catch(Exception e){
System.out.println(e);
}
return linea;
}
}
--------------
package Xml;
import java.util.*;
import Xml.*;
public class Test{
public String getString(){
Xml.ConfigReader conf=new Xml.ConfigReader("TestConf");
String s="";
ArrayList<DataReader> list=new ArrayList();
for(int i=0;i<conf.getLineNumbers();i++){
list.add(new Xml.DataReader(conf.getPath(i+1)));
}
for(int i=0;i<conf.getLineNumbers();i++){
s=s+" "+list.get(i).readCpu();
}
return s;
}
public static void main(String[] args){
Xml.Test t=new Xml.Test();
System.out.println(t.getString());
}
}
------------
the TestConf file contains the path of the data file.
TestConf:
C:\Programmi\ApacheSoftwareFoundation\Tomcat6.0\webapps\axis\WEB-INF\classes
\Xml\data
the data file contains a number.
data:
214534534
I have deployed using this file wsdd
<deployment
xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="Test" provider="java:RPC">
<parameter name="className" value="Xml.Test"/>
<parameter name="allowedMethods" value="*"/>
</service>
</deployment>
and running the AdminClient.
I think the problem is that I make a list.
When I create Datareader object passing manually the path of the file, then
it works.But with a config file and a list, no.
:-((
pls If somone can help me...
now it's a week that I don't come out of this problem...
PS: sorry for my English
--
View this message in context:
http://www.nabble.com/WS-package-methods-returns-empty-strings-tp20291859p20
291859.html
Sent from the Axis - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org