Do you really need to have a web service calling another web service directly?

This adds more things to consider (exceptions to handle, as you've found).

You can easily add
import java.rmi.RemoteException;

To Sum6.jws

But wouldn't it be easier to have the Sum class in a .jar in the web 
application lib directory, and import that class for all the web services that 
need to call it internally. This way there's only one web service call, and 
it's come from the external client?

Just a thought: hope this helps,


Patrick

p.s. you also need to change the return statement to return ret.intValue();



-----Original Message-----
From: psm041 [mailto:[EMAIL PROTECTED] 
Sent: 06 January 2005 16:09
To: [EMAIL PROTECTED]
Subject: Importing packages


Hi all, im new to the list (and to axis too) and i have one question to 
start... 

I`ve published the following service just for test and all went well 
(Sum.jws): 


public class Sum { 
   public int sum(int valor1, int valor2) { 
      return valor1 + valor2; 
   } 
} 


Now i want to publish another service that uses the one above, here is the 
code (Sum6.jws): 


import org.apache.axis.client.Service; 
import org.apache.axis.client.Call; 

public class Sum6 { 
        public int sum(int valor1) 
        { 
                String local = "http://localhost:8081/axis/Sum.jws";; 
                Call call = (Call) new Service().createCall(); 
                call.setTargetEndpointAddress(local); 
                call.setOperationName("sum"); 
                Object[] param = new Object[]{new Integer(valor1), Integer(6)} 
                Integer ret = (Integer)call.invoke(param); 
                return ret; 
        } 
} 


...and i've got the following from axis (while generating wsdl): 


AXIS error 

Sorry, something seems to have gone wrong... here are the details: 

Fault - Error while compiling:  
/usr/local/jakarta-tomcat-4.1.27/webapps/axis/WEB-INF/jwsClasses/Soma6.java 

AxisFault 
 faultCode: {http://xml.apache.org/axis/}Server.compileError 
 faultSubcode: 
 faultString: Error while compiling:  
/usr/local/jakarta-tomcat-4.1.27/webapps/axis/WEB-INF/jwsClasses/Soma6.java 
 faultActor: 
 faultNode: 
 faultDetail: 
        {}Errors: Error compiling 
/usr/local/jakarta-tomcat-4.1.27/webapps/axis/WEB-INF/jwsClasses/Soma6.java: 
Line 0, column 0: could not parse error message:  Note: sun.tools.javac.Main 
has been deprecated. 
/usr/local/jakarta-tomcat-4.1.27/webapps/axis/WEB-INF/jwsClasses/Soma6.java:10: 
Exception javax.xml.rpc.ServiceException must be caught, or it must be 
declared in the throws clause of this method. 
                Call call = (Call) new Service().createCall(); 
                                                           ^ 

Line 14, column 7:  Method Integer(int) not found in class Soma6. 
Line 15, column 36:  Exception java.rmi.RemoteException must be caught, or 
it must be declared in the throws clause of this method. 
Line 16, column 2:  Incompatible type for return. Can't convert 
java.lang.Integer to int. 
Line 0, column 0: 
4 errors, 1 warning 

ps: i've put axis.jar file in 
/usr/local/jakarta-tomcat-4.1.27/webapps/axis/WEB-INF/classes/ directory for 
the imports, right? 

Any help will be REALLY appreciated :) 
Paulo Sérgio. 

Reply via email to