首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

wsdl的编纂必须由5小节元素构成

2012-06-27 
wsdl的编写必须由5小节元素构成以下是开发webservice采用wsdl-first开发模式的一个wsdl例子(摘自CXF examp

wsdl的编写必须由5小节元素构成
以下是开发webservice采用wsdl-first开发模式的一个wsdl例子(摘自CXF example),一个wsdl的编写必须由5小节元素构成:



<?xml version="1.0" encoding="utf-8"?><!--wsdl根元素definitions,同时使用xmlns:xxx对各命名空间进行缩写,方便引用--><definitions name="SOAPBuilders-mime-cr-test" xmlns:types="http://cxf.apache.org/mime/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://cxf.apache.org/mime" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" targetnamespace="http://cxf.apache.org/mime"><!--第一节types元素:主要是使用schema对webservice组件的方法参数和返回值进行类型定义,类似于java的编写class--><types><schema xmlns="http://www.w3.org/2001/XMLSchema" targetnamespace="http://cxf.apache.org/mime/types" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" elementformdefault="qualified"><complextype name="ByteArrayType"><sequence><element name="name" type="xsd:string"></element><element name="attachinfo" type="xsd:base64Binary"></element></sequence></complextype><element name="testByteArray" type="types:ByteArrayType"></element><element name="testByteArrayResponse" type="types:ByteArrayType"></element><complextype name="DataHandlerType"><sequence><element name="name" type="xsd:string"></element><element name="attachinfo" type="xsd:base64Binary" xmime:expectedcontenttypes="application/octet-stream"></element></sequence></complextype><element name="testDataHandler" type="types:DataHandlerType"></element><element name="testDataHandlerResponse" type="types:DataHandlerType"></element></schema></types><!--第二节message元素:主要是引用第一节的类型定义来创建webservice组件的方法参数和返回值元素,类似于java创建类的实例--><message name="testByteArrayIn"><part name="data" element="types:testByteArray"></part></message><message name="testByteArrayOut"><part name="data" element="types:testByteArrayResponse"></part></message><message name="testDataHandlerIn"><part name="data" element="types:testDataHandler"></part></message><message name="testDataHandlerOut"><part name="data" element="types:testDataHandlerResponse"></part></message><!--第三节portType元素:定义了webservice组件的方法名、参数和返回值元素--><porttype name="TestMtomPortType"><operation name="testByteArray"><input message="tns:testByteArrayIn"><output message="tns:testByteArrayOut"></output></operation><operation name="testDataHandler"><input message="tns:testDataHandlerIn"><output message="tns:testDataHandlerOut"></output></operation></porttype><!--第四节bingding元素:定义了底层的传输协议是基于http还是别的协议,同时指定绑定模式是rpc/encode还是document/literal等模式--><binding name="TestMtomBinding" type="tns:TestMtomPortType"><binding style="document" transport="http://schemas.xmlsoap.org/soap/http"></binding><operation name="testByteArray"><operation soapaction=""></operation><input><output><body use="literal"></body>
            </output></operation><operation name="testDataHandler"><operation soapaction=""></operation><input><output><body use="literal"></body>
            </output></operation></binding><!--第五节service元素,定义了发布的组件服务名和端口地址--><service name="TestMtomService"><port name="TestMtomPort" binding="tns:TestMtomBinding"><address location="http://localhost:9000/mime-test"></address>
        </port></service></definitions>

热点排行