parent
fcd5ef71fe
commit
a8135f4b54
|
@ -19,4 +19,14 @@ public class GlobalVar {
|
|||
* The constant USED_VIRTUAL_DISPOSE_MODE.
|
||||
*/
|
||||
public static volatile boolean USED_VIRTUAL_DISPOSE_MODE = false;
|
||||
|
||||
/**
|
||||
* The constant SOAP_CONNECT_TIMEOUT.
|
||||
*/
|
||||
public static final int SOAP_CONNECT_TIMEOUT = 1000;
|
||||
|
||||
/**
|
||||
* The constant SOAP_RECEIVE_TIMEOUT.
|
||||
*/
|
||||
public static final int SOAP_RECEIVE_TIMEOUT = 1000;
|
||||
}
|
||||
|
|
|
@ -2,21 +2,27 @@ package com.dispose.dispose.impl;
|
|||
|
||||
import com.dispose.Interceptor.SoapPasswordCallbackHandler;
|
||||
import com.dispose.common.ConstValue;
|
||||
import com.dispose.common.GlobalVar;
|
||||
import com.dispose.config.DisposeConfigure;
|
||||
import com.dispose.dispose.DisposeEntryManager;
|
||||
import com.dispose.dispose.po.DeviceInfo;
|
||||
import com.dispose.pojo.po.DisposeDeviceCapacity;
|
||||
import com.dptech.dispose.AbnormalFlowCleaningServicePortType;
|
||||
import com.dptech.dispose.ArrayOfDetectionObjectDataForService;
|
||||
import com.dptech.dispose.ArrayOfProtectionObjectDataForService;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.cxf.endpoint.Client;
|
||||
import org.apache.cxf.frontend.ClientProxy;
|
||||
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
|
||||
import org.apache.cxf.transport.http.HTTPConduit;
|
||||
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
|
||||
import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor;
|
||||
import org.apache.wss4j.dom.WSConstants;
|
||||
import org.apache.wss4j.dom.handler.WSHandlerConstants;
|
||||
|
@ -26,6 +32,9 @@ import org.apache.wss4j.dom.handler.WSHandlerConstants;
|
|||
*/
|
||||
@Slf4j
|
||||
public class DPTechImpl implements DisposeEntryManager {
|
||||
@Resource
|
||||
private DisposeConfigure disposeConfigure;
|
||||
|
||||
/**
|
||||
* The Clean type port.
|
||||
*/
|
||||
|
@ -52,6 +61,13 @@ public class DPTechImpl implements DisposeEntryManager {
|
|||
jaxWsProxyFactoryBean.getOutInterceptors().add(new WSS4JOutInterceptor(outProps));
|
||||
|
||||
this.cleanTypePort = (AbnormalFlowCleaningServicePortType) jaxWsProxyFactoryBean.create();
|
||||
|
||||
Client proxy = ClientProxy.getClient(this.cleanTypePort);
|
||||
HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
|
||||
HTTPClientPolicy policy = new HTTPClientPolicy();
|
||||
policy.setConnectionTimeout(GlobalVar.SOAP_CONNECT_TIMEOUT); // 请求超时
|
||||
policy.setReceiveTimeout(GlobalVar.SOAP_RECEIVE_TIMEOUT); //读取超时
|
||||
conduit.setClient(policy);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -61,21 +77,7 @@ public class DPTechImpl implements DisposeEntryManager {
|
|||
* @param type the type
|
||||
*/
|
||||
public DPTechImpl(String ipAddr, ConstValue.IPAddrType type) {
|
||||
JaxWsProxyFactoryBean jaxWsProxyFactoryBean = new JaxWsProxyFactoryBean();
|
||||
jaxWsProxyFactoryBean.setServiceClass(AbnormalFlowCleaningServicePortType.class);
|
||||
jaxWsProxyFactoryBean.setAddress(String.format(ConstValue.SOAPWrapperConst.NAMESPACE_URI, ipAddr));
|
||||
|
||||
//WS-Security Head
|
||||
Map<String, Object> outProps = new HashMap<>();
|
||||
outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
|
||||
|
||||
outProps.put(WSHandlerConstants.USER, "admin");
|
||||
outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
|
||||
outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS, SoapPasswordCallbackHandler.class.getName());
|
||||
|
||||
jaxWsProxyFactoryBean.getOutInterceptors().add(new WSS4JOutInterceptor(outProps));
|
||||
|
||||
this.cleanTypePort = (AbnormalFlowCleaningServicePortType) jaxWsProxyFactoryBean.create();
|
||||
this(ipAddr);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -229,7 +231,6 @@ public class DPTechImpl implements DisposeEntryManager {
|
|||
* Gets detection object device json.
|
||||
*
|
||||
* @return the detection object device json
|
||||
* @throws JsonProcessingException the json processing exception
|
||||
*/
|
||||
public String getDetectionObjectDeviceJson() {
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue