Create a Web project first, creating the following process:
If you choose Apache Tomcat v5.5,dynamic Web module version, you can select up to 2.4, and then click "Next" When you are finished:
Fill in the Default output folder and click "Next" When you are finished:
Fill in the root directory, complete and click "Done" after completing:
After the project is created, write the service interface:
[Java]View PlainCopy
- Package com.sean.ws;
-
- Public interface Mathintf {
- public int plus (int A, int b);
- }
Then write the service interface implementation class:
[Java]View PlainCopy
- Package com.sean.ws;
-
- Public class Mathimpl implements mathintf {
- public int plus (int A, int b) {
- return a + B;
- }
- }
The Service interface WSDL file is then automatically generated on the basis of the Service interface implementation class:
The server chooses the Tomcat 6.0,web service environment to select Apache Axis (options also include Axis2 and CXF, but these two are pre-set before use), the service engineering selects the Ws_create project created earlier, and then click "Next" after selecting done:
Here you can modify the generated WSDL file file name, interface method, and WSDL file type, select Finish and click "Next":
If you only generate a Web Service WSDL file, you do not need to publish the interface (and you cannot publish the interface at this time), just click "Done" here.
WEB service Environment Apache axis requires a jar package that is automatically placed under the Webroot\web-inf\lib path
and generate a Web service Interface description file under the WEBROOT\WSDL path mathimpl.wsdl
The interface deployment file will be generated under the WEBROOT\WEB-INF\MATHIMPLSERVICE\COM\SEAN\WS path
The contents of the Web Service WSDL file are as follows (MATHIMPL.WSDL):
[Java]View PlainCopy
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetnamespace="http://ws.sean.com"
xmlns:apachesoap="Http://xml.apache.org/xml-soap"
Xmlns:impl= "http://ws.sean.com" xmlns:intf="http://ws.sean.com "
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="Http://www.w3.org/2001/XMLSchema" >
<!--WSDL created by Apache Axis version: 1.4
Built on APR , 2006 (from:PDT) -
<wsdl:types>
<schema elementformdefault="qualified"
targetnamespace="http://ws.sean.com"
xmlns="Http://www.w3.org/2001/XMLSchema" >
<element name="plus" >
<complexType>
<sequence>
<element name="a" type="Xsd:int"/>
<element name="B" type="Xsd:int"/>
</sequence>
</complexType>
</element>
<element name="Plusresponse" >
<complexType>
<sequence>
<element name="Plusreturn" type="Xsd:int"/>
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
<wsdl:message name="Plusresponse" >
<wsdl:part element="impl:plusresponse" name="Parameters" >
</wsdl:part>
</wsdl:message>
<wsdl:message name="Plusrequest" >
<wsdl:part element="Impl:plus" name="Parameters" >
</wsdl:part>
</wsdl:message>
<wsdl:porttype name="Mathimpl" >
<wsdl:operation name="plus" >
<wsdl:input message="impl:plusrequest" name="Plusrequest" >
</wsdl:input>
<wsdl:output message="impl:plusresponse" name="Plusresponse" >
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="mathimplsoapbinding" type="Impl:mathimpl" >
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="plus" >
<wsdlsoap:operation soapaction=""/>
<wsdl:input name="Plusrequest" >
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="Plusresponse" >
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Mathimplservice" >
<wsdl:port binding="impl:mathimplsoapbinding" name="Mathimpl" >
<wsdlsoap:address location="Http://localhost:8080/ws_create/services/MathImpl"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Generate the WSDL file using the AXIS1 plug-in from eclipse