SPRING4 Integrated Axis2__webservice

Source: Internet
Author: User

1, axis2+spring integration concise and can run the successful example (Pojo and spring:1 implementation)

http://blog.csdn.net/shimiso/article/details/9946743

2, axis2+spring Integration (Pojo and SPRING:2 implementation)

http://tzz6.iteye.com/blog/2269441


Axis2 Service Release and Spring Object injection Summary:

Deploying Web Services
There are two ways to deploy Web services: Pojo and AAR
If you use the Pojo method (which is not a concept with the development of the Pojo), you can put the compiled class file into the web-inf/pojo/directory, but this class cannot use the package, so the limitations are obvious and of little value.
The other is to use the AAR package and deploy it to the Web-inf/services directory. AAR has its own specific structure, the internal package structure of class files, in the Meta-inf directory decentralized Services.xml, in the Lib Directory Decentralized class library (seemingly unable to load does not work).

In fact, the content of AAR can be extracted directly into the axis2\web-inf\classes, equivalent to the Axis2 WEB application to do two times, so that the use of the jar can be directly placed under the Axis2\web-inf\lib, You can also get to ServletContext.

Developing Web Services
Pojo:
The easiest way to use Pojo directly as a Web service is to configure the Services.xml and package it in the AAR package.

Pojo and Spring:
1. If you can use Spring (with a servletcontext) at the Web application level:
A) then you can use the servlet or listener in web.xml to load the spring context in.
b The Spring configuration file simply defines the bean configuration required by the Web service.
C Axis2 can get to ServletContext (Applicationcontext.xml in AXIS2 Web applications, not AAR packages), so configuring a service dependent on spring in services.xml requires the use of SERVICEOBJECTSUPPL IER (Springservletcontextobjectsupplier) and springbeanname to develop a bean that needs to be configured as a service.

2. If you are using spring at the Web application level, AXIS2 cannot get the context of spring, such as Axis2 in the AAR package (without a servletcontext) (in fact, spring can initialize But Axis2 can't get servletcontext, then get the context in a different way:
(a) Add Axis2 's Applicationcontextholder to spring's applicationcontext.xml file, allowing Axis2 to get to the context of spring.
b Axis2 's Services.xml uses Serviceobjectsupplier (springappcontextawareobjectsupplier) and springbeanname for beans that are defined using spring.

3. Use Spring (Spring Inside an AAR) within AAR (not implemented)
A The Initialization program (SPRINGINIT) that loads the spring configuration file needs to be defined, and the Servicelifecycle interface needs to be implemented.
(b) To configure Springinit in Services.xml, you need to set SERVICETCCL to composite and load-on-startup to true. This initializes the spring before loading other services.
C You need to configure Applicationcontextholder in spring's applicationcontext.xml file so that Axis2 can obtain the spring's co by springappcontextawareobjectsupplier ntext
d The official documentation says the spring package can be placed in the Lib directory of AAR, but the class library under the AAR package lib directory cannot be loaded in practice, so it can only be placed in the Lib directory of the AXIS2 Web application.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.