zoukankan      html  css  js  c++  java
  • 使用Eclipse自带的Axis1插件生成WSDL文件

    JDK版本:1.5.0_22

    Eclipse版本:Helios Service Release 2(3.6.2)

    首先创建一个web工程,创建过程如下:

    如果选择Apache Tomcat v5.5,Dynamic web module version最高只能选择2.4,填写完成后点击“下一步”:

    填写默认输出文件夹,填写完成后点击“下一步”:

    填写根目录,填写完成后点击“完成”:

    工程创建完成后,编写服务接口:

    [java] view plain copy
     
    1. package com.sean.ws;  
    2.   
    3. public interface MathIntf {  
    4.     public int plus(int a, int b);  
    5. }  

    然后编写服务接口实现类:

    [java] view plain copy
     
    1. package com.sean.ws;  
    2.   
    3. public class MathImpl implements MathIntf {  
    4.     public int plus(int a, int b) {  
    5.         return a + b;  
    6.     }  
    7. }  

    然后在服务接口实现类的基础上自动生成服务接口WSDL文件:

    服务器选择Tomcat 6.0,Web Service环境选择Apache Axis(可选项还包含Axis2和CXF,不过这两项在使用前要预先设置),服务工程选择前面创建的ws_create工程,选择完成后点击“下一步”:

    这里可以修改生成的WSDL文件文件名、接口方法以及WSDL文件类型,选择完成后点击“下一步”:

    只生成Web Service WSDL文件的话,不需要发布接口(此时也不能发布接口),这里直接点击“完成”即可

    Web Service环境Apache Axis所需的jar包会自动放入WebRootWEB-INFlib路径下

    并且在WebRootwsdl路径下生成Web Service接口描述文件MathImpl.wsdl

    接口部署文件将会生成在WebRootWEB-INFMathImplServicecomseanws路径下

    Web Service WSDL文件内容如下(MathImpl.wsdl):

    [java] view plain copy
     
    1. <?xml version="1.0" encoding="UTF-8"?>  
    2. <wsdl:definitions targetNamespace="http://ws.sean.com"   
    3.         xmlns:apachesoap="http://xml.apache.org/xml-soap"   
    4.         xmlns:impl="http://ws.sean.com" xmlns:intf="http://ws.sean.com"   
    5.         xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"   
    6.         xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"   
    7.         xmlns:xsd="http://www.w3.org/2001/XMLSchema">  
    8. <!--WSDL created by Apache Axis version: 1.4  
    9. Built on Apr 22, 2006 (06:55:48 PDT)-->  
    10.  <wsdl:types>  
    11.   <schema elementFormDefault="qualified"   
    12.         targetNamespace="http://ws.sean.com"   
    13.         xmlns="http://www.w3.org/2001/XMLSchema">  
    14.    <element name="plus">  
    15.     <complexType>  
    16.      <sequence>  
    17.       <element name="a" type="xsd:int"/>  
    18.       <element name="b" type="xsd:int"/>  
    19.      </sequence>  
    20.     </complexType>  
    21.    </element>  
    22.    <element name="plusResponse">  
    23.     <complexType>  
    24.      <sequence>  
    25.       <element name="plusReturn" type="xsd:int"/>  
    26.      </sequence>  
    27.     </complexType>  
    28.    </element>  
    29.   </schema>  
    30.  </wsdl:types>  
    31.    <wsdl:message name="plusResponse">  
    32.       <wsdl:part element="impl:plusResponse" name="parameters">  
    33.       </wsdl:part>  
    34.    </wsdl:message>  
    35.    <wsdl:message name="plusRequest">  
    36.       <wsdl:part element="impl:plus" name="parameters">  
    37.       </wsdl:part>  
    38.    </wsdl:message>  
    39.    <wsdl:portType name="MathImpl">  
    40.       <wsdl:operation name="plus">  
    41.          <wsdl:input message="impl:plusRequest" name="plusRequest">  
    42.        </wsdl:input>  
    43.          <wsdl:output message="impl:plusResponse" name="plusResponse">  
    44.        </wsdl:output>  
    45.       </wsdl:operation>  
    46.    </wsdl:portType>  
    47.    <wsdl:binding name="MathImplSoapBinding" type="impl:MathImpl">  
    48.       <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>  
    49.       <wsdl:operation name="plus">  
    50.          <wsdlsoap:operation soapAction=""/>  
    51.          <wsdl:input name="plusRequest">  
    52.             <wsdlsoap:body use="literal"/>  
    53.          </wsdl:input>  
    54.          <wsdl:output name="plusResponse">  
    55.             <wsdlsoap:body use="literal"/>  
    56.          </wsdl:output>  
    57.       </wsdl:operation>  
    58.    </wsdl:binding>  
    59.    <wsdl:service name="MathImplService">  
    60.       <wsdl:port binding="impl:MathImplSoapBinding" name="MathImpl">  
    61.          <wsdlsoap:address location="http://localhost:8080/ws_create/services/MathImpl"/>  
    62.       </wsdl:port>  
    63.    </wsdl:service>  
    64. </wsdl:definitions>  

     

  • 相关阅读:
    NPOIHelper
    NPOI.dll 用法:单元格、样式、字体、颜色、行高、宽度 读写excel
    SQL中的循环、for循环、游标
    .net mvc datatables中orderby动态排序
    MVC中给TextBoxFor设置默认值和属性
    定义实体系列-@JsonIgnoreProperties注解
    微信公众号登录与微信开放平台登录区别
    http-Post请求,Post Body中的数据量过大时出现的问题
    .net core Linux 安装部署
    二、微信公众号开发-获取微信用户信息(.net版)
  • 原文地址:https://www.cnblogs.com/cnblog-long/p/7261921.html
Copyright © 2011-2022 走看看