Get started with axis2 for WebService (details)

Source: Internet
Author: User
Document directory
  • 1. Create a project
  • 2. How to publish the test class so that soapui or a third party can access
  • Derivative
Axis2.pdf is detailed in the documentation of the Recommendation for establishing a server

Procedure

1. Create a project

1: renew from the Internet
2: unzip the axis2-1.6.2-war to deploy axis2.war to the webapps \ directory of Tomcat, start Tomcat,
In this case, accessing localhost: 8080/axis2 will bring up the interface, and tomcat under the webapps directory will automatically generate the axis2 project.
3: Create a WebService project in eclipse, and import the axis2 project generated in the previous step to the new project according to the corresponding position.
4: Create a Java class test. Just write a pulic method and return it.

2. How to publish the test class so that soapui or a third party can access

1: published as Web service,there is a services.xml( axaxis2.pdf) file, this file needs to be placed in the class directory of the new META-INF directory
Ex: The location is as follows:
D: \ class \ service \ test. Class
D: \ Classes \ META-INF \ Services. xml
2: To publish a WebService in this way, you must package it into a. AAR file and put it into the project. (Note: if you do not add a new service, you only need to package it once, regardless of whether the method content is changed)
Go to the D: \ class directory in the Windows console and enter the following command to generate the. AAR file.
Jar cvf gt. AAR. (generate GT. AAR)
3: Put GT. Arr in WEB-INF/services/GR. Arr
4: restart Tomcat and enable http: // localhost: 8080/axis2_webservice/services/listservices to check whether the service is generated.
5: Test, enter

Http: // localhost: 8080/axis2_webservice/services/springservice/sayhello? Name = 66 accessible

Http: // localhost: 8080/axis2_webservice/services/springservice? WSDL

Open soapui for testing

6. Integrate spring and use the following services. XML to package and generate AAR.

(Note that springservice is your spring configuration, for example, <bean id = "springservice" class = "service. Test">)

(Note that org. Apache. axis2.extensions. Spring. Receivers. springservletcontextobjectsupplier is the spring. jar package of axis2, which is included in the Lib of axis2)

Services. xml:
<Service name = "springservice">
<Description>
Spring aware
</Description>
<Parameter name = "serviceobjectsupplier">
Org. Apache. axis2.extensions. Spring. Receivers. springservletcontextobjectsupplier
</Parameter>
<Parameter name = "springbeanname">
Springservice
</Parameter>
<Messagereceivers>
<Messagereceiver MEP = "http://www.w3.org/2004/08/wsdl/in-out"
Class = "org. Apache. axis2.rpc. Receivers. rpcmessagereceiver"/>
</Messagereceivers>
</Service>

Derivative

1. binary images and audio can be transmitted (see the document for details)
2. You can perform operations only after logging on to the WebService. And operate multiple WebServices after login (similar to one login server to operate n Different module servers)

Client 1 procedure

1: Use wsdl2java to generate client code
Go to cmd
Cd e: \ axis2-1.6.2-bin \ axis2-1.6.2 \ bin
Wsdl2java-Uri http: /localhost: 8080/axis2_webservice/services/springservice? WSDL-P client-S-O WS
The client code WS package is generated in the current directory.

2: import the generated wsws to the new project. Then, follow the instructions in the document "webservice的axaxis2.pdf" to perform the operations.

3: Modular

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.