String endpointURL = "http://localhost:8080/ws/services/SparePartService";
String methodName = "getSparepart";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpointURL));
call.setOperationName(new QName("SparePartService", methodName));
call.addParameter("sku", XMLType.XSD_STRING, ParameterMode.IN);
QName qname = new QName("SparePartDetails", "SparePartBean");
Class cls = org.bluebear.ws.advanced.customdatatype.SparePartBean.class;
call.registerTypeMapping(cls, qname, BeanSerializerFactory.class, BeanDeserializerFactory.class);
call.setReturnType(qname);
Object[] params = new Object[] { "222222" };
SparePartBean spBean = (SparePartBean) call.invoke(params);
System.out.println(spBean);
需要引入的jar包:
axis.jar
jaxrpc.jar
commons-discovery-