axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Muthana Al-Temimi" <muth...@gmx.de>
Subject AW: WS package methods returns empty strings
Date Sun, 02 Nov 2008 20:24:56 GMT
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


Mime
View raw message