最近 项目对接 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. C++ 洛谷 P1879 [USACO06NOV]玉米田Corn Fields

    没学状压DP的看一下 合法布阵问题  P1879 [USACO06NOV]玉米田Corn Fields 题意:给出一个n行m列的草地(n,m<=12),1表示肥沃,0表示贫瘠,现在要把一些牛放在 ...

  2. 机器学习读书笔记(七)支持向量机之线性SVM

    一.SVM SVM的英文全称是Support Vector Machines,我们叫它支持向量机.支持向量机是我们用于分类的一种算法. 1 示例: 先用一个例子,来了解一下SVM 桌子上放了两种颜色的 ...

  3. vim与系统剪切板之间的复制粘贴

    背景 vim各种快捷建溜得飞起,然而与系统剪切板之间的复制粘贴一直都是我的痛. 每次需要从vim中拷贝些文字去浏览器搜索,都需要用鼠标选中vim的文字后,Ctrl+c.Ctrl+v,硬生生掐断了纯键盘 ...

  4. oracle获取当天时间的最开始的时间和最结尾的时间

    ),,'yyyy-mm-dd')||' 23:59:59' from dual

  5. 数字IC后端布局阶段对Tie-high和Tie-low Net的处理

    本文转自:自己的微信公众号<集成电路设计及EDA教程> 里面主要讲解数字IC前端.后端.DFT.低功耗设计以及验证等相关知识,并且讲解了其中用到的各种EDA工具的教程. 考虑到微信公众平台 ...

  6. elasticsearch与ms sql server数据同步

    MS SQL Server Download Elasticsearch Install Elasticsearch Follow instructions on https://www.elasti ...

  7. 《An Attentive Survey of Attention Models》阅读笔记

    本文是对文献 <An Attentive Survey of Attention Models> 的总结,详细内容请参照原文. 引言 注意力模型现在已经成为神经网络中的一个重要概念,并已经 ...

  8. C语言字符型数据的ASCII码值为何是负数?

    有如下一段C语言程序: #include "stdio.h" int main(void) { char a = 0xC8; printf ("字符a的ASCII码值的1 ...

  9. 对DatagramSocket的使用实例(java使用UDP进行数据传输)

    今天刚看懂的一点点东西,记录一下,方便自己回顾 客户端: Client.java import java.io.IOException; import java.net.DatagramPacket; ...

  10. 查看http请求的header信息

    1 下载chrome浏览器 chrome浏览器是google开发的一块非常绑定浏览器.chrome浏览器下载地址. 2 通过chrome控制台查看http请求的header信息 2.1 打开chrom ...