Generate a WSDL file using the Axis1 plugin that comes with eclipse

Source: Internet
Author: User
Tags soap apache tomcat wsdl



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 
    1. Package com.sean.ws;
    2. Public interface Mathintf {
    3. public int plus (int A, int b);
    4. }


Then write the service interface implementation class:


[Java]View PlainCopy  
    1. Package com.sean.ws;
    2. Public class Mathimpl implements mathintf {
    3. public int plus (int A, int b) {
    4. return a + B;
    5. }
    6. }


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


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.