Frequently Asked Questions on Apache Axis2

Got a question to be answered on Axis2? Then this document is just what the doctor ordered.

Ask your Questions Here

Any other doubts/issues e-mail your questions to:

Prefix subject with [Axis2]. To subscribe to mailing list see here.

Content of Questions and Answers

General

  1. I see OMElements in all the signatures, in the stubs, Client API and in skeletons. Where is data binding?

    Axis2 supports databinding using XML-Beans from 0.9 release. For more information please read the User Guide

  2. What is OMElement, What does it represents?

    OMElement is Axis2 representation of XML, it provide a tree model like DOM. If you are familiar with DOM or JDOM you can soon get familiarize with OM quickly. For more information read Axiom Tutorial

  3. Integration security tests fail with JDK 1.5

    You have to add Bouncy Castle as a JCE provider. Add the following entry to java.security file of the appropriate JRE on your machine. This file is available in the lib\security\ directory within the JRE directory.

    security.provider.7=org.bouncycastle.jce.provider.BouncyCastleProvider

    security.provider.# will have to be decided depending on the existing entries in the java.security file

    NOTE: For Windows XP the correct version can be found using 'java -version'. The correct file is JRE (typically c:\Program Files\Java\jre<version>\lib\security\java.security.

Class Loading Issues

  1. How do I access resources that I put into my service /module archive file?
  2. Axis2 has the notion of service isolation where each service or module gets its own class loader. Using this class loader you can access any resource that you put into your service archive file. You may want to access your resources from different locations. For example,

    1. A third party module wants to access your resources, then the scenario is as follows:

       AxisService myService =
       messageContext.getAxisConfiguration().getAxisService("serviceName"); 
    
       or
    
       AxisService myService = msgCtx.getAxisService();

    Then you can ask for service class loader using which you can access its resources

       ClassLoader clsLoader = myService.getServiceClassLoader();
       clsLoader.getResourceAsStream("myResource");

    2. To initialize service implementation class at the MessageReceiver level the following steps need to be taken

       AxisService service = msgCtx.getAxisService();
       ClassLoader clsLoader = service.getServiceClassLoader();
       Class.forName("serviceName",clsLoader,true);

    NOTE : Axis2 default MessageReciver uses the same technique to initialize service implementations

    3. If you want to load your resources at the service implementation class then the scenario is as follows

       getClass().getClassLoader().getResourceAsStream("myResource");

Client API

  1. I want to do request response Messaging, Where should I look?

    Look at the ServiceClient class, for more information please read the User's Guide

  2. I want to do One Way Messaging, Where should I look?

    From Axis2 0.94 onwards, both request-response and one way messaging will be handled by ServiceClient.

  3. When I try to do a non blocking call with use Separate Listener true I get the error to do two Transport Channels the Addressing Modules must be engaged, Why is this?

    To do the two transport Channel invocation you need to engage the addressing module. You can enable it by un-commenting the entry in the axis2.xml file or Call.engageModule(QName). But addressing is enabled by default.

  4. I have engaged addressing and when I trying to invoke a service I am getting an exception

    If you have engaged addressing , then you have to have wsa:action , so you have to called
    option.setAction("urn:myaction");
    It should be not that the action should be a URI.

  5. What is Axis Repository?

    Repository stores the configuration of Axis2, the users should specify the repository folder starting the Axis Server (HTTP or TCP). In the case of tomcat it is the webapps/axis2/WEB-INF folder. Following picture shows a sample repository.

    Modules and services have a archive format defined and they are automatically picked up by Axis2 when they are copied to corresponding folders.

Maven

  1. I just installed maven and it gives an error when I was trying to run maven on Axis2 ......

    Axis2 requires itest plugin to run some of the tests. Better get it using following command.

  2. I have problems building with maven 1.1 ....

    It seems that maven 1.1 doesn't come bundled with the required artifact plugin. Run following to get it updated

  3. What are the frequently used maven commands?
  4. Command
    Description
    maven
    download relevant jars, if not available and compile and run tests of the system.
    maven clean Clean all the stuff build so far, that are in the target folder. This will not clean the jar repository
    maven test
    run only the tests. Will do automatic compilation of changed sources as well. This will not run soap interop tests
    maven clean all-tests
    Clean up and run all off line and on line tests
    maven itest
    To run the online-mode tests for say the modules/integration Run "maven itest" from modules/integration
    maven test itest
    To run all tests for say the modules/integration Run "maven test itest" from modules/integration
    maven -g
    List down all the commands available with maven
    maven multiproject
    generate this site
    maven idea:multiproject
    generate IDEA .ipr, .iml and .iws project files
    maven -Dmaven.test.skip=true
    Builds Axis2 and skips all the tests
    maven dist-min-bin Will generate the binary version of Axis2 minimal distribution
    maven dist-min-src Will generate the source version of Axis2 minimal distribution
    maven dist-std-bin Will generate the binary version of Axis2 standard distribution
    maven dist-std-bin Will generate the source version of Axis2 standard distribution
    maven release Generate all the distributales for Axis2
    maven clean jar -Dmaven.test.skip=true -o This will clean all the target folder and compile your source, without running the tests or downloading snapshots of dependancies. This is the quickest way of compiling Axis2 sources. However it is highly recommended to run the tests all the time

Services

  1. How do I have multiple services in one service archive?
  2. It's just a matter of writing a services.xml file to configure the service or services in an archive file. The corresponding services.xml SHOULD look like below:

       <serviceGroup>
       <service name="myService1">
       ...........................
       </service>
    
       <service name="myService2">
       ...........................
       </service>
       <serviceGroup>

    NOTE : The name attribute is a compulsory attribute which will become the name of the services. But if you want to have one service in the archive file then there are two options, either have one service inside serviceGroup tag or have only one service tag as shown below in your services.xml, in which case, name of the service will be the name of the archive file and you can not override that.

       <service>
       ...............
       <service>

Web Archive / Server side

  1. I see an internal server error page when I try to view the WSDL file.

    This happens specifically with tomcat 4.x and 5.0 in a JDK 1.5 environment. The reason is that the system picks up a wrong transformer factory class. This can be solved simply by putting the xalan-2.7.0.jar (found here) into the axis2/WEB-INF/lib directory

WSDL and Code Generation

  1. Given a WSDL 2.0 document with HTTP Binding to WSDL2Java, should it not be able to generate a client stub similar to what happens given a WSDL 1.1 document with SOAP Binding?
  2. WSDL 2.0 is not supported yet. We do not have a working WSDL 2.0 reader.

    However the codegen engine works off WOM (not WSDL4J) hence if the WSDL 2.0 reader is done, we are all set to generate code for it.

    And yes, it is perfectly possible for the codegen to generate code for the HTTP binding. We already have the client API support for making the REST calls and it should be a matter of putting in a correct template.