[java]代码库
//call调用方式
private String send(String method,String userName,String title,String content,String tel){
String soapaction= "http://service.msgbuss.ceair.com/";
String endpoint = "http://xxx.xx.xx.xx:8099/msgbuss/soap/sendMessage";
try {
org.apache.axis.client.Service service = new org.apache.axis.client.Service();
Call call = (Call)service.createCall();
QName qn = new QName("urn:messageEndpoint", "MessageRequestVO");
call.registerTypeMapping(MessageRequestVO.class,qn,
new BeanSerializerFactory(MessageRequestVO.class, qn),
new BeanDeserializerFactory(MessageRequestVO.class, qn));
call.setTargetEndpointAddress(endpoint);
call.setUseSOAPAction(true);
call.setSOAPActionURI(null);
call.setOperationName(new QName(soapaction, "send"));
//判断是否是自定义手机号码
JSONObject obj=new JSONObject();
if(tel!= null ||!"".equals(tel) ){
obj.put("mobiles",tel);
}
obj.put("emsEnterpriseID","10090");
obj.put("emsLoginName","admin");
obj.put("emsPassword",MD5.toMD5("cabin123"));
//赋值
MessageRequestVO messageRequestVO = new MessageRequestVO();
messageRequestVO.setBizProduct(method);
messageRequestVO.setRequestId(UUID.randomUUID().toString());
messageRequestVO.setToUserId(userName);
messageRequestVO.setTitle(title);
messageRequestVO.setContent(content);
messageRequestVO.setExtention(obj.toString());
String str = "<bizProduct>"+method+"</bizProduct>"
+ "<content>"+"测试1"+"</content>"
+ "<extention>"+obj.toString()+"</extention>"
+ "<requestId>11111</requestId>"
+ "<title>测试</title>"
+ "<toUserId>chenbiqian</toUserId>";
call.addParameter("messageRequestVO", org.apache.axis.encoding.XMLType.XSD_STRING, ParameterMode.IN);
call.getParameterTypeByName("");
//call.addParameter("bizProduct", org.apache.axis.encoding.XMLType.XSD_STRING, ParameterMode.IN);
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
call.invoke(new Object[] {str});
return null;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}