`

在Eclipse中使用Axis2插件自动生成WSDL文件

阅读更多
原文:http://blog.csdn.net/a19881029/article/details/40194787


1,下载Axis2插件,最新版本为1.6.2:http://www.apache.org/dyn/mirrors/mirrors.cgi/axis/axis2/java/core/1.6.2/axis2-eclipse-codegen-plugin-1.6.2.zip

2,将zip压缩包中的org.apache.axis2.eclipse.codegen.plugin_1.6.2.jar放置在%ECLIPSE_HOME%\plugins路径下

3,重启Eclipse

安装完成后就可以使用安装好的插件生成WSDL文件了

1,创建一个普通的Java项目,在该项目下创建一个接口,在Navigator视图下,项目结构如下:


[java] view plain copy 在CODE上查看代码片派生到我的代码片
package com.sean; 
 
public interface Math { 
    public int add(int a, int b); 

2,选择Eclipse菜单栏中的File -> New -> Other...,在弹出的对话框中选择Axis2 Code Generator,然后选择Next


3,然后选择通过Java源文件生成WSDL


4,Fully Qualified Class name中填写用来生成WSDL的Java类全名称

然后通过Add Folder按钮添加Java类编译后生成的.class文件(Math.class)所在路径

最后点击Test Class Loading...按钮

当测试通过时(按钮右侧显示Class file loaded successfully),才可点击Next按钮


5,WSDL文件属性值,这里使用默认的即可


6,选择将WSDL文件生成在本地文件系统,并且选择好WSDL文件的生成路径及文件名


点击Finish后,将在指定位置生成WSDL文件(Math.wsdl),文件内容如下:

[html] view plain copy
<?xml version="1.0" encoding="UTF-8"?> 
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"  
    xmlns:ns1="http://org.apache.axis2/xsd"  
    xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"  
    xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"  
    xmlns:xsd="http://sean.com"  
    xmlns:xs="http://www.w3.org/2001/XMLSchema"  
    xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"  
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"  
    xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"  
    targetNamespace="http://sean.com"> 
    <wsdl:types> 
        <xs:schema attributeFormDefault="qualified"  
            elementFormDefault="qualified"  
            targetNamespace="http://sean.com"> 
            <xs:element name="add"> 
                <xs:complexType> 
                    <xs:sequence> 
                        <xs:element minOccurs="0" name="args0" type="xs:int"/> 
                        <xs:element minOccurs="0" name="args1" type="xs:int"/> 
                    </xs:sequence> 
                </xs:complexType> 
            </xs:element> 
            <xs:element name="addResponse"> 
                <xs:complexType> 
                    <xs:sequence> 
                        <xs:element minOccurs="0" name="return" type="xs:int"/> 
                    </xs:sequence> 
                </xs:complexType> 
            </xs:element> 
        </xs:schema> 
    </wsdl:types> 
    <wsdl:message name="addRequest"> 
        <wsdl:part name="parameters" element="xsd:add"/> 
    </wsdl:message> 
    <wsdl:message name="addResponse"> 
        <wsdl:part name="parameters" element="xsd:addResponse"/> 
    </wsdl:message> 
    <wsdl:portType name="MathPortType"> 
        <wsdl:operation name="add"> 
            <wsdl:input message="xsd:addRequest" wsaw:Action="urn:add"/> 
            <wsdl:output message="xsd:addResponse" wsaw:Action="urn:addResponse"/> 
        </wsdl:operation> 
    </wsdl:portType> 
    <wsdl:binding name="MathSoap11Binding" type="xsd:MathPortType"> 
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> 
        <wsdl:operation name="add"> 
            <soap:operation soapAction="urn:add" style="document"/> 
            <wsdl:input> 
                <soap:body use="literal"/> 
            </wsdl:input> 
            <wsdl:output> 
                <soap:body use="literal"/> 
            </wsdl:output> 
        </wsdl:operation> 
    </wsdl:binding> 
    <wsdl:binding name="MathSoap12Binding" type="xsd:MathPortType"> 
        <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> 
        <wsdl:operation name="add"> 
            <soap12:operation soapAction="urn:add" style="document"/> 
            <wsdl:input> 
                <soap12:body use="literal"/> 
            </wsdl:input> 
            <wsdl:output> 
                <soap12:body use="literal"/> 
            </wsdl:output> 
        </wsdl:operation> 
    </wsdl:binding> 
    <wsdl:binding name="MathHttpBinding" type="xsd:MathPortType"> 
        <http:binding verb="POST"/> 
        <wsdl:operation name="add"> 
            <http:operation location="add"/> 
            <wsdl:input> 
                <mime:content type="application/xml" part="parameters"/> 
            </wsdl:input> 
            <wsdl:output> 
                <mime:content type="application/xml" part="parameters"/> 
            </wsdl:output> 
        </wsdl:operation> 
    </wsdl:binding> 
    <wsdl:service name="Math"> 
        <wsdl:port name="MathHttpSoap11Endpoint" binding="xsd:MathSoap11Binding"> 
            <soap:address location="http://localhost:8080/axis2/services/Math"/> 
        </wsdl:port> 
        <wsdl:port name="MathHttpSoap12Endpoint" binding="xsd:MathSoap12Binding"> 
            <soap12:address location="http://localhost:8080/axis2/services/Math"/> 
        </wsdl:port> 
        <wsdl:port name="MathHttpEndpoint" binding="xsd:MathHttpBinding"> 
            <http:address location="http://localhost:8080/axis2/services/Math"/> 
        </wsdl:port> 
    </wsdl:service> 
</wsdl:definitions> 
分享到:
评论

相关推荐

    MyEclipse下Axis2插件的下载和安装:wsdl生成客户端

    到plugin xml文件中 保存后重新启动Eclipse即可 "&gt;1 下载 Myeclipse Axis2 插件 http: archive apache org dist ws axis2 tools 1 4 1 下载 axis2 eclipse codegen wizard zip 和 axis2 eclipse service ...

    AXIS2 Eclipse插件 WSDL

    AXIS2 最新版本1.7.3针对 eclipse插件,一方面可以根据java接口类生成WSDL文件,另一方面可以根据WSDL生成客户端或服务端代码,生成的WSDL文件和代码符合web server SOAP协议规范标准!解压后的jar复制到Eclipse的...

    axis2支持webservice 自动生成代码客户端服务端代码插件

    axis2支持webservice 自动生成代码客户端服务端代码 基于eclipse

    axis2方式开发webservice

    第三种方式是利用axis2插件,将wsdl文件自动生成客户端代码,此种方式在myeclipse安装axis2.txt文件中已经做了详细介绍。 备注:资源超过了70M 分成了2部分 见axis2方式开发webservice(一)和 axis2方式开发...

    axis2的eclispe 插件

    axis2的eclispe插件分为2个,一个是帮助我们生成aar文件的,另一个是帮我们用wsdl文件生成stub代码的 官网下载地址是: ...

    axis2开发webservice(二)

    第三种方式是利用axis2插件,将wsdl文件自动生成客户端代码,此种方式在myeclipse安装axis2.txt文件中已经做了详细介绍。 备注:资源超过了70M 分成了3部分 见axis2方式开发webservice(一)和 axis2方式开发...

    Axis2 插件

    Eclipse的Axis插件,用来生成Web Service WSDL 服务端客户端代码

    axis2-eclipse

    下载完2个压缩文件后,可以直接把解压后的文件拷贝到plugins目录中,也可以在links目录中写文件路径的方式来安装插件,安装完插件后,打开eclipse,在package explorer 中点击右键---&gt;选择new----&gt;other中看到axis ...

    axis2开发webservice(三)

    第三种方式是利用axis2插件,将wsdl文件自动生成客户端代码,此种方式在myeclipse安装axis2.txt文件中已经做了详细介绍。 备注:资源超过了70M 分成了3部分 见axis2方式开发webservice(一)和 axis2方式开发...

    axis2-eclipse-codegen-plugin-1.7.1

    eclipse 工具通过axis2插件,根据wsdl生成webservice客户端代码。将此文件解压缩,放到%eclipse_home%\eclipse\plugins中,重启eclipse。然后选中项目,新建-other-axis2 wizards 下的axis2 code generate ,然后...

    axis2-eclipse服务端插件

    WebService Axis2框架根据java class 生成wsdl文件的插件,解压后把文件放到eclipse安装目录的plugins文件夹下就行,具体使用可以看我的博客

    axis2-eclipse-codegen-plugin-1.5.6.zip

    eclipse的在编写webservice时生成wsdl的插件

    axis2-eclipse-codegen-wizard.zip

    axis2帮助用wsdl文件生成stub代码的eclipse插件

    (修正版)用Eclipse3.2+MyEclipse5.5M1+axis2_1.1.1+tomcat5.5 开发Web Services

    新版的Eclipse可能不完全向下兼容Axis2插件(太旧版的Axis2插件)。 网上博客的文章很多存在一些小错误。 细节问题没做好。 现在我把自己的操作成功的实例重新演练一遍,基本跟大家啊网上参考的一致,请注意every ...

    axis2-1.6.2.zip

    java webservice 开发用来生成wsdl的插件,整合到eclipse里面

Global site tag (gtag.js) - Google Analytics