Use AXIS to join WebService in existing applications

xiaoxiao2021-03-06  70

Step 1: Add a must-have class library

List in under:

ActiVation.jar

Axis-ant.jar

Axis.jar

Commons-discovery.jar

Commons-logging.jar

Jaxrpc.jar

Log4j-1.2.8.jar

Mail.jar (optional)

saaj.jar

Wsdl4j.jar

Xmlsec.jar (optional)

Step 2: Modify Web.xml

1. Add a servlet definition

Axisservlet

apache-axis servlet

Org.apache.axis.transport.http.axisservlet

adminServlet

Axis Admin Servlet

Org.apache.axis.transport.http.adminservlet

100

SOAPMONITORSERVICE

SOAPMONITORSERVICE

Org.apache.axis.monitor.soapmonitorService

SOAPMonitorport

5001

100

2. Add a servlet mapping

Axisservlet

/ servlet / axisservlet

Axisservlet

*. jws

Axisservlet

/ services / *

SOAPMONITORSERVICE / soapmonitor

adminServlet

/ servlet / adminservlet

->

3. Add MIME type

WSDL

text / xml

XSD

text / xml

Step 3: Write a WebService program

Example: Add file hello.jw in the application directory

Source code is under:

Public class hello {

Private static int Time = 1;

Public String Hello (String Name) {

IF (name == null) {

Name = ""

}

Return "Hello" Name ", welcome to the world of Web services. Today is" new java.util.date ();

}

}

No need to compile,

http://localhost/ws/hello.jws? WSDL is the WebService address, access to the execution

转载请注明原文地址:https://www.9cbs.com/read-119844.html

New Post(0)