That is what I also figured out but if you look at the sample code I was wonder stuck and though that may be AXIS makes things work differntly:


I am attaching the samples I have downloaded:

Calulator.java/jws

public class Calculator {
public int add(int i1, int i2)
{
return i1 + i2;
}


public int subtract(int i1, int i2)
{
return i1 - i2;
}
}


CalcClient.java

package samples.userguide.example2;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import org.apache.axis.utils.Options;

import javax.xml.rpc.ParameterMode;

public class CalcClient {
public static void main(String [] args) throws Exception {
Options options = new Options(args);

String endpoint = "http://localhost:"; + options.getPort() +
"/axis/Calculator.jws";

// Do argument checking
args = options.getRemainingArgs();

if (args == null || args.length != 3) {
System.err.println("Usage: CalcClient <add|subtract arg1 arg2");
return;
}

String method = args[0];
if (!(method.equals("add") || method.equals("subtract"))) {
System.err.println("Usage: CalcClient <add|subtract arg1 arg2");
return;
}

// Make the call
Integer i1 = new Integer(args[1]);
Integer i2 = new Integer(args[2]);

Service service = new Service();
Call call = (Call) service.createCall();

call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName( method );
call.addParameter("op1", XMLType.XSD_INT, ParameterMode.IN);
call.addParameter("op2", XMLType.XSD_INT, ParameterMode.IN);
call.setReturnType(XMLType.XSD_INT);

Integer ret = (Integer) call.invoke( new Object [] { i1, i2 });

System.out.println("Got result : " + ret);
}
}


I mean if you can solve this for me I can really go ahead to learn this stuff.

Regards,

BP






_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail

Reply via email to