Preface
This article is to undertake the previous article:
[Axis2 and Eclipse Integrated development of Web Service Series II] Top-down mode, reverse generation of the server via WSDL
In the previous article, I outlined how to create a Web service using Top-down. But there is basically no introduction to how to deploy and invoke, and some of the details.
At the request of some Bo friends, but also at the time of their own free, then the detailed introduction of the whole section how to proceed.
Environment Preparation
The JDK must be installed, and that's not much to say.
1. Eclipse 3.5.2
The requirements for the Eclipse version are not very strict, but they follow the WTP plugin.
2. Tomcat6
After downloading the normal installation will be OK.
steps to create a Web Service
This creates a Web service that operations two number additions. Given two numbers, calculate their and.
(Of course, here is just an example, in the actual situation, it may be like passing the city name, get the example of city weather forecast)
1. Create a new dynamic Web Project-named Webserviceprj
The project structure is simple, the content of Web. XML is simple, only the configuration of the first page is configured.
2. Right-click on WEBSERVICEPRJ, select New WSDL
3. Named calculatesoap.wsdl
Next
After 4 clicks, a calculatesoap.wsdl file is created under the path of the project, which is opened by default in the Design view.
5. Modify method name Newoperation to Addoperation
6. Modify input, input parameters
Click on the Red section to go to the edit sub-view
7. Modify parameter names and add required parameters
The results are as follows:
The output section is similar, with the following results:
After the modification is complete, save. The part of the WSDL is basically done.
WSDL is just a description of a service, and as for what the service actually does, it will generate the code for the Web service. is to use the top down method to generate a Web service.
8. Right-click the project to create a WEB service
9. Next
10. Keep Next until you're done, and see how eclipse helped us produce those files.
1) The generated server Java code.
The Java file at the end of the impl is where the actual logic is written.
2) Automatic import of some of Axis's jar packages
3) Description of the resulting deployment (useful later)
4) This web. XML has been modified. Automatically adds some configuration for the servlet of axis
5) A WSDL directory and calculatesoapsoap.wsdl file will be generated under webcontent.
This content is similar to the calculatesoap.wsdl created earlier (so the good name is the previous WSDL without soap)
To this, and did not end. You also need to deploy this Web service.
One. Deploy this webservice way there are many kinds of, simple one way, is to create a SERVER-CONFIG.WSDD under Web-inf
The contents are as follows:
<?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 "><globalconfiguration><parameter name=" AdminPassword "value=" admin "/><parameter name=" attachments. Directory "value=" D:\Tomcat\temp\axis\WEB-INF\attachments "/><parameter name=" Attachments.implementation " Value= "Org.apache.axis.attachments.AttachmentsImpl"/><parameter name= "Sendxsitypes" value= "true"/>< Parameter Name= "Sendmultirefs" value= "true"/><parameter name= "Sendxmldeclaration" value= "true"/>< Parameter Name= "Axis.sendminimizedelements" value= "true"/><requestflow>
This file, most of the content is the same.It's just the middle piece.
is copied from the previously generated DEPLOY.WSDD.
To this, the development work is basically completed.
Package, deploy War files
1. Packaging
Right-click the project and export the war file with the war name Webserviceprj.war
2. Copy the Webserviceprj.war to the WebApps of Tomcat
3. Browser access: Http://localhost:8080/webServicePrj/services
The first Web service is our new addition.
The last two are Axis's own.
Click the first WSDL link.
Entry: http://localhost:8080/webServicePrj/services/CalculateSOAPSOAP?wsdl
This is the address of the Service release (the actual development of course does not use localhost, but with the actual IP or domain name)
TestTest the way, of course, you can use [Axis2 and Eclipse Integration Development Web Service series one] to generate a Web service Client (translate WSDL into Java code)
The way. However, simply put, you can use the SoapUI tool to invoke.
soapui:http://www.soapui.org/downloads/
1 on Yes One One1[Axis2 and Eclipse Integrated development of Web Service Series II] Top-down mode, reverse generation of service end via WSDL (cont.)