"WebService" publishes Axis2 's WebService server

Source: Internet
Author: User
Tags wsdl

Axis2 version: axis2-1.5.4

Preparation: Download Axis2-1.5.4-war.zip (build server), Axis2-1.5.4-bin.zip (Axis2 jar package), Jdk5 (and above), Tomcat (port I set to 8086)

Hand-in-hand super Details Axis2 WebService server generation and release.

1. Unzip Axis2-1.5.4-war.zip Axis2.war, put Axis2.war into Tomcat's WebApps directory, launch Tomcat to load Axis2.war and generate a new AXIS2 directory, open browser access http:/ /localhost:8086/axis2/can display axis2 initialized page, click "Services" hyperlink to http://localhost:8086/axis2/services/ Listservices, this page displays all the webservice published to the Axis2 directory.

2, the Axis2 directory mentioned in the previous step, players will generally change to have the business characteristics of the name, here the example is changed to PP Bar (first shut Tomcat), open Tomcat, access to the URL will be changed to http://localhost:8086/pp/.

3, click " Services" hyperlink to Http://localhost:8086/pp/services/listServices, the initial release by default there are 1 webservice called "Version". Remember to delete Axis2.war when you are finished.

4. Add the webservice you wrote next. Development tools with MyEclipse or Eclipse, new Java project, here is a sample project TTTT, in TTTT inside a new folder, named Lib, Put on the Axis2 jar package (extracted by axis2-1.5.4-bin.zip, all put on it), and then import the jar package into the TTTT project. New Package:com.tttt.server in Engineering, new class: Com.tttt.server.Hello, Programming:


5. The project is exported to AAR file, Practice: Engineering TTTT Right-click to select Export---JAR file---Remove the hook in the upper right corner---the Export file name to change, such as.


6. Create a new services.xml. Regarding this WebService configuration document, also has the certain skill, in summary each AAR corresponds 1 services.xml, the specific label description, the configuration introduction please oneself Google, the universal configuration content is as follows:

<!--WebService profile   --><service name= "Tttt_service" ><!--WebService named, you can help   yourself-- <description>please Type Your service description here</description><messagereceivers>< Messagereceiver mep= "http://www.w3.org/2004/08/wsdl/in-only" class= " Org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver "/><messagereceiver  mep=" http://www.w3.org/ 2004/08/wsdl/in-out "  class=" Org.apache.axis2.rpc.receivers.RPCMessageReceiver "/></messagereceivers ><parameter name= "ServiceClass" >com.tttt.server.Hello</parameter></service>
7. Put this services.xml into the Tttt.jar "Meta-inf directory (open the jar with the decompression software), then change the suffix jar to AAR and put it in D:\Program files\apache-tomcat-6.0.36\ Webapps\pp\web-inf\services, restart Tomcat.

8. Open Http://localhost:8086/pp/services/listServices can see the Tttt_service, click is its WSDL (a SOAP protocol in accordance with the XML, presumably so to understand it), published successfully. Other people will be able to provide you with a WSDL (URL or WSDL document) to generate the client generation, implementation of the implementation of the business logic, not to achieve that is his thing bird.


9. Reprint please indicate from whilejolly:http://blog.csdn.net/seedingly/article/details/25289257

To make more complex features, such as returning JSON data to the project to import a JSON jar package, to spell XML data will be dom4j such as a jar package, these axis2 outside the jar package can be placed in D:\Program files\ Apache-tomcat-6.0.36\webapps\pp\web-inf\lib, also known as the Lib directory of pp. WebService can return custom objects, so that client programming will be a little cumbersome, I prefer to make the object into JSON or XML, both unified and good account (to the client).

The next article will describe the generation and programming of the client.


Related Article

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.