zoukankan      html  css  js  c++  java
  • CXF学习(3) wsdl文件

    <!--一次webservice调用,其实并不是方法调用,而是发送SOAP消息 ,即xml片段-->
    <!--以上一篇中的wsdl文档为例,这里我将注释写到文档中 -->
    <!--targetNamespace 相当于java中的package -->
    <!--实际项目中应该会有wsdl:import标签,和java总的import概念是样的 -->
    <!--xmlns相当于java中的import,里面的地址,和地址打开后里面的内容的targetNamespace是对应的 -->
    <wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://hello.test.com/"
        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http"
        name="HelloWorldWS" targetNamespace="http://hello.test.com/">
        <!--types里面是标准的xml文档 -->
        <wsdl:types>
            <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns:tns="http://hello.test.com/" elementFormDefault="unqualified"
                targetNamespace="http://hello.test.com/" version="1.0">
                <xs:element name="sayHello" type="tns:sayHello" />
                <xs:element name="sayHelloResponse" type="tns:sayHelloResponse" />
                <xs:complexType name="sayHello">
                    <!-- 这里sequence里面是空的是因为没有参数,通常有参数的时候还有形如: -->
                    <!-- <xs:element minOccurs="0"> name="return" type="xs:string"/> -->
                    <!-- 这样的子元素。其中minOccurs表示最少出现0次,没有写明最多出现多少次,默认最多就是出现一次 -->
                    <xs:sequence />
                </xs:complexType>
                <xs:complexType name="sayHelloResponse">
                    <xs:sequence />
                </xs:complexType>
            </xs:schema>
        </wsdl:types>
        <!-- webservice 接口中的每一个方法对应两个message -->
        <wsdl:message name="sayHello">
            <wsdl:part element="tns:sayHello" name="parameters"></wsdl:part>
        </wsdl:message>
        <wsdl:message name="sayHelloResponse">
            <wsdl:part element="tns:sayHelloResponse" name="parameters"></wsdl:part>
        </wsdl:message>
        <!-- portType下面包含N个operation,每一个operation对应一个操作s -->
        <wsdl:portType name="HelloWorld">
            <wsdl:operation name="sayHello">
                <!-- 传入消息为sayHello -->
                <wsdl:input message="tns:sayHello" name="sayHello"></wsdl:input>
                <!-- 传出消息为  -->
                <wsdl:output message="tns:sayHelloResponse" name="sayHelloResponse"></wsdl:output>
            </wsdl:operation>
        </wsdl:portType>
        <wsdl:binding name="HelloWorldWSSoapBinding" type="tns:HelloWorld">
            <soap:binding style="document"
                transport="http://schemas.xmlsoap.org/soap/http" />
            <wsdl:operation name="sayHello">
                <soap:operation soapAction="" style="document" />
                <wsdl:input name="sayHello">
                    <soap:body use="literal" />
                </wsdl:input>
                <wsdl:output name="sayHelloResponse">
                    <soap:body use="literal" />
                </wsdl:output>
            </wsdl:operation>
        </wsdl:binding>
        <wsdl:service name="HelloWorldWS">
            <wsdl:port binding="tns:HelloWorldWSSoapBinding" name="HelloWorldImplPort">
                <soap:address location="http://localhost:1234/ws" />
            </wsdl:port>
        </wsdl:service>
    </wsdl:definitions>
  • 相关阅读:
    TomCat 的 Jenkins 报错:反向代理设置有误
    【Django】如何在类视图、普通视图单独不做CSRF校验
    【Django】HTML如何显示富文本内容
    Djaong 运行报错:ValueError: Unable to configure handler 'default'
    Windows 环境使用 Xshell 连接 VMware 虚拟机上的 CentOS 系统
    【我的青春我做主】让自己的心境安宁
    Django 使用 Nginx + uWSGI 启动
    Django_文件下载
    追梦何须要问成败,只管向前吧
    PyCharm:设置py文件头部信息
  • 原文地址:https://www.cnblogs.com/heben/p/5394626.html
Copyright © 2011-2022 走看看