最近 项目对接 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/ 就行了,这个得看打包之后的配置文件放置的目录了,感兴趣的朋友可以自己去试验下,然后springboot配置servlet 代码如下:

@Configuration
public class AutoAxisConfiguration { @Bean
public ServletRegistrationBean<AxisServlet> axisServlet() {
ServletRegistrationBean<AxisServlet> servlet = new ServletRegistrationBean<AxisServlet>(); servlet.setServlet(new AxisServlet());
servlet.addUrlMappings("/services/*");
servlet.setName("AxisServlet");
servlet.setLoadOnStartup(1); //设置引擎
//与官方提供默认引擎区别:查找wsdd位置不同。一个是springboot位置,一个是WEB-INF位置(war)
System.setProperty(EngineConfigurationFactory.SYSTEM_PROPERTY_NAME,"com.cgd.ws.config.SpringBootEngineConfigurationFactoryServlet");
return servlet; }
}

接下来就是配置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 已经很老旧的技术了,但是对接公司要求这么干,所以没办法了,只能硬着头皮上啊, 好多东西百度 都百度不出来,后来没办法 然后翻墙
google ,才终于找到了一些资料,其实现在webservice 基本上用的不多了,反正以上就是自己这段时间的收获吧,然后 具体代码没太整理,然后 回头如果有需要的话再上传吧,但是就基本上核心的代码已经贴出来了, 好久不写博客了,这可以算是自己 在博客园上的第一篇比较完整的博客了,ok,完事。

Axis1.4 配置数组类型复杂对象的更多相关文章

  1. JAVA面向对象-----值交换(基本数据类型 数组类型 对象的值 字符串的)

    JAVA面向对象-–值交换 基本数据类型交换 数组类型交换 对象的值交换 字符串的值交换 恩,没错,又是贴图,请大家见谅,我也是为了多写几个文章,请大家谅解. 字符串的值交换: 交换值失败. 这个文章 ...

  2. .net Mvc Controller 接收 Json/post方式 数组 字典 类型 复杂对象

    原文地址:http://www.cnblogs.com/fannyatg/archive/2012/04/16/2451611.html ------------------------------- ...

  3. js之数据类型(对象类型——构造器对象——数组2)

    一.数组空位与undefined 数组空位:数组的某一个位置没有任何值 产生空位的原因:数组中两个逗号之间不放任何值:用new Array()的方法,参数里是个数字:通过一个不存在的下标去增加数组:增 ...

  4. js之数据类型(对象类型——构造器对象——数组1)

    数组是值的有序集合,每个值叫做一个元素,而每一个元素在数组中有一个位置,以数字表示,称为索引.JavaScript数组是无类型的,数组元素可以是任意类型且同一个数组中不同元素也可能有不同的类型.数组的 ...

  5. 检测js对象是不是数组类型?

    面试时候被人问如何检测一个未知变量是不是数组类型,丢脸啊,老祖宗的脸都丢没了,这都不会,回家啃书本去吧!!! var a = [];方法一:Array.isArray([])  //true type ...

  6. mybatis 处理数组类型及使用Json格式保存数据 JsonTypeHandler and ArrayTypeHandler

    mybatis 比 ibatis 改进了很多,特别是支持了注解,支持了plugin inteceptor,也给开发者带来了更多的灵活性,相比其他ORM,我还是挺喜欢mybatis的. 闲言碎语不要讲, ...

  7. java中用spring实现数组类型输出

    java 中的几个数组类型 1.Department类 package com.yy.collection; import java.util.List; import java.util.Map; ...

  8. JS数组类型检测

    在强类型语言,数组类型检测是非常容易的事情(typeof就可以解决),而在弱语言JS数据类型就很容易混淆了. JS中常见的数据类型有:number.string.boolean.undefined.f ...

  9. JS 数组去重(数组元素是对象的情况)

    js数组去重有经典的 几种方法 但当数组元素是对象时,就不能简单地比较了,需要以某种方式遍历各值再判断是否已出现. 因为: 1.如果是哈希判断法,对象作哈希表的下标,就会自动转换成字符型类型,从而导致 ...

随机推荐

  1. Web自动化测试 二 ----- HTML

    HTML 一.结构 html> 与 </html> 之间的文本描述网页 <body> 与 </body> 之间的文本是可见的页面内容 <h1> 与 ...

  2. BFS(五):八数码难题 (POJ 1077)

    Eight Description The 15-puzzle has been around for over 100 years; even if you don't know it by tha ...

  3. Disruptor 详解 一

    这篇博客将主要通过几个示例,简单讲述 Disruptor 的使用方法: 一.disruptor 简介 Disruptor 是英国外汇交易公司 LMAX 开发的一个无锁高性能的线程间消息传递的框架.目前 ...

  4. Python编程菜鸟成长记--A1--04--Hello World!

    1.重点知识 掌握使用 命令行.文件.Jupyter 的方式执行 Python 代码 2.Hello World! 自从 C 语言之父 丹尼斯.M.里奇 在<The C Programming ...

  5. springMVC java.lang.IllegalStateException: getOutputStream() has already bee

    在导出文件的时候,一直报这个错误. 网上一般的做法是out.clear();或者使用servlet或者Action返回null. 试过了这些方法都不成功. 最后直到试了在jsp重定向的方法才成功了. ...

  6. JVM内存结构解析

    月初的时候个人网站到期了,不想再折腾重新建站了,以后还是来第三方博客写文章吧,可以省去很多问题.之前写的文章也不是很多,备份懒得做了,从头开始吧.博文仅仅是用来记录和学习总结,如有错误之处请帮忙指正! ...

  7. 学Redis这篇就够了

    Redis 简介 Redis 优势 Redis 数据类型 string hash list set Zset 小总结 基本命令 发布订阅 简介 实例 发布订阅常用命令 事务 实例 Redis 事务命令 ...

  8. STM32F4xx系列_独立看门狗配置

    看门狗由内部LSI驱动,LSI是一个内部RC时钟,并不是准确的32kHz,然而看门狗对时间的要求不精确,因此可以接收: 关键字寄存器IWDG_KR: 写入0xCCCCH开启独立看门狗,此时计数器开始从 ...

  9. [Windows无法连接到 System Event Notification Service服务]解决方案

    我之前使用Windows的过程的有出现过以下问题,之前因为比较急就匆忙解决了没来得及把解决方法写下来. 正好今天有个朋友电脑也出现此问题过来找我寻求解决方法,便把解决方法写了下来. 电脑出现的问题,如 ...

  10. Kafka工作流程分析

    Kafka工作流程分析 生产过程分析 写入方式 producer采用推(push)模式将消息发布到broker,每条消息都被追加(append)到分区(patition)中,属于顺序写磁盘(顺序写磁盘 ...