求解!!!!关于Java调用WebService的问题
public class MyWebService {
private static String url = "http://websrv.qmedia.mobi:8081/services/SysXSWebService?wsdl";
private String soapaction = "http://qumedia.service/";
@SuppressWarnings({ "unchecked", "unchecked" })
public MyWebService() {
String appKey = "qeahkeye3a1974da422f26b";
String machineId = "sansul61";
String customerCouponId = "2011092360";
String storeKey = "123456";
Service service = new Service();
try {
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(url);
call.setReturnClass(java.lang.String[].class);
call.setOperationName(new QName(soapaction, "doUseCoupon"));
call.addParameter(new QName(soapaction, "appKey"),
org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);
call.addParameter(new QName(soapaction, "machineId"),
org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);
call.addParameter(new QName(soapaction, "customerCouponId"),
org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);
call.addParameter(new QName(soapaction, "storeKey"),
org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);
call.setReturnType(new
QName(soapaction,"doUseCoupon"),Vector.class);
// call.setReturnType(org.apache.axis.encoding.XMLType.SOAP_STRING);
call.setUseSOAPAction(true);
call.setSOAPActionURI(soapaction + "doUseCoupon");
String[] result = (String[]) call.invoke(new Object[]{appKey,machineId,customerCouponId,storeKey});
// Vector vector = (Vector) call.invoke(new Object[] { appKey, machineId,
// customerCouponId, storeKey });
for (int i = 0; i < result.length; i++) {
System.out.println(result[i]);
}
} catch (Exception e) {
e.printStackTrace();
System.out.println(e.getMessage());
}
}
------解决方案--------------------