webservice中定义的ref参数 用java怎么调用
1个回答
展开全部
直接给你上实例,有什么不明白可以直接问我
public int removeGroupUsers(String guid, String usersId) {
try {
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(UrlUtils.mucWebServiceUrl());
call.setTimeout(Integer.parseInt(IniReader.getValue("PUBLIC", "CONNECTION_TIME_OUT")));
call.setOperationName(new QName(soapaction, "removeGroupUsers")); // 设置要调用哪个方法
// 设置要传递的参数
call.addParameter(new QName(soapaction, "id"), org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
call.addParameter(new QName(soapaction, "userIds"), org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
// call.setReturnType(new QName(soapaction,"SearchPlanFlightJson"),
// String.class); // 要返回的数据类型(自定义类型)
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_INT);// (标准的类型)
call.setUseSOAPAction(true);
call.setSOAPActionURI(soapaction + "removeGroupUsers");
int result = (Integer) call.invoke(new Object[] { guid, usersId });// 调用方法并传递参数
// log.info("删除群组成员[" + usersId + "],执行状态 [" + result + "]");
return result;
}
catch (Exception e) {
if (Constants.EXCEPTION_CHANGED_RUN) {
Constants.EXCEPTION_CHANGED_RUN = false;
} else {
Constants.EXCEPTION_CHANGED_RUN = true;
}
Constants.LOG_PUB.info("WebServiceImpPub removeGroupUsers RemoteException . ", e);
}
return -100;
}
public int removeGroupUsers(String guid, String usersId) {
try {
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(UrlUtils.mucWebServiceUrl());
call.setTimeout(Integer.parseInt(IniReader.getValue("PUBLIC", "CONNECTION_TIME_OUT")));
call.setOperationName(new QName(soapaction, "removeGroupUsers")); // 设置要调用哪个方法
// 设置要传递的参数
call.addParameter(new QName(soapaction, "id"), org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
call.addParameter(new QName(soapaction, "userIds"), org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
// call.setReturnType(new QName(soapaction,"SearchPlanFlightJson"),
// String.class); // 要返回的数据类型(自定义类型)
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_INT);// (标准的类型)
call.setUseSOAPAction(true);
call.setSOAPActionURI(soapaction + "removeGroupUsers");
int result = (Integer) call.invoke(new Object[] { guid, usersId });// 调用方法并传递参数
// log.info("删除群组成员[" + usersId + "],执行状态 [" + result + "]");
return result;
}
catch (Exception e) {
if (Constants.EXCEPTION_CHANGED_RUN) {
Constants.EXCEPTION_CHANGED_RUN = false;
} else {
Constants.EXCEPTION_CHANGED_RUN = true;
}
Constants.LOG_PUB.info("WebServiceImpPub removeGroupUsers RemoteException . ", e);
}
return -100;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询