最近 项目对接 webservice,要求SOAP 标准是1.1,然后在axis 和 spring ws 和 cxf 之间进行选择,然后axis 可以自定义服务,然后随tomcat启动发布,spring ws 也研究了下,感觉稍微有点复杂,cxf 发布感觉不是特别好管理,但是集成spring 特别简单,发布的时候可以指定任意端口, 最终呢,考虑良久,还是选择一个成熟稳定点的吧,最终选择了Axis1.4, 然后网上找资料,集成到了springboot项目中,稍微麻烦点的是有两个配置类,这个其实也是参考网上来的,然后代码贴出来,

public class SpringBootEngineConfigurationFactoryServlet extends EngineConfigurationFactoryDefault {
   protected static Log log = LogFactory.getLog(SpringBootEngineConfigurationFactoryServlet.class.getName());

private ServletConfig cfg;

/**
* Creates and returns a new EngineConfigurationFactory. If a factory cannot be
* created, return 'null'.
*
* The factory may return non-NULL only if: - it knows what to do with the param
* (param instanceof ServletContext) - it can find it's configuration
* information
*
* @see org.apache.axis.configuration.EngineConfigurationFactoryFinder
*/
public static EngineConfigurationFactory newFactory(Object param) {
/**
* Default, let this one go through if we find a ServletContext.
*
* The REAL reason we are not trying to make any decision here is because it's
* impossible (without refactoring FileProvider) to determine if a *.wsdd file
* is present or not until the configuration is bound to an engine.
*
* FileProvider/EngineConfiguration pretend to be independent, but they are
* tightly bound to an engine instance...
*/
return (param instanceof ServletConfig) ? new SpringBootEngineConfigurationFactoryServlet((ServletConfig) param) : null;
}

/**
* Create the default engine configuration and detect whether the user has
* overridden this with their own.
*/
protected SpringBootEngineConfigurationFactoryServlet(ServletConfig conf) {
super();
this.cfg = conf;
}

/**
* Get a default server engine configuration.
*
* @return a server EngineConfiguration
*/
@Override
public EngineConfiguration getServerEngineConfig() {
return getServerEngineConfig(cfg);
}

/**
* Get a default server engine configuration in a servlet environment.
*
* @param cfg
* a ServletContext
* @return a server EngineConfiguration
*/
private static EngineConfiguration getServerEngineConfig(ServletConfig cfg) {


//ServletContext ctx = cfg.getServletContext();

// Respect the system property setting for a different config file
String configFile = cfg.getInitParameter(OPTION_SERVER_CONFIG_FILE);
if (configFile == null)
configFile = AxisProperties.getProperty(OPTION_SERVER_CONFIG_FILE);
if (configFile == null) {
configFile = SERVER_CONFIG_FILE;
}

/**
* Flow can be confusing. Here is the logic: 1) Make all attempts to open
* resource IF it exists - If it exists as a file, open as file (r/w) - If not a
* file, it may still be accessable as a stream (r) (env will handle security
* checks). 2) If it doesn't exist, allow it to be opened/created
*
* Now, the way this is done below is: a) If the file does NOT exist, attempt to
* open as a stream (r) b) Open named file (opens existing file, creates if not
* avail).
*/

/*
* Use the WEB-INF directory (so the config files can't get snooped by a
* browser)
*/


FileProvider config = null;

//String realWebInfPath = ctx.getRealPath(appWebInfPath);

String appWebInfPath = "/WEB-INF/classes/";
//由于部署方式变更为jar部署,此处不可以使用改方式获取路径
ServletContext ctx = cfg.getServletContext();
String realWebInfPath = ctx.getRealPath(appWebInfPath);

log.info("支持spring boot war 启动方式,获取wsdd . realWebInfPath = " + realWebInfPath);
//FileProvider config = null;
// String appWebInfPath = "/";
// String realWebInfPath = SpringBootEngineConfigurationFactoryServlet.class.getResource(appWebInfPath).getPath();
// log.info("支持spring boot jar 启动方式,获取wsdd . realWebInfPath = " + realWebInfPath);

/**
* If path/file doesn't exist, it may still be accessible as a resource-stream
* (i.e. it may be packaged in a JAR or WAR file).
*/
if (realWebInfPath == null || !(new File(realWebInfPath, configFile)).exists()) {
//修改目录
String name = appWebInfPath + configFile;

//修改,读取数据
InputStream is = ClassUtils.getResourceAsStream(SpringBootEngineConfigurationFactoryServlet.class, name);

if (is != null) {
// FileProvider assumes responsibility for 'is':
// do NOT call is.close().
config = new FileProvider(is);
}

if (config == null) {
log.error(Messages.getMessage("servletEngineWebInfError03", name));
}
}

/**
* Couldn't get data OR file does exist. If we have a path, then attempt to
* either open the existing file, or create an (empty) file.
*/
if (config == null && realWebInfPath != null) {
try {
config = new FileProvider(realWebInfPath, configFile);
} catch (ConfigurationException e) {
log.error(Messages.getMessage("servletEngineWebInfError00"), e);
}
}

/**
* Fall back to config file packaged with AxisEngine
*/
if (config == null) {
log.warn(Messages.getMessage("servletEngineWebInfWarn00"));
try {
InputStream is = ClassUtils.getResourceAsStream(AxisServer.class, SERVER_CONFIG_FILE);
config = new FileProvider(is);
} catch (Exception e) {
log.error(Messages.getMessage("servletEngineWebInfError02"), e);
}
}

return config;
}
}
微稍注意的就是这个地方:

  因为springboot 项目的resources打包之后都在classes目录下,所以达成war包的时候要配置成 /WEB-INF/classes目录下,如果是jar 方式的话,貌似直接是/WEB-INF/ 就行了,这个得看打包之后的配置文件放置的目录了,感兴趣的朋友可以自己去试验下。

  接下来就是配置wsdd文件了,这个网上也有现成的模板,但是都是最简洁的,但是因为我们系统是和外部系统进行对接,所以要求进行加密操作,然后当时也是自己查文档,进行百度,然后配置了用户名密码,现在统一把代码粘贴如下:

package com.cgd.material.configuration;

import org.apache.axis.MessageContext;
import org.apache.axis.components.logger.LogFactory;
import org.apache.axis.security.AuthenticatedUser;
import org.apache.axis.security.simple.SimpleAuthenticatedUser;
import org.apache.axis.security.simple.SimpleSecurityProvider;
import org.apache.axis.utils.Messages;
import org.apache.commons.logging.Log;

import java.io.File;
import java.io.FileReader;
import java.io.LineNumberReader;
import java.util.HashMap;
import java.util.StringTokenizer;

/**
 * @Description 修改初始化方法,因寻找密码路径为WEB-INF/users.lst,先变更为WEB-INF/classes/users.lst
 * @Author huluy
 * @Date 2019/5/16 15:22
 **/
public class WsExtendedSimpleSecurityProvider extends SimpleSecurityProvider {

    public static final String NOUSERNAME = "nousername";
    public static final String DEFAULTPASSWORD = "deX3vxNNb^RZ#aSM9o8A";
    protected static Log log;
    HashMap users = null;
    HashMap perms = null;
    boolean initialized = false;

    public WsExtendedSimpleSecurityProvider() {
    }

    private synchronized void initialize(MessageContext msgContext) {
        if (!this.initialized) {
            String configPath = msgContext.getStrProp("configPath");
            if (configPath == null) {
                configPath = "";
            } else {
                configPath = configPath + File.separator + "classes" + File.separator;
            }

            File userFile = new File(configPath + "users.lst");
            if (userFile.exists()) {
                this.users = new HashMap();

                try {
                    FileReader fr = new FileReader(userFile);
                    LineNumberReader lnr = new LineNumberReader(fr);
                    String line = null;

                    while((line = lnr.readLine()) != null) {
                        StringTokenizer st = new StringTokenizer(line);
                        if (st.hasMoreTokens()) {
                            String userID = st.nextToken();
                            String passwd = st.hasMoreTokens() ? st.nextToken() : "";
                            if (log.isDebugEnabled()) {
                                log.debug(Messages.getMessage("fromFile00", userID, passwd));
                            }

                            this.users.put(userID, passwd);
                        }
                    }

                    lnr.close();
                } catch (Exception var10) {
                    log.error(Messages.getMessage("exception00"), var10);
                    return;
                }
            }

            this.initialized = true;
        }
    }

    @Override
    public AuthenticatedUser authenticate(MessageContext msgContext) {
        if (!this.initialized) {
            this.initialize(msgContext);
        }

        String username = msgContext.getUsername();
        String password = msgContext.getPassword();
        if (this.users != null) {
            if (log.isDebugEnabled()) {
                log.debug(Messages.getMessage("user00", username));
            }
            if (this.users.containsKey(NOUSERNAME)) {
                return new SimpleAuthenticatedUser(NOUSERNAME);
            }
            if (username != null && !username.equals("") && this.users.containsKey(username)) {
                String valid = (String)this.users.get(username);
                if (log.isDebugEnabled()) {
                    log.debug(Messages.getMessage("password00", password));
                }

                if (valid.length() > 0 && !valid.equals(password)) {
                    return null;
                } else {
                    if (log.isDebugEnabled()) {
                        log.debug(Messages.getMessage("auth00", username));
                    }

                    return new SimpleAuthenticatedUser(username);
                }
            } else {
                return null;
            }
        } else {
            return null;
        }
    }

    public HashMap getUsers(MessageContext msgContext) {
        if (users == null) {
            this.initialize(msgContext);
        }
        return users;
    }

    static {
        log = LogFactory.getLog(WsExtendedSimpleSecurityProvider.class.getName());
    }
}
package com.cgd.material.configuration;

import org.apache.axis.AxisFault;
import org.apache.axis.MessageContext;
import org.apache.axis.handlers.SimpleAuthenticationHandler;
import org.apache.axis.security.AuthenticatedUser;
import org.apache.axis.security.SecurityProvider;
import org.apache.axis.utils.Messages;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Element;

import java.util.HashMap;

/**
 * @Description 重写提供权限的方法,修改为自定义的SecurityProvider
 * @Author huluy
 * @Date 2019/5/16 15:35
 **/
public class WsExtendSimpleAuthenticationHandler extends SimpleAuthenticationHandler {
    protected static Log log = LogFactory.getLog(WsExtendSimpleAuthenticationHandler.class.getName());


    public WsExtendSimpleAuthenticationHandler() {
    }

    @Override
    public void invoke(MessageContext msgContext) throws AxisFault {
        if (log.isDebugEnabled()) {
            log.debug("Enter: WsExtendSimpleAuthenticationHandler::invoke");
        }

        SecurityProvider provider = (SecurityProvider)msgContext.getProperty("securityProvider");
        if (provider == null) {
            // 修改为自定义的wsSecurityProvider
            WsExtendedSimpleSecurityProvider wsExtendedSimpleSecurityProvider = new WsExtendedSimpleSecurityProvider();
            provider = wsExtendedSimpleSecurityProvider;
            msgContext.setProperty("securityProvider", provider);
            // 配置是否添加用户名密码配置
            HashMap usersLsts = wsExtendedSimpleSecurityProvider.getUsers(msgContext);
            // 如果配置用户名密码中含有: nousername nousername 表示该用户直接可以通过访问
            if (usersLsts != null && usersLsts.containsKey(WsExtendedSimpleSecurityProvider.NOUSERNAME)) {
                msgContext.setUsername(WsExtendedSimpleSecurityProvider.NOUSERNAME);
                msgContext.setPassword(WsExtendedSimpleSecurityProvider.DEFAULTPASSWORD);
            }
        }

        if (provider != null) {
            String userID = msgContext.getUsername();
            if (log.isDebugEnabled()) {
                log.debug(Messages.getMessage("user00", userID));
            }

            if (userID == null || userID.equals("")) {
                throw new AxisFault("Server.Unauthenticated", Messages.getMessage("cantAuth00", userID), (String)null, (Element[])null);
            }

            String passwd = msgContext.getPassword();
            if (log.isDebugEnabled()) {
                log.debug(Messages.getMessage("password00", passwd));
            }

            AuthenticatedUser authUser = ((SecurityProvider)provider).authenticate(msgContext);
            if (authUser == null) {
                throw new AxisFault("Server.Unauthenticated", Messages.getMessage("cantAuth01", userID), (String)null, (Element[])null);
            }

            if (log.isDebugEnabled()) {
                log.debug(Messages.getMessage("auth00", userID));
            }

            msgContext.setProperty("authenticatedUser", authUser);
        }

        if (log.isDebugEnabled()) {
            log.debug("Exit: WsExtendSimpleAuthenticationHandler::invoke");
        }

    }
}

其实都没有特别动代码,主要是继承了axis的 父类,然后在wsdd文件中配置了复杂对象和密码配置

<deployment xmlns="http://xml.apache.org/axis/wsdd/"
            xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
 <globalConfiguration>

  <parameter name="adminPassword" value="admin"/>

  <parameter name="axis.servicesPath" value="/services/"/>

  <!--<parameter name="attachments.Directory" value="c:\temp\attachments"/>-->

  <parameter name="sendMultiRefs" value="false"/>

  <parameter name="sendXsiTypes" value="true"/>

  <parameter name="attachments.implementation" value="org.apache.axis.attachments.AttachmentsImpl"/>

  <parameter name="sendXMLDeclaration" value="true"/>

  <parameter name="enable2DArrayEncoding" value="true"/>

  <parameter name="dotNetSoapEncFix" value="true"/>

  <parameter name="disablePrettyXML" value="true"/>

  <parameter name="enableNamespacePrefixOptimization" value="false"/>

  <parameter name="emitAllTypesInWSDL" value="true"/>

  <requestFlow>
   <handler name="Authenticate" type="java:com.cgd.material.configuration.WsExtendSimpleAuthenticationHandler"/>
  </requestFlow>

  <requestFlow>
   <handler type="java:org.apache.axis.handlers.JWSHandler">
    <parameter name="scope" value="session"/>
   </handler>
   <handler type="java:org.apache.axis.handlers.JWSHandler">
    <parameter name="scope" value="request"/>
    <parameter name="extension" value=".jwr"/>
   </handler>
  </requestFlow>


 </globalConfiguration>

 <service name="AdminService" provider="java:MSG">
  <parameter name="allowedMethods" value="AdminService"/>
  <parameter name="enableRemoteAdmin" value="false"/>
  <parameter name="className" value="org.apache.axis.utils.Admin"/>
  <namespace>http://xml.apache.org/axis/wsdd/</namespace>
 </service>
 <service name="Version" provider="java:RPC">
  <parameter name="allowedMethods" value="getVersion"/>
  <parameter name="className" value="org.apache.axis.Version"/>
 </service>

 <!-- 自定义发布服务 start -->
 <!-- 测试服务 -->
 <service name="helloWorldTestService" provider="java:RPC">
  <parameter name="className" value="com.cgd.material.server.WsHelloWorldTestService"/>
  <parameter name="allowedMethods" value="*"/>
 </service>

 <!-- 测试 数组对象 服务 -->
 <service name="mdmMasterdataArrayTestService" provider="java:RPC" style="document" use="literal">
  <parameter name="className" value="com.cgd.material.server.MdmMasterdataArrayTestService"/>
  <parameter name="allowedMethods" value="*"/>

  <beanMapping
          languageSpecificType="java:com.cgd.material.bo.mdm.MATERIAL_LOG_STATUS_ARRAY"
          qname="ns:materialLogStatusArray" xmlns:ns="urn:mdmMasterdataArrayReciveService"/>
  <typeMapping
          xmlns:ns="ns:mdmMasterdataArrayReciveService"
          qname="ns:materialLogStatusArray"
          languageSpecificType="java:com.cgd.material.bo.mdm.MATERIAL_LOG_STATUS_ARRAY"
          serializer="org.apache.axis.encoding.ser.DocumentSerializerFactory"
          deserializer="org.apache.axis.encoding.ser.DocumentDeserializerFactory"
          encodingStyle=""
  />

  <beanMapping
          languageSpecificType="java:com.cgd.material.bo.mdm.MATERIAL_LOG_STAUS"
          qname="ns:materialLogStatus" xmlns:ns="urn:mdmMasterdataArrayReciveService"/>
  <typeMapping
          xmlns:ns="ns:mdmMasterdataArrayReciveService"
          qname="ns:materialLogStatus"
          languageSpecificType="java:com.cgd.material.bo.mdm.MATERIAL_LOG_STAUS"
          serializer="org.apache.axis.encoding.ser.DocumentSerializerFactory"
          deserializer="org.apache.axis.encoding.ser.DocumentDeserializerFactory"
          encodingStyle=""
  />
  <beanMapping
          languageSpecificType="java:com.cgd.material.bo.mdm.MATERIAL"
          qname="ns:material" xmlns:ns="urn:mdmMasterdataArrayReciveService"/>
  <typeMapping
          xmlns:ns="ns:mdmMasterdataArrayReciveService"
          qname="ns:material"
          languageSpecificType="java:com.cgd.material.bo.mdm.MATERIAL"
          serializer="org.apache.axis.encoding.ser.DocumentSerializerFactory"
          deserializer="org.apache.axis.encoding.ser.DocumentDeserializerFactory"
          encodingStyle=""
  />
  <beanMapping
          languageSpecificType="java:com.cgd.material.bo.mdm.ATTRIBUTE_INFO"
          qname="ns:attributeInfo" xmlns:ns="urn:mdmMasterdataArrayReciveService"/>
  <typeMapping
          xmlns:ns="ns:mdmMasterdataArrayReciveService"
          qname="ns:attributeInfo"
          languageSpecificType="java:com.cgd.material.bo.mdm.ATTRIBUTE_INFO"
          serializer="org.apache.axis.encoding.ser.DocumentSerializerFactory"
          deserializer="org.apache.axis.encoding.ser.DocumentDeserializerFactory"
          encodingStyle=""
  />

  <beanMapping
          languageSpecificType="java:com.cgd.material.bo.MdmInterfaceRspBO"
          qname="ns:mdmInterfaceRspBO" xmlns:ns="urn:mdmMasterdataArrayReciveService"/>
  <typeMapping
          xmlns:ns="ns:mdmMasterdataArrayReciveService"
          qname="ns:mdmInterfaceRspBO"
          languageSpecificType="java:com.cgd.material.bo.MdmInterfaceRspBO"
          serializer="org.apache.axis.encoding.ser.DocumentSerializerFactory"
          deserializer="org.apache.axis.encoding.ser.DocumentDeserializerFactory"
          encodingStyle=""
  />

  <beanMapping
          languageSpecificType="java:com.cgd.material.bo.mdm.MDM_LOG_STAUS"
          qname="ns:mdmLogStatus" xmlns:ns="urn:mdmMasterdataArrayReciveService"/>
  <typeMapping
          xmlns:ns="ns:mdmMasterdataArrayReciveService"
          qname="ns:mdmLogStatus"
          languageSpecificType="java:com.cgd.material.bo.mdm.MDM_LOG_STAUS"
          serializer="org.apache.axis.encoding.ser.DocumentSerializerFactory"
          deserializer="org.apache.axis.encoding.ser.DocumentDeserializerFactory"
          encodingStyle=""
  />
  <beanMapping
          languageSpecificType="java:com.cgd.material.bo.mdm.RESULT_TABLE"
          qname="ns:resultTable" xmlns:ns="urn:mdmMasterdataArrayReciveService"/>
  <typeMapping
          xmlns:ns="ns:mdmMasterdataArrayReciveService"
          qname="ns:resultTable"
          languageSpecificType="java:com.cgd.material.bo.mdm.RESULT_TABLE"
          serializer="org.apache.axis.encoding.ser.DocumentSerializerFactory"
          deserializer="org.apache.axis.encoding.ser.DocumentDeserializerFactory"
          encodingStyle=""
  />

  <arrayMapping qname="ns:materialArray"
                type="java:com.cgd.material.bo.mdm.MATERIAL[]"
                xmlns:ns="urn:mdmMasterdataArrayReciveService"
                innerType="ns:material"
                encodingStyle=""/>

 </service>

 <!-- 主数据接收接口 -->
 <service name="mdmMasterdataReciveService" provider="java:RPC">
  <parameter name="className" value="com.cgd.material.server.MdmMasterdataReciveService"/>
  <parameter name="allowedMethods" value="*"/>

  <beanMapping
          languageSpecificType="java:com.cgd.material.bo.mdm.MATERIAL_LOG_STAUS"
          qname="ns:materialLogStatus" xmlns:ns="urn:mdmMasterdataReciveService"/>
  <typeMapping
          xmlns:ns="ns:mdmMasterdataReciveService"
          qname="ns:materialLogStatus"
          languageSpecificType="java:com.cgd.material.bo.mdm.MATERIAL_LOG_STAUS"
          serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
          deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
          encodingStyle=""
  />
  <beanMapping
          languageSpecificType="java:com.cgd.material.bo.mdm.MATERIAL"
          qname="ns:material" xmlns:ns="urn:mdmMasterdataReciveService"/>
  <typeMapping
          xmlns:ns="ns:mdmMasterdataReciveService"
          qname="ns:material"
          languageSpecificType="java:com.cgd.material.bo.mdm.MATERIAL"
          serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
          deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
          encodingStyle=""
  />
  <beanMapping
          languageSpecificType="java:com.cgd.material.bo.mdm.ATTRIBUTE_INFO"
          qname="ns:attributeInfo" xmlns:ns="urn:mdmMasterdataReciveService"/>
  <typeMapping
          xmlns:ns="ns:mdmMasterdataReciveService"
          qname="ns:attributeInfo"
          languageSpecificType="java:com.cgd.material.bo.mdm.ATTRIBUTE_INFO"
          serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
          deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
          encodingStyle=""
  />

  <beanMapping
          languageSpecificType="java:com.cgd.material.bo.MdmInterfaceRspBO"
          qname="ns:mdmInterfaceRspBO" xmlns:ns="urn:mdmMasterdataReciveService"/>
  <typeMapping
          xmlns:ns="ns:mdmMasterdataReciveService"
          qname="ns:mdmInterfaceRspBO"
          languageSpecificType="java:com.cgd.material.bo.MdmInterfaceRspBO"
          serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
          deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
          encodingStyle=""
  />

  <beanMapping
          languageSpecificType="java:com.cgd.material.bo.mdm.MDM_LOG_STAUS"
          qname="ns:mdmLogStatus" xmlns:ns="urn:mdmMasterdataReciveService"/>
  <typeMapping
          xmlns:ns="ns:mdmMasterdataReciveService"
          qname="ns:mdmLogStatus"
          languageSpecificType="java:com.cgd.material.bo.mdm.MDM_LOG_STAUS"
          serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
          deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
          encodingStyle=""
  />
  <beanMapping
          languageSpecificType="java:com.cgd.material.bo.mdm.RESULT_TABLE"
          qname="ns:resultTable" xmlns:ns="urn:mdmMasterdataReciveService"/>
  <typeMapping
          xmlns:ns="ns:mdmMasterdataReciveService"
          qname="ns:resultTable"
          languageSpecificType="java:com.cgd.material.bo.mdm.RESULT_TABLE"
          serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
          deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
          encodingStyle=""
  />

  <arrayMapping qname="ns:materialArray"
                type="java:com.cgd.material.bo.mdm.MATERIAL[]"
                xmlns:ns="urn:mdmMasterdataReciveService"
                innerType="ns:material"
                encodingStyle=""/>

 </service>
 

 <!-- 自定义发布服务 end -->

 <handler name="URLMapper" type="java:org.apache.axis.handlers.http.URLMapper"/>
 <handler name="LocalResponder" type="java:org.apache.axis.transport.local.LocalResponder"/>
 <handler name="Authenticate" type="java:com.cgd.material.configuration.WsExtendSimpleAuthenticationHandler"/>


 <transport name="http" pivot="java:org.apache.axis.transport.http.CommonsHTTPSender">
  <requestFlow>
   <handler type="URLMapper"/>
   <handler type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/>
   <handler name="Authenticate" type="java:com.cgd.material.configuration.WsExtendSimpleAuthenticationHandler"/>
  </requestFlow>

  <parameter name="qs:list" value="org.apache.axis.transport.http.QSListHandler"/>
  <parameter name="qs:wsdl" value="org.apache.axis.transport.http.QSWSDLHandler"/>
  <parameter name="qs.list" value="org.apache.axis.transport.http.QSListHandler"/>
  <parameter name="qs.method" value="org.apache.axis.transport.http.QSMethodHandler"/>
  <parameter name="qs:method" value="org.apache.axis.transport.http.QSMethodHandler"/>
  <parameter name="qs.wsdl" value="org.apache.axis.transport.http.QSWSDLHandler"/>
 </transport>
 <transport name="local" pivot="java:org.apache.axis.transport.local.LocalSender">
  <responseFlow>
   <handler type="LocalResponder"/>
  </responseFlow>
 </transport>

 <transport name="java" pivot="java:org.apache.axis.transport.java.JavaSender" />

</deployment>
这个地方是配置自定义的权限,简单的用户密码验证:

 

以上wsdd文件中都包含了,然后要求在resources 下 配置users.lst 文件

内容也比较简单,就是  配置的密码账户如下:

 

发布服务代码为:
package com.cgd.material.server;

import com.cgd.material.bo.MdmInterfaceRspBO;
import com.cgd.material.bo.mdm.MATERIAL_LOG_STATUS_ARRAY;
import com.cgd.material.constants.BaseConstant;
import lombok.extern.slf4j.Slf4j;

/**
 * @Description 数组对象测试
 * @Author huluy
 * @Date 2019/8/1 17:44
 **/
@Slf4j
public class MdmMasterdataArrayTestService {

    public MdmInterfaceRspBO receiveArrayData(MATERIAL_LOG_STATUS_ARRAY material_log_status_array) {
        log.info("数组对象为:{}", material_log_status_array);

        MdmInterfaceRspBO interfaceRspBO = new MdmInterfaceRspBO();
        interfaceRspBO.setZDESC(BaseConstant.WS_SUCCESS_CODE);
        interfaceRspBO.setZCODE("数据接收成功");

        return interfaceRspBO;
    }
}
这个是针对复杂对象的文档模式,文档模式要求解析的序列化和反序列化必须是:
但是如果是Bean 类型的数组定义,那么要求配置的数组对象就为:

 要求所有的入参实体和出参实体必须 进行序列化,然后文档模式和数组对象模式区别在于,在SOAP UI 调用时  文档模式可以显示数组对象的属性,但是 对象数组模式呢,显示不出来,只能显示 对象的引用而已,截图如下:

 

数组模式如下内容就不贴出来了。

以上就是这段时间对axis 1.4 的研究成果,其实 axis 1.4 已经很老旧的技术了,但是对接公司要求这么干,所以没办法了,只能硬着头皮上啊, 好多东西百度 都百度不出来,后来没办法 然后FQ
google ,才终于找到了一些资料,其实现在webservice 基本上用的不多了,反正以上就是自己这段时间的收获吧,然后 具体代码没太整理,然后 回头如果有需要的话再上传吧,但是就基本上核心的代码已经贴出来了,

好久不写博客了,这可以算是自己 在博客园上的第一篇比较完整的博客了,ok,完事。


版权声明:本文为853423194hly原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/853423194hly/p/11311165.html