在Eclipse中使用Axis2插件自动生成WSDL文件
发布日期:2021-10-03 01:52:02 浏览次数:16 分类:技术文章

本文共 4020 字,大约阅读时间需要 13 分钟。

原文: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>

转载地址:https://blog.csdn.net/kai402458953/article/details/88340427 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:oracle 查看最大连接数和当前连接数,查看当前有哪些用户正在使用数据
下一篇:java模拟浏览器抓取网站信息和下载附件

发表评论

最新留言

第一次来,支持一个
[***.219.124.196]2024年03月23日 23时22分47秒