求助!Web Service客户端问题!开发好的web服务,调用时有问题!求指教!
我开发好了一个web服务,url是http://localhost:8080/Machining,对外开放的接口是要接收三个double型的数据,但是我编写客户端的时候,出错,请大家指教!
package client;
import javax.xml.namespace.QName;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.rpc.client.RPCServiceClient;
public class WebClient {
public static void main(String[]args1)throws AxisFault{
RPCServiceClient serviceClient = new RPCServiceClient();
Options options = serviceClient.getOptions();
EndpointReference targeERP= new EndpointReference("http://localhost:8080/Machining");
options.setTo(targeERP);
QName opGetMilling = new QName("http://server","milling");//milling是要调用的操作名
Class[] returnTypes = new Class[]{double.class};
Object[] opGetMillingArgs = new Object[]{2,3,4};
Object[] response =serviceClient.invokeBlocking(opGetMilling,opGetMillingArgs,returnTypes);
double result = (double)response[0];
if(result==0){
System.out.println("服务调用失败");
return;
}
System.out.println(result);
}
}