zoukankan      html  css  js  c++  java
  • wsdl理解

    wsdl内容

    1、type 用来定义访问的类型(也就是定义的schema)

    2、message:soap

    3、portType:指定服务器的接口,并且通过operation绑定相应的in和out的消息(in表示参数,out表示返回值)

    4、binding:指定传递小时所使用的格式

    5、service:指定服务所发布的名称

    下面是一个wsdl文件:

    <wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:tns="http://liyang.yinhai.com/"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:ns1="http://schemas.xmlsoap.org/soap/http"
    name="IMyserviceImplService"
    targetNamespace="http://liyang.yinhai.com/"> <wsdl:types>   <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:tns="http://liyang.yinhai.com/"
    elementFormDefault="unqualified"
    targetNamespace="http://liyang.yinhai.com/" version="1.0">     <xs:element name="add" type="tns:add"/>     <xs:element name="addResponse" type="tns:addResponse"/>     <xs:element name="minus" type="tns:minus"/>     <xs:element name="minusResponse" type="tns:minusResponse"/>     <xs:complexType name="add">       <xs:sequence>         <xs:element name="arg0" type="xs:int"/>         <xs:element name="arg1" type="xs:int"/>       </xs:sequence>     </xs:complexType>     <xs:complexType name="addResponse">       <xs:sequence>         <xs:element name="return" type="xs:int"/>       </xs:sequence>     </xs:complexType>     <xs:complexType name="minus">       <xs:sequence>         <xs:element name="arg0" type="xs:int"/>         <xs:element name="arg1" type="xs:int"/>       </xs:sequence>     </xs:complexType>     <xs:complexType name="minusResponse">       <xs:sequence>         <xs:element name="return" type="xs:int"/>       </xs:sequence>     </xs:complexType>   </xs:schema> </wsdl:types>    <wsdl:message name="add">     <wsdl:part element="tns:add" name="parameters"></wsdl:part>   </wsdl:message>   <wsdl:message name="minusResponse">     <wsdl:part element="tns:minusResponse" name="parameters"></wsdl:part> </wsdl:message>   <wsdl:message name="minus">     <wsdl:part element="tns:minus" name="parameters"></wsdl:part>   </wsdl:message>   <wsdl:message name="addResponse">     <wsdl:part element="tns:addResponse" name="parameters"></wsdl:part>   </wsdl:message>   <wsdl:portType name="IMyservice">     <wsdl:operation name="add">       <wsdl:input message="tns:add" name="add"></wsdl:input>       <wsdl:output message="tns:addResponse" name="addResponse"></wsdl:output>     </wsdl:operation>     <wsdl:operation name="minus">       <wsdl:input message="tns:minus" name="minus"></wsdl:input>       <wsdl:output message="tns:minusResponse" name="minusResponse"></wsdl:output>     </wsdl:operation>   </wsdl:portType>   <wsdl:binding name="IMyserviceImplServiceSoapBinding" type="tns:IMyservice">     <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>       <wsdl:operation name="add">         <soap:operation soapAction="" style="document"/>           <wsdl:input name="add">             <soap:body use="literal"/>           </wsdl:input>           <wsdl:output name="addResponse">             <soap:body use="literal"/>           </wsdl:output>       </wsdl:operation>       <wsdl:operation name="minus">         <soap:operation soapAction="" style="document"/>           <wsdl:input name="minus">             <soap:body use="literal"/>           </wsdl:input>           <wsdl:output name="minusResponse">              <soap:body use="literal"/>           </wsdl:output>        </wsdl:operation>   </wsdl:binding>   <wsdl:service name="IMyserviceImplService">     <wsdl:port binding="tns:IMyserviceImplServiceSoapBinding" name="IMyserviceImplPort">     <soap:address location="http://127.0.0.1:8888/ns"/>     </wsdl:port>   </wsdl:service> </wsdl:definitions>

    当你不想让soap传递参数为agr0,agr1这些可以在接口那按下面设置

        @WebResult(name="addresult")//这里的定义就是保证上面那段wsdl中,schema部分的规范,这里代替的是return
        public int add(@WebParam(name="a") int a, @WebParam(name="b") int b); //这2个代替的是2个参数,agr1和agr0

      

    1.这里只记录一些学习笔记 2.这里只记录一些学习心得,如果心得方向有错,请留言 2.这里只记录一些日记(只为提升英语,暂时有点忙,等转行了开始写)
  • 相关阅读:
    让Sendmail和Dovecot使用AD进行用户认证
    在dhcpd.conf中配置静态路由
    IPhone4与Exchange 2010同步失败
    /*从文本中读取文件*/
    EM数据包按规则更新
    Crystal Report Show in Web With ParameterField
    /*读取xml数据*/
    上传文件
    新的网站
    【练习】哥德巴赫猜想验证程序
  • 原文地址:https://www.cnblogs.com/liyang31tg/p/3531490.html
Copyright © 2011-2022 走看看