Axis1.4 develop webservice server (Quick Start)-based on jdk1.4, axis1.4jdk1.4
Preface:
There are many webservice development methods and frameworks, and cxf. However, annotations are required when you write service classes. If the current jdk is 1.4, you cannot use the annotation function. Therefore, the axis tool can be used here.
1. jar package:
2. Generally, webservice is used in web projects. Therefore, create a web project and put the required jar package in the lib directory.
3. In the web. xml file, add
<Servlet> <servlet-name> AxisServlet </servlet-name> <servlet-class> org. apache. axis. transport. http. axisServlet </servlet-class> </servlet> <! -- Here is the path to access the service --> <servlet-mapping> <servlet-name> AxisServlet </servlet-name> <url-pattern>/services/* </url-pattern> </servlet-mapping>
4. Create a service class, an interface, and an implementation class. The first is the interface.
package edu.hue.server;public interface SayHello { public String say(String name);}
Then the interface implementation class
package edu.hue.server;public class SayHelloImpl implements SayHello{ public String say(String name) { return "Hello my friend " + name; }}
5. the following creates a WEB-INF under the server-config.wsdd (this file is directly created, and then the following code is copied, and then add your own service configuration as needed, in fact, this file can be generated by yourself. You need to create a deploy by yourself. wsdd, The server-config.wsdd is automatically generated after the project is started to run. Here for convenience, directly omitted process, just need to add your own service on the server-config.wsdd can be, first learn to use again)
<? Xml version = "1.0" encoding = "UTF-8"?> <Deployment xmlns = "http://xml.apache.org/axis/wsdd/" xmlns: java = "http://xml.apache.org/axis/wsdd/providers/java"> <! -- The globalConfiguration here does not mean anything at the moment. You can comment it out first, <globalConfiguration> <parameter name = "sendMultiRefs" value = "true"/> <parameter name = "disablePrettyXML" value = "true"/> <parameter name = "adminPassword "value =" admin "/> <parameter name =" attachments. directory "value =" E: \ sotfWares \ sotfware \ Tomcat \ apache-tomcat-7.0.62-windows-x86 \ apache-tomcat-7.0.62 \ webapps \ test_axis3 \ WEB-INF \ attachments "/> <parameter na Me = "dotNetSoapEncFix" value = "true"/> <parameter name = "enableNamespacePrefixOptimization" value = "false"/> <parameter name = "sendXMLDeclaration" value = "true"/> <parameter name = "sendXsiTypes" value = "true"/> <parameter name = "attachments. implementation "value =" org. apache. axis. attachments. attachmentsImpl "/> <requestFlow>
Parameter explanation: name: a name for the service. Here is sayHello, and the following value = "here is the full path of your service implementation class ", almost all these two parameters need to be modified, and other copies are enough.
6. Run the project, enter http: // localhost: 8080/test_axis3_stub/services in the browser, and press enter to access the project.
Http: // localhost: 8080/test_axis3_stub (project name)/services (service access path, in the web. blocking/services/* is configured in xml, so you only need to enter services to access it)
This is a simple introduction. If complicated parameters such as bean transfer are involved, further research is required. (It seems that you also need to configure the service in the server-config.wsdd)