Apache Axis2

How to build a service

Axis2 supports 3 programming model

Create a service from scratch
  • Write a class whose methods use OMElement as arguments and/or return type
  • create a services.xml
  • package  as a .aar file
  • deploy
POJO for rpc-style services
Generate the service skeleton from WSDL

 

实现方式

创建方式

**应用文档对象模型解析(**消息绑定)

POJOs

pojo结合rpc模式

AXIOM

优点:自己写客户端,容易出错,不用熟悉WSDL。

缺点:用此方法进行调试不容易

AXIOM

axiom api从底层写

AXIOM

缺点:全部自己实现,不现实。

ADB

从wsdl生成

相应框架,

然后填写相

应逻辑

AXIOM

XMLBeans

AXIOM

JiBX

AXIOM

How to deploy a service

Often axis2 uses its own package named .aar, and the layout of this archive is like:

\---BookService
    \---META-INF
    |    services.xml
    |
    \---lib
    |    dependency1.jar
    |    dependency2.jar
    |
    \---com
        +---company
        |    Service.class
        |

But this is mainly for a standalone deployment scenario.

embedded in .war

Most of time, we embed our service into our web application and the service implementation will reuse the application logic.

In embedded mode, we needn’t package as a .aar. Just a directory in WEB-INF/services is OK.

\---book
    |   pom.xml
    |   README
    |
    \---src
        +---main
        |   |   log4j.properties
        |   |
        |   \---samples
        |       \---demo
        |               Book.java
        |               BookService.java
        |
        +---test
        \---webapp
            \---WEB-INF
                |   web.xml
                \----conf
                |        axis2.xml
                |
                \---services
                    \---BookService
                        \---META-INF
                                services.xml