我在apache轴2中创建了一个web服务。但我无法从客户端实例化该接口。如何创建一个从接口调用该方法的类?
指导我
服务界面:
public interface BusService extends java.rmi.Remote {
public java.lang.String allepy(java.lang.String starting, java.lang.String ending, java.lang.String comfort) throws java.rmi.RemoteException;
public java.lang.String cochin(java.lang.String starting, java.lang.String ending, java.lang.String comfort) throws java.rmi.RemoteException;
public java.lang.String ooty(java.lang.String starting, java.lang.String ending, java.lang.String comfort) throws java.rmi.RemoteException;
public java.lang.String kanyakumari(java.lang.String starting, java.lang.String ending, java.lang.String comfort) throws java.rmi.RemoteException;
public java.lang.String kodaikanal(java.lang.String starting, java.lang.String ending, java.lang.String comfort) throws java.rmi.RemoteException;
}
我的客户端编码
public class Servicecall {
String luxury="";
String start="";
String end="";
public void services(String start,String end,String comfort) {
try
{
String endpoint="http://localhost:8080/servicecomposition/services/BusService";
Service service=new Service();
Call call=(Call)service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName(new QName("http://schemas.xmlsoap.org/soap/http","allepyReturn"));
String ret = (String) call.invoke( new Object[] {start} );
}
catch(Exception e)
{
System.out.println(e);
}
}
}
在上面的程序中,我从我调用servlet的jsp页面调用服务(我传递了一些争论,并从我调用客户端的servlet中调用。但是当我调用客户端时,我得到了这个错误:
INFO: Server startup in 22641 ms
java.lang.InstantiationException: com.service.BusService