Axis : 远去前的备忘

1, 使用

 

1.1 axis本身可以servlet的形式集成到任何支持servlet的Web容器(web.xml)

    <servlet>

        <display-name>Apache-Axis Servlet</display-name>

        <servlet-name>AxisServlet</servlet-name>

        <servlet-class>org.apache.axis.transport.http.AxisServlet</servlet-class>

    </servlet>

1.2 当然需要让Web容器找到 org.apache.axis.transport.http.AxisServlet

    将axis所需库和资源配置到classpath里面, 或者将axis的lib目录拷贝到WEB-INFO下

1.3 然后让axis接管WebService的url(web.xml)

    <servlet-mapping>

        <servlet-name>AxisServlet</servlet-name>

        <url-pattern>*.jws</url-pattern>

    </servlet-mapping>

    <servlet-mapping>

        <servlet-name>AxisServlet</servlet-name>

        <url-pattern>/services/*</url-pattern>

    </servlet-mapping>

1.4 剩下的只需要告诉axis每个WebService对应着哪个Java类即可(server-config.wsdd(与web.xml同目录))

    <service name="OrganizationWebService" type="" provider="java:RPC" style="rpc" use="encoded">

        <parameter name="scope" value="Request" />

        <parameter name="className" value="nucleus.organization.webservice.OrganizationWebService" />

        <parameter name="allowedMethods" value="isValid, personOfID, personsOfRole, queryCategories, queryPersons" />

        <namespace>http://webservice.organization.nucleus</namespace>

        <typeMapping encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" qname="ns1:CategoryInfo"

                     languageSpecificType="java:nucleus.organization.webservice.CategoryInfo"

                     serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"

                     deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"

                     name="CategoryInfo" xmlns:ns1="http://webservice.organization.nucleus" />

    </service>

 

2, 配置与扩展

 

2.1 Handlers

2.1.1 Query String Handlers

By default, Axis provides for three Axis servlet query string handlers (?list, ?method, and ?wsdl).

2.1.2 Some Default Handlers

JAXRPCHandler

Wrapper around JAX-RPC compliant handlers that exposes an Axis handler interface to the engine.

  HTTPSender

A Handler which sends the request message to a remote server via HTTP, and collects the response message.

  LocalSender

A Handler which sends the request message to a "local" AxisServer, which will process it and return a response message. This is extremely useful for testing, and is by default mapped to the "local:" transport. So, for instance, you can test the AdminClient by doing something like this:

% java org.apache.axis.client.AdminClient -llocal:// list

2.1.3 Service, Targeted Chain, and Provider

A service is a special kind of Targeted Chain in which the pivot Handler is known as a "provider".

 

2.2 Configuration

2.2.1 Engine Configuration

The EngineConfiguration interface is the means of configuring the Handler factories and global options of an engine instance. An instance of a concrete implementation of EngineConfiguration must be passed to the engine when it is created and the engine must be notified if the EngineConfiguration contents are modified. The engine keeps a reference to the EngineConfiguration and then uses it to obtain Handler factories and global options.

The EngineConfiguration interface belongs to the Message Flow subsystem which means that the Message Flow subsystem does not depend on the Administration subsystem.

The EngineConfiguration is provided by an implementation of the interface org.apache.axis.EngineConfigurationFactory, which currently provides methods that return client and server configurations.

Our focus will be how to define the implementation class for EngineConfigurationFactory.

  • Justification/Rationale
    While the default behaviour is sufficient for general use of Axis, integrating Axis into an existing application server may require an alternate deployment model. A customized implementation of the EngineConfigurationFactory would map from the hosts deployment model to Axis's internal deployment model.
     

  • Mechanism
    The relevant sequence of instructions used to obtain configuration information and initialize Axis is as follows:

    • EngineConfigurationFactory factory = EngineConfigurationFactoryFinder(someContext);
      EngineCongfiguration config = factory.getClientEngineConfig();
      AxisClient = new AxisClient(config);

    The details may vary (server versus client, whether other factories are involved, etc). Regardless, the point is that integration code is responsible for calling EngineConfigurationFactoryFinder(someContext) and ensuring that the results are handed to Axis.  someContext is key to how the factory finder locates the appropariate implementation of EngineConfigurationFactory to be used, if any.

    EngineConfigurationFactoryFinder works as follows:
     

    • Obtain a list of classes that implement org.apache.axis.EngineConfigurationFactory, in the following order:

      • The value of the system property axis.EngineConfigFactory.

      • The value of the system property org.apache.axis.EngineConfigurationFactory.

      • Locate all resources named META-INF/services/org.apache.axis.EngineConfigurationFactory. Each line of such a resource identifies the name of a class implementing the interface ('#' comments, through end-of-line).

      • org.apache.axis.configuration.EngineConfigurationFactoryServlet

      • org.apache.axis.configuration.EngineConfigurationFactoryDefault


       
    • Classes implementing EngineConfigurationFactory are required to provide the method  

      • public static EngineConfigurationFactory newFactory(Object)

      This method is called, passing someContext as the parameter.
       

    • The newFactory method is required to check the someContext parameter to determine if it is meaningfull to the class (at a minimum, verify that it is of an expected type, or class) and may, in addition, examine the overall runtime environment. If the environment can provide information required by an EngineConfigurationFactory, then the newFactory() may return in instance of that factory. Otherwise, newFactory() must return null.
       

    • EngineConfigurationFactoryFinder returns the first non-null factory it obtains.

     

  • Default behavior
    The default behaviour is provided by the last two elements of the list of implementing classes, as described above:

    • org.apache.axis.configuration.EngineConfigurationFactoryServlet
      newFactory(obj) is called. If obj instanceof javax.servlet.ServletContext is true, then an instance of this class is returned.

      The default Servlet factory is expected to function as a server (as a client it will incorrectly attempt to load the WSDD file client-config.wsdd from the current working directory!).

      The default Servlet factory will open the Web Application resource /WEB-INF/server-config.wsdd (The name of this file may be changed using the system property axis.ServerConfigFile):

      • If it exists as an accessible file (i.e. not in a JAR/WAR file), then it opens it as a file. This allows changes to be saved, if changes are allowed & made using the Admin tools.

      • If it does not exist as a file, then an attempt is made to access it as a resource stream (getResourceAsStream), which works for JAR/WAR file contents.

      • If the resource is simply not available, an attempt is made to create it as a file.

      • If all above attempts fail, a final attempt is made to access org.apache.axis.server.server-config.wsdd as a data stream.

       

    • org.apache.axis.configuration.EngineConfigurationFactoryDefault
      newFactory(obj) is called. If obj is null then an instance of this class is returned. A non-null obj is presumed to require a non-default factory.

      The default factory will load the WSDD files client-config.wsdd or server-config.wsdd, as appropriate, from the current working directory. The names of these files may be changed using the system properties axis.ClientConfigFile and axis.ServerConfigFile, respectively.

       

Example, In some start up method(): properties.put("axis.EngineConfigFactory", "com.our.ws.CustomFactory");

public class CustomFactory implements EngineConfigurationFactory {

    public EngineConfiguration getClientEngineConfig();

    public EngineConfiguration getServerEngineConfig();

    public static EngineConfigurationFactory newFactory(Object param);
}

2.2.2 WSDD

The server is configured (by default) by values in the server-config.wsdd file, though a dedicated Axis user can write their own configuration handler, and so store configuration data in an LDAP server, database, remote web service, etc. Consult the source on details as to how to do that. You can also add options to the web.xml file and have them picked up automatically. We don't encourage that as it is nice to keep configuration stuff in one place.

The internal data model used by Axis is based on an Axis specific data model: Web Services Deployment Descriptor (WSDD). Axis initially obtains the WSDD information for a service from an instance of org.apache.axis.EngineConfiguration.

WSDD Configuration: Configuration based on wsdd, but not server-config.wsdd file, it can be dynamic/further configured by Admin.deploy()

2.2.3 WSDL2Java

This tool takes a description of a web service written in WSDL and emits Java artefacts used to access the web service.

There are three layers inside the tool:

  • framework: SymbolTable, Emitter, WriterFactory

  • WSDL2Java plugin to the framework: WSDL2Java (the main), JavaWriterFactory, and all the WSDL-relative writers: JavaPortTypeWriter, JavaBindingWriter, etc.

  • The actual WSDL2Java emitters, one for each file generated: JavaInterfaceWriter, JavaStubWriter, etc.

  • So: public class WSDL2Java extends org.apache.axis.wsdl.WSDL2Java{
            public WSDL2Java() {
                super();
                getParser().setFactory(new CustomizedJavaGeneratorFactory(getParser()));
            }

-T, --typeMappingVersion:

indicate 1.1 or 1.2. The default is 1.1 (SOAP 1.1 JAX-RPC compliant. 1.2 indicates SOAP 1.1 encoded.) http://issues.apache.org/jira/browse/AXIS-2467

-W, --noWrapped

This turns off the special treatment of what is called "wrapped" document/literal style operations.  By default, WSDL2Java will recognize the following conditions:

  • If an input message has is a single part.

  • The part is an element.

  • The element has the same name as the operation

  • The element's complex type has no attributes

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Quartz是OpenSymphony开源组织在Job scheduling领域又一个开源项目,它可以与J2EE与J2SE应用程序相结合也可以单独使用。Quartz可以用来创建简单或为运行十个,百个,甚至是好几万个Jobs这样复杂的程序。Jobs可以做成标准的Java组件或 EJBs。 Quartz的优势: 1、Quartz是一个任务调度框架(库),它几乎可以集成到任何应用系统中。 2、Quartz是非常灵活的,它让您能够以最“自然”的方式来编写您的项目的代码,实现您所期望的行为 3、Quartz是非常轻量级的,只需要非常少的配置 —— 它实际上可以被跳出框架来使用,如果你的需求是一些相对基本的简单的需求的话。 4、Quartz具有容错机制,并且可以在重启服务的时候持久化(”记忆”)你的定时任务,你的任务也不会丢失。 5、可以通过Quartz,封装成自己的分布式任务调度,实现强大的功能,成为自己的产品。6、有很多的互联网公司也都在使用Quartz。比如美团 Spring是一个很优秀的框架,它无缝的集成了Quartz,简单方便的让企业级应用更好的使用Quartz进行任务的调度。   课程说明:在我们的日常开发中,各种大型系统的开发少不了任务调度,简单的单机任务调度已经满足不了我们的系统需求,复杂的任务会让程序猿头疼, 所以急需一套专门的框架帮助我们去管理定时任务,并且可以在多台机器去执行我们的任务,还要可以管理我们的分布式定时任务。本课程从Quartz框架讲起,由浅到深,从使用到结构分析,再到源码分析,深入解析Quartz、Spring+Quartz,并且会讲解相关原理, 让大家充分的理解这个框架和框架的设计思想。由于互联网的复杂性,为了满足我们特定的需求,需要对Spring+Quartz进行二次开发,整个二次开发过程都会进行讲解。Spring被用在了越来越多的项目中, Quartz也被公认为是比较好用的定时器设置工具,学完这个课程后,不仅仅可以熟练掌握分布式定时任务,还可以深入理解大型框架的设计思想。
[入门数据分析的第一堂课]这是一门为数据分析小白量身打造的课程,你从网络或者公众号收集到很多关于数据分析的知识,但是它们零散不成体系,所以第一堂课首要目标是为你介绍:Ø  什么是数据分析-知其然才知其所以然Ø  为什么要学数据分析-有目标才有动力Ø  数据分析的学习路线-有方向走得更快Ø  数据分析的模型-分析之道,快速形成分析思路Ø  应用案例及场景-分析之术,掌握分析方法[哪些同学适合学习这门课程]想要转行做数据分析师的,零基础亦可工作中需要数据分析技能的,例如运营、产品等对数据分析感兴趣,想要更多了解的[你的收获]n  会为你介绍数据分析的基本情况,为你展现数据分析的全貌。让你清楚知道自己该如何在数据分析地图上行走n  会为你介绍数据分析的分析方法和模型。这部分是讲数据分析的道,只有学会底层逻辑,能够在面对问题时有自己的想法,才能够下一步采取行动n  会为你介绍数据分析的数据处理和常用分析方法。这篇是讲数据分析的术,先有道,后而用术来实现你的想法,得出最终的结论。n  会为你介绍数据分析的应用。学到这里,你对数据分析已经有了初步的认识,并通过一些案例为你展现真实的应用。[专享增值服务]1:一对一答疑         关于课程问题可以通过微信直接询问老师,获得老师的一对一答疑2:转行问题解答         在转行的过程中的相关问题都可以询问老师,可获得一对一咨询机会3:打包资料分享         15本数据分析相关的电子书,一次获得终身学习
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值