wsdl

<?xml version="1.0" encoding="UTF-8"?>

<wsdl:definitionsxmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"xmlns:ns1="http://org.apache.axis2/xsdxmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"xmlns:xsd="http://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://">

//wsdl命名空间定义,targetNamespace相当于生成java类的package。指定后会将生成文件放在里面,tns的意思就是this name service

    <wsdl:types>

        <xs:schemaattributeFormDefault="qualified" elementFormDefault="qualified"targetNamespace="http://">

            <xs:elementname="getName">

                <xs:complexType>

                    <xs:sequence/>

                </xs:complexType>

            </xs:element>

            <xs:elementname="getNameResponse">

                <xs:complexType>

                    <xs:sequence>

                        <xs:elementminOccurs="0" name="return"nillable="true" type="xs:string"/>

                    </xs:sequence>

                </xs:complexType>

            </xs:element>

        </xs:schema>

    </wsdl:types>

//typse里定义了message里所定义的element所引用的参数的定义,默认均为一个对象,如果是基本类型则被封装成一个类:

如:          <xs:element name="getNameResponse">

                <xs:complexType>

                    <xs:sequence>

                        <xs:elementminOccurs="0" name="return" nillable="true"type="xs:string"/>

                   </xs:sequence>

                </xs:complexType>

            </xs:element>

将生成一个getNameResponse类,其中将有一个setout,以及getout方法,这个类也将是getName方法里的返回值类型

    <wsdl:messagename="getNameRequest">

        <wsdl:partname="parameters" element="xsd:getName"/>

    </wsdl:message>

    <wsdl:message name="getNameResponse">

        <wsdl:partname="parameters" element="xsd:getNameResponse"/>

    </wsdl:message>

//message里定义了portType里所定义的往来消息的内容,name属性不是很重要,重要的是需要定义element,这个在上面部分将进行说明

    <wsdl:portTypename="MainTestPortType">

        <wsdl:operationname="getName">

            <wsdl:inputmessage="xsd:getNameRequest" wsaw:Action="urn:getName"/>

            <wsdl:outputmessage="xsd:getNameResponse" wsaw:Action="urn:getNameResponse"/>

        </wsdl:operation>

    </wsdl:portType>

//定义了webservice所对应的接口,并对其中的操作进行说明,可以在operation后面加参数

    <wsdl:binding name="MainTestSoap11Binding" type="xsd:MainTestPortType">

        <soap:bindingtransport="http://schemas.xmlsoap.org/soap/http"style="document"/>

        <wsdl:operationname="getName">

            <soap:operationsoapAction="urn:getName" style="document"/>

            <wsdl:input>

                <soap:bodyuse="literal"/>

            </wsdl:input>

            <wsdl:output>

                <soap:bodyuse="literal"/>

            </wsdl:output>

        </wsdl:operation>

    </wsdl:binding>

    <wsdl:binding name="MainTestSoap12Binding" type="xsd:MainTestPortType">

        <soap12:bindingtransport="http://schemas.xmlsoap.org/soap/http"style="document"/>

        <wsdl:operationname="getName">

            <soap12:operationsoapAction="urn:getName" style="document"/>

            <wsdl:input>

                <soap12:bodyuse="literal"/>

            </wsdl:input>

            <wsdl:output>

                <soap12:bodyuse="literal"/>

            </wsdl:output>

        </wsdl:operation>

    </wsdl:binding>

    <wsdl:binding name="MainTestHttpBinding" type="xsd:MainTestPortType">

        <http:bindingverb="POST"/>

        <wsdl:operationname="getName">

            <http:operationlocation="getName"/>

            <wsdl:input>

                <mime:contenttype="text/xml" part="parameters"/>

            </wsdl:input>

            <wsdl:output>

                <mime:contenttype="text/xml" part="parameters"/>

            </wsdl:output>

        </wsdl:operation>

    </wsdl:binding>

//binging块说明了操作所绑定的传输协议,style和use两个属性目前被定为document和literal,不必深究

    <wsdl:servicename="MainTest">

        <wsdl:portname="MainTestHttpSoap11Endpoint" binding="xsd:MainTestSoap11Binding">

            <soap:addresslocation="http://localhost:8080/axis2/services/MainTest"/>

        </wsdl:port>

        <wsdl:portname="MainTestHttpSoap12Endpoint" binding="xsd:MainTestSoap12Binding">

            <soap12:addresslocation="http://localhost:8080/axis2/services/MainTest"/>

        </wsdl:port>

        <wsdl:portname="MainTestHttpEndpoint" binding="xsd:MainTestHttpBinding">

            <http:addresslocation="http://localhost:8080/axis2/services/MainTest"/>

        </wsdl:port>

    </wsdl:service>

</wsdl:definitions>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值