String endpoint = "http://localhost:8080/axis/AddFunction.jws";
Service service = new Service();
Call call = (Call) service.createCall();
call.setOperationName(new QName(endpoint, "addInt")); // what is
QName ?
call.setTargetEndpointAddress( new java.net.URL(endpoint) ); //
what this does ?
Integer ret = (Integer)call.invoke(new Object[]{new Integer(5),
new Integer(6)});
hi, i dont understand the commented questions. can you please answer ?
thanks
gk - 01 May 2006 05:18 GMT
/ File: AddFunction.jws
public class AddFunction {
int addInt(int a, int b){
return(a+b);
}
}
In original function in the server side we had
int addInt(int a, int b)
but the client side is calling this way....
Integer ret = (Integer)call.invoke(new Object[]{new Integer(5),new
Integer(6)});
why they are making Integer(5),Integer(6)....why not simplty int as in
the server side function ?
gk - 01 May 2006 05:38 GMT
Mike Schilling - 01 May 2006 07:37 GMT
>/ File: AddFunction.jws
> public class AddFunction {
[quoted text clipped - 13 lines]
> why they are making Integer(5),Integer(6)....why not simplty int as in
> the server side function ?
Because invoke() always uses an array of Object to hold parameters, and
int's aren't Objects.
Roedy Green - 01 May 2006 05:43 GMT
> call.setOperationName(new QName(endpoint, "addInt")); // what is
>QName ?
I would interpret the question to mean "Show me the code for class
QName"

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
gk - 01 May 2006 05:59 GMT
ok....here is the full code
import javax.xml.rpc.Call;
import javax.xml.rpc.Service;
import javax.xml.namespace.QName;
public class AddFunctionClient {
public static void main(String [] args) {
try {
String endpoint = "http://localhost:8080/axis/AddFunction.jws";
Service service = new Service();
Call call = (Call) service.createCall();
call.setOperationName(new QName(endpoint, "addInt"));
call.setTargetEndpointAddress( new java.net.URL(endpoint) );
Integer ret = (Integer)call.invoke(new Object[]{new Integer(5),
new Integer(6)});
System.out.println("addInt(5, 6) = " + ret);
} catch (Exception e) {
System.err.println("Execution failed. Exception: " + e);
}
}
}
Mike Schilling - 01 May 2006 07:36 GMT
> String endpoint = "http://localhost:8080/axis/AddFunction.jws";
> Service service = new Service();
> Call call = (Call) service.createCall();
> call.setOperationName(new QName(endpoint, "addInt")); // what is
> QName ?
A qualified name, like an XML tag anme: a namespace plus a local name.
> call.setTargetEndpointAddress( new java.net.URL(endpoint) ); //
> what this does ?
It sets the address the message will be sent to.