Compare commits

..

No commits in common. "703065601963da233c2901bce86c546589da6978" and "2642714bb440c5bae8da059ec79d5ec0986962d9" have entirely different histories.

4 changed files with 240 additions and 296 deletions

View File

@ -200,32 +200,21 @@
</dependency> </dependency>
<!-- <dependency>--> <dependency>
<!-- <groupId>org.apache.axis</groupId>--> <groupId>org.apache.axis</groupId>
<!-- <artifactId>axis</artifactId>--> <artifactId>axis</artifactId>
<!-- <version>1.4</version>--> <version>1.4</version>
<!-- </dependency>--> </dependency>
<!-- <dependency>--> <dependency>
<!-- <groupId>org.apache.axis</groupId>--> <groupId>org.apache.axis</groupId>
<!-- <artifactId>axis-jaxrpc</artifactId>--> <artifactId>axis-jaxrpc</artifactId>
<!-- <version>1.4</version>--> <version>1.4</version>
<!-- </dependency>--> </dependency>
<!-- <dependency>--> <!-- <dependency>-->
<!-- <groupId>com.roufid.tutorials</groupId>--> <!-- <groupId>com.roufid.tutorials</groupId>-->
<!-- <artifactId>example-app</artifactId>--> <!-- <artifactId>example-app</artifactId>-->
<!-- <version>1.0</version>--> <!-- <version>1.0</version>-->
<!-- </dependency>--> <!-- </dependency>-->
<!--cxf-->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>3.2.1</version>
</dependency>
<dependency> <dependency>
<groupId>com.banboocloud.Codec </groupId> <groupId>com.banboocloud.Codec </groupId>
@ -342,15 +331,6 @@
<version>${velocity.version}</version> <version>${velocity.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.banboocloud</groupId>
<artifactId>banboocloudCodec</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/java/com/ruoyi/project/system/lib/banboocloud_Codec-0.0.jar</systemPath>
</dependency>
<!-- 定时任务 --> <!-- 定时任务 -->
<dependency> <dependency>
<groupId>org.quartz-scheduler</groupId> <groupId>org.quartz-scheduler</groupId>

View File

@ -1,10 +1,6 @@
package com.ruoyi.common.wsdl; package com.ruoyi.common.wsdl;
import org.apache.cxf.endpoint.Client; import org.apache.axis.client.Call;
import org.apache.cxf.endpoint.Endpoint;
import org.apache.cxf.endpoint.dynamic.DynamicClientFactory;
import org.apache.cxf.service.model.BindingInfo;
import org.apache.cxf.service.model.BindingOperationInfo;
import org.springframework.util.*; import org.springframework.util.*;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
import java.util.ArrayList; import java.util.ArrayList;
@ -14,33 +10,33 @@ import java.util.Map;
public class WebServiceUtil { public class WebServiceUtil {
// public static String sendMessage(Collection<String> phones, String msg) throws Exception { public static String sendMessage(Collection<String> phones, String msg) throws Exception {
//
// System.out.println("开始调用webservice"); System.out.println("开始调用webservice");
// List<Map<String, Object>> storeItemList_ = new ArrayList<>(); List<Map<String, Object>> storeItemList_ = new ArrayList<>();
// String endpoint = "http://10.171.19.193:8080/dxpt/ws/shortMessageWs?wsdl"; String endpoint = "http://10.171.19.193:8080/dxpt/ws/shortMessageWs?wsdl";
// String soapaction = "http://service.cxf.com/"; String soapaction = "http://service.cxf.com/";
// String method = "returnMassages"; String method = "returnMassages";
// org.apache.axis.client.Service service = new org.apache.axis.client.Service(); org.apache.axis.client.Service service = new org.apache.axis.client.Service();
// Call call = (Call) service.createCall();// 通过service创建call对象 Call call = (Call) service.createCall();// 通过service创建call对象
// call.setTargetEndpointAddress(endpoint); call.setTargetEndpointAddress(endpoint);
// call.setOperationName(new QName(soapaction, method)); call.setOperationName(new QName(soapaction, method));
// call.addParameter(new QName(soapaction, "phone"), call.addParameter(new QName(soapaction, "phone"),
// org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN); org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
// call.addParameter(new QName(soapaction, "msg"), call.addParameter(new QName(soapaction, "msg"),
// org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN); org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
// call.addParameter(new QName(soapaction, "Dwdm"), call.addParameter(new QName(soapaction, "Dwdm"),
// org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN); org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
//
// call.setUseSOAPAction(true); call.setUseSOAPAction(true);
// //call.setReturnType(org.apache.axis.encoding.XMLType.SOAP_STRING); //返回参数的类型 //call.setReturnType(org.apache.axis.encoding.XMLType.SOAP_STRING); //返回参数的类型
// call.setReturnType(org.apache.axis.encoding.XMLType.SOAP_VECTOR); call.setReturnType(org.apache.axis.encoding.XMLType.SOAP_VECTOR);
// //call.setReturnType(XMLType.XSD_STRING); //call.setReturnType(XMLType.XSD_STRING);
// call.setSOAPActionURI(soapaction + method); call.setSOAPActionURI(soapaction + method);
// java.util.Vector xmlStr = (java.util.Vector) call.invoke(new Object[]{StringUtils.collectionToCommaDelimitedString(phones), msg, "SGJT-山港集团"}); java.util.Vector xmlStr = (java.util.Vector) call.invoke(new Object[]{StringUtils.collectionToCommaDelimitedString(phones), msg, "SGJT-山港集团"});
// System.out.println("webservice response content :" + StringUtils.collectionToCommaDelimitedString(xmlStr)); System.out.println("webservice response content :" + StringUtils.collectionToCommaDelimitedString(xmlStr));
// return StringUtils.collectionToCommaDelimitedString(xmlStr); return StringUtils.collectionToCommaDelimitedString(xmlStr);
// } }
// public static void main(String[] args) { // public static void main(String[] args) {
// Collection<String> objects = new ArrayList<>(); // Collection<String> objects = new ArrayList<>();
@ -51,37 +47,4 @@ public class WebServiceUtil {
// e.printStackTrace(); // e.printStackTrace();
// } // }
// } // }
public static String sendMessage(List<String> phones, String msg) throws Exception {
//
String result ;
try {
DynamicClientFactory dynamicClientFactory = DynamicClientFactory.newInstance();
Client client = dynamicClientFactory.createClient("http://10.171.19.193:8080/dxpt/ws/shortMessageWs?wsdl");
Endpoint endpoint = client.getEndpoint();
QName opName = new QName(endpoint.getService().getName().getNamespaceURI(), "returnMassages");
BindingInfo bindingInfo = endpoint.getEndpointInfo().getBinding();
if (bindingInfo.getOperation(opName) == null) {
for (BindingOperationInfo operationInfo : bindingInfo.getOperations()) {
if ("returnMassages".equals(operationInfo.getName().getLocalPart())) {
opName = operationInfo.getName();
break;}}}
Object[] res = client.invoke(opName, StringUtils.collectionToCommaDelimitedString(phones),msg,"SGJT");
//System.out.println();
result = String.valueOf(res[0]);
} catch (Exception e) {
throw new RuntimeException(e);
}
return result;
}
} }

View File

@ -1,199 +1,200 @@
//package com.ruoyi.common.wsdl; package com.ruoyi.common.wsdl;
//
//
//import ch.qos.logback.core.net.server.Client; import ch.qos.logback.core.net.server.Client;
//import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
//import org.apache.axis.client.Call; import org.apache.axis.client.Call;
//import org.apache.axis.client.Service; import org.apache.axis.client.Service;
//import org.apache.axis.encoding.XMLType; import org.apache.axis.encoding.XMLType;
//import org.apache.axis.encoding.ser.BeanDeserializerFactory; import org.apache.axis.encoding.ser.BeanDeserializerFactory;
//import org.apache.axis.encoding.ser.BeanSerializerFactory; import org.apache.axis.encoding.ser.BeanSerializerFactory;
//import org.apache.axis.message.SOAPHeaderElement; import org.apache.axis.message.SOAPHeaderElement;
//import org.apache.axis.types.Schema; import org.apache.axis.types.Schema;
//import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
//import org.apache.commons.compress.utils.Lists; import org.apache.commons.compress.utils.Lists;
//
//import javax.xml.namespace.QName; import javax.xml.namespace.QName;
//import java.util.HashMap; import javax.xml.rpc.ParameterMode;
//import java.util.List; import java.util.HashMap;
//import java.util.Map; import java.util.List;
//import java.util.Set; import java.util.Map;
// import java.util.Set;
//
//
//public class WebServiceUtils {
// // 接口调用地址 public class WebServiceUtils {
// private static String url = "http://10.171.19.193:8080/dxpt/ws/shortMessageWs?wsdl"; // 接口调用地址
// // 命名空间 private static String url = "http://10.171.19.193:8080/dxpt/ws/shortMessageWs?wsdl";
// private static String namespace = "http://service.cxf.com/"; // 命名空间
// private static String namespace = "http://service.cxf.com/";
//
// public static void main(String[] args) {
// HashMap<String, String> map = new HashMap<>(); public static void main(String[] args) {
// map.put("phone","18437762352"); HashMap<String, String> map = new HashMap<>();
// map.put("msg","ceshi"); map.put("phone","18437762352");
// map.put("Dwdm","SGJT-山港集团"); map.put("msg","ceshi");
// String call = call("returnMassages", map); map.put("Dwdm","SGJT-山港集团");
// System.out.println(call); String call = call("returnMassages", map);
// } System.out.println(call);
// }
//
//
//
//
//
// /**
// * WebService - 调用接口 /**
// * * WebService - 调用接口
// * @param methodName 函数名 *
// * @param params 参数 * @param methodName 函数名
// * @param clazz 返回对象class * @param params 参数
// * @return 返回结果(Object) * @param clazz 返回对象class
// */ * @return 返回结果(Object)
// public static <T> T call(String methodName, Map<String, String> params, Class<T> clazz) { */
//// log.info("调用 WebService 发送参数==>" + JsonUtil.object2Json(params)); public static <T> T call(String methodName, Map<String, String> params, Class<T> clazz) {
// String soapActionURI = namespace + methodName; // log.info("调用 WebService 发送参数==>" + JsonUtil.object2Json(params));
// try { String soapActionURI = namespace + methodName;
// Service service = new Service(); try {
// Service service = new Service();
// SOAPHeaderElement header = new SOAPHeaderElement(namespace, methodName);
// header.setNamespaceURI(namespace); SOAPHeaderElement header = new SOAPHeaderElement(namespace, methodName);
// header.setNamespaceURI(namespace);
// Call call = (Call) service.createCall();
// call.setTargetEndpointAddress(url); Call call = (Call) service.createCall();
// call.setTargetEndpointAddress(url);
// call.setOperationName(new QName(namespace, methodName));
// call.setOperationName(new QName(namespace, methodName));
// // 添加参数
// List<String> parameterList = Lists.newArrayList(); // 添加参数
// if (params != null) { List<String> parameterList = Lists.newArrayList();
// Set<String> paramsKey = params.keySet(); if (params != null) {
// for (String key : paramsKey) { Set<String> paramsKey = params.keySet();
// call.addParameter(new QName(namespace, key), XMLType.XSD_STRING, ParameterMode.IN); for (String key : paramsKey) {
// String pValue = MapUtils.getString(params, key); call.addParameter(new QName(namespace, key), XMLType.XSD_STRING, ParameterMode.IN);
// header.addChildElement(key).setValue(pValue); String pValue = MapUtils.getString(params, key);
// parameterList.add(pValue); header.addChildElement(key).setValue(pValue);
// } parameterList.add(pValue);
// } }
// call.setUseSOAPAction(true); }
// call.setSOAPActionURI(soapActionURI); call.setUseSOAPAction(true);
// call.addHeader(header); call.setSOAPActionURI(soapActionURI);
// call.addHeader(header);
// // 进行序列化 实体类也要序列化 implements Serializable
// call.registerTypeMapping(clazz, new QName(namespace, soapActionURI), // 进行序列化 实体类也要序列化 implements Serializable
// new BeanSerializerFactory(clazz, new QName(namespace, soapActionURI)), call.registerTypeMapping(clazz, new QName(namespace, soapActionURI),
// new BeanDeserializerFactory(clazz, new QName(namespace, soapActionURI))); new BeanSerializerFactory(clazz, new QName(namespace, soapActionURI)),
// // 设置输出的类 new BeanDeserializerFactory(clazz, new QName(namespace, soapActionURI)));
// call.setReturnClass(clazz); // 设置输出的类
// // 接口返回结果 call.setReturnClass(clazz);
// T result = (T) call.invoke(parameterList.toArray()); // 接口返回结果
//// log.info("调用 WebService 接口返回===>" + result); T result = (T) call.invoke(parameterList.toArray());
// return result; // log.info("调用 WebService 接口返回===>" + result);
// } catch (Exception e) { return result;
//// log.error("调用 WebService 接口错误信息==>" + e.getMessage()); } catch (Exception e) {
// } // log.error("调用 WebService 接口错误信息==>" + e.getMessage());
// return null; }
// } return null;
// }
// /**
// * WebService - 接口调用 /**
// * * WebService - 接口调用
// * @param methodName 函数名 *
// * @param params 参数 * @param methodName 函数名
// * @return 返回结果(String) * @param params 参数
// */ * @return 返回结果(String)
// public static String call(String methodName, Map<String, String> params) { */
//// log.info("调用 WebService 发送参数==>" + JsonUtil.object2Json(params)); public static String call(String methodName, Map<String, String> params) {
// System.out.println("调用 WebService 发送参数==>" + JSONObject.toJSONString(params)); // log.info("调用 WebService 发送参数==>" + JsonUtil.object2Json(params));
// String soapActionURI = namespace + methodName; System.out.println("调用 WebService 发送参数==>" + JSONObject.toJSONString(params));
// try { String soapActionURI = namespace + methodName;
// Service service = new Service(); try {
// Service service = new Service();
// SOAPHeaderElement header = new SOAPHeaderElement(namespace, methodName);
// header.setNamespaceURI(namespace); SOAPHeaderElement header = new SOAPHeaderElement(namespace, methodName);
// header.setNamespaceURI(namespace);
// Call call = (Call) service.createCall();
// call.setTargetEndpointAddress(url); Call call = (Call) service.createCall();
// call.setTargetEndpointAddress(url);
// call.setOperationName(new QName(namespace, methodName));
// call.setOperationName(new QName(namespace, methodName));
// // 添加参数
// List<String> parameterList = Lists.newArrayList(); // 添加参数
// if (params != null) { List<String> parameterList = Lists.newArrayList();
// Set<String> paramsKey = params.keySet(); if (params != null) {
// for (String key : paramsKey) { Set<String> paramsKey = params.keySet();
// call.addParameter(new QName(namespace, key), XMLType.XSD_STRING, ParameterMode.IN); for (String key : paramsKey) {
// String pValue = MapUtils.getString(params, key); call.addParameter(new QName(namespace, key), XMLType.XSD_STRING, ParameterMode.IN);
// header.addChildElement(key).setValue(pValue); String pValue = MapUtils.getString(params, key);
// parameterList.add(pValue); header.addChildElement(key).setValue(pValue);
// } parameterList.add(pValue);
// } }
// call.setUseSOAPAction(true); }
// call.setSOAPActionURI(soapActionURI); call.setUseSOAPAction(true);
// call.addHeader(header); call.setSOAPActionURI(soapActionURI);
// // 设置返回类型 call.addHeader(header);
// call.setReturnType(new QName(namespace, methodName), String.class); // 设置返回类型
// // 接口返回结果 call.setReturnType(new QName(namespace, methodName), String.class);
// // 接口返回结果
// String result = (String) call.invoke(parameterList.toArray());
//// log.info("调用 WebService 接口返回===>" + result); String result = (String) call.invoke(parameterList.toArray());
// System.out.println("调用 WebService 接口返回===>" + result); // log.info("调用 WebService 接口返回===>" + result);
// return result; System.out.println("调用 WebService 接口返回===>" + result);
// } catch (Exception e) { return result;
//// log.error("调用 WebService 接口错误信息==>" + e.getMessage()); } catch (Exception e) {
// System.out.println("调用 WebService 接口返回===>" + e.getMessage()); // log.error("调用 WebService 接口错误信息==>" + e.getMessage());
// } System.out.println("调用 WebService 接口返回===>" + e.getMessage());
// return null; }
// } return null;
// }
// /**
// * WebService - 调用接口 /**
// * * WebService - 调用接口
// * @param methodName 函数名 *
// * @param params 参数 * @param methodName 函数名
// * @return 返回结果(String) * @param params 参数
// */ * @return 返回结果(String)
// public static String call2(String methodName, Map<String, String> params) { */
//// log.info("调用 WebService 发送参数==>" + JsonUtil.object2Json(params)); public static String call2(String methodName, Map<String, String> params) {
// String soapActionURI = namespace + methodName; // log.info("调用 WebService 发送参数==>" + JsonUtil.object2Json(params));
// try { String soapActionURI = namespace + methodName;
// Service service = new Service(); try {
// Service service = new Service();
// SOAPHeaderElement header = new SOAPHeaderElement(namespace, methodName);
// header.setNamespaceURI(namespace); SOAPHeaderElement header = new SOAPHeaderElement(namespace, methodName);
// header.setNamespaceURI(namespace);
// Call call = (Call) service.createCall();
// call.setTargetEndpointAddress(url); Call call = (Call) service.createCall();
// call.setTargetEndpointAddress(url);
// call.setOperationName(new QName(namespace, methodName));
// call.setOperationName(new QName(namespace, methodName));
// // 添加参数
// List<String> parameterList = Lists.newArrayList(); // 添加参数
// if (params != null) { List<String> parameterList = Lists.newArrayList();
// Set<String> paramsKey = params.keySet(); if (params != null) {
// for (String key : paramsKey) { Set<String> paramsKey = params.keySet();
// call.addParameter(new QName(namespace, key), XMLType.XSD_STRING, ParameterMode.IN); for (String key : paramsKey) {
// String pValue = MapUtils.getString(params, key); call.addParameter(new QName(namespace, key), XMLType.XSD_STRING, ParameterMode.IN);
// header.addChildElement(key).setValue(pValue); String pValue = MapUtils.getString(params, key);
// parameterList.add(pValue); header.addChildElement(key).setValue(pValue);
// } parameterList.add(pValue);
// } }
// call.setUseSOAPAction(true); }
// call.setSOAPActionURI(soapActionURI); call.setUseSOAPAction(true);
// call.addHeader(header); call.setSOAPActionURI(soapActionURI);
// // 设置返回类型 call.addHeader(header);
// call.setReturnType(XMLType.XSD_SCHEMA); // 设置返回类型
// // 接口返回结果 call.setReturnType(XMLType.XSD_SCHEMA);
// Schema schemaResult = (Schema)call.invoke(parameterList.toArray()); // 接口返回结果
// String result = ""; Schema schemaResult = (Schema)call.invoke(parameterList.toArray());
// for(int i = 0; i<schemaResult.get_any().length; i++){ String result = "";
// result = result + schemaResult.get_any()[i]; for(int i = 0; i<schemaResult.get_any().length; i++){
// } result = result + schemaResult.get_any()[i];
//// log.error("调用 WebService 接口返回===>" + result); }
// return result; // log.error("调用 WebService 接口返回===>" + result);
// } catch (Exception e) { return result;
//// log.error("调用 WebService 接口错误信息==>" + e.getMessage()); } catch (Exception e) {
// } // log.error("调用 WebService 接口错误信息==>" + e.getMessage());
// return null; }
// } return null;
//} }
}

View File

@ -37,10 +37,10 @@ public class SysSendInfoServiceImpl implements ISysSendInfoService {
if(sendMessageDTO.getIsSendPhone() !=null && sendMessageDTO.getIsSendPhone()){//发送短信 if(sendMessageDTO.getIsSendPhone() !=null && sendMessageDTO.getIsSendPhone()){//发送短信
List<String> phoneList= sendMessageDTO.getPhoneList(); List<String> phoneList= sendMessageDTO.getPhoneList();
String phone = String.join(",", phoneList); String phone = String.join(",", phoneList);
List<String> phones = new ArrayList<>(phoneList); Collection<String> phones = new ArrayList<>(phoneList);
String msg=sendMessageDTO.getSendText(); String msg=sendMessageDTO.getSendText();
String dwdm="SGJT"; String dwdm="SGJT-山港集团";
//todo 调用发送短信接口 //todo 调用发送短信接口
WebServiceUtil.sendMessage(phones,msg); WebServiceUtil.sendMessage(phones,msg);