1 / 27

WSDL 1.1

WSDL 1.1. WSDL 1.1. 네트웍 상의 서비스를 기술하는 XML 문서 구성 types: 데이터 타입에 대한 정의 message : 교환되는 데이터의 추상적인 (abstract) 기술 operation: 서비스가 제공하는 action 에 대한 추상적인 기술 port type : 하나 이상의 endpoint 가 지원하는 operation 의 추상적인 모음 binding: 특정 port type 에 대한 구체적 (concrete) 인 프로토콜

Télécharger la présentation

WSDL 1.1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. WSDL 1.1

  2. WSDL 1.1 • 네트웍 상의 서비스를 기술하는 XML 문서 • 구성 • types: 데이터 타입에 대한 정의 • message : 교환되는 데이터의 추상적인(abstract) 기술 • operation: 서비스가 제공하는 action에 대한 추상적인 기술 • port type : 하나 이상의 endpoint가 지원하는 operation의 추상적인 모음 • binding: 특정 port type에 대한 구체적(concrete)인 프로토콜 • port : binding과 network상의 주소를 가지는 endpoint • service : 네트웍 enpoint (port)의 collection

  3. WSDL Component <service>: Service 정의(port, binding) <port>: endpoint 정의 <binding>: service를 호출 하는 방법 정의(프로토콜, style) <portType>: interface 정의(operation, input, output) <operation>: method 정의 <message>: message 정의 <types>: datatypes 정의(XML schema)

  4. <types> <element name="TradePriceRequest"> <complexType> <all> <elementname="tickerSymbol" type="string" /> 5 <message name="GetLastTradePriceInput"> <partname="body" element="xsd1:TradePriceRequest" /> </message> 4 <portType name="StockQuotePortType"> <inputmessage="impl:GetLastTradePriceInput" /> <outputmessage="impl:GetLastTradePriceOutput" /> 3 <binding name="StockQuoteSoapBinding“ type="impl:StockQuotePortType"> 1 2 <service> <port name="StockQuotePort“ binding="impl:StockQuoteBinding"> <service> WSDL을 읽는 방법

  5. WSDL의 예 <binding name="QueryIPSoap" type="s0:QueryIPSoap">  s0:QueryIpSoap <portType> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />  extensibility element <operation name="Query"> <soap:operation soapAction="http://ws.cdyne.com/Query" style="document" /> <input> <soap:body use="literal" /> </input> <output> <soap:body use="literal" /> </output> </operation> </binding> <service name="QueryIP"> <port name="QueryIPSoap" binding="s0:QueryIPSoap">  s0:QueryIPSoap <binding> <soap:address location="http://ws.cdyne.com/whoisforip/queryip.asmx" />  extensibility element </port> </service> </defintion>

  6. WSDL의 예 <?xml version="1.0" encoding="utf-8"?> <definitions xmlns:soap=“http://schemas.xmlsoap.org/wsdl/soap/” xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://ws.cdyne.com/" xmlns:soapenc=“http://schemas.xmlsoap.org/soap/encoding/” targetNamespace="http://ws.cdyne.com/" xmlns=“http://schemas.xmlsoap.org/wsdl/”/> <types> … </types> <message name="QuerySoapIn"> <part name="parameters" element="s0:Query" />  s0:Query는 <types>에 정의되어 있음 </message> <message name="QuerySoapOut"> <part name="parameters" element="s0:QueryResponse" /> </message> <portType name="QueryIPSoap"> <operation name="Query"> <input message="s0:QuerySoapIn" />  QuerySoapIn <message> <output message="s0:QuerySoapOut" />  QuerySoapOut <message> </operation> </portType>

  7. WSDL의 예 • 데이터 타입을 정의하는데 사용하는 type system 에는 제한이 없으나 현재로서는 XML Schema를 일반적으로 사용함 <types> <s:schema elementFormDefault="qualified" targetNamespace="http://ws.cdyne.com/">  extensibility elelemt <s:element name="Query"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="Address" type="s0:Address" /> <s:element minOccurs="0" maxOccurs="1" name="LicenseKey" type="s:string" /> </s:sequence> </s:complexType> </s:element> <s:complexType name="Address"> <s:sequence> <s:element minOccurs="1" maxOccurs="1" name="IPaddress" type="s:string"/> <s:element minOccurs="0" maxOccurs="1" name="HostName" type="s:string"/> </s:sequence> </s:complexType> <s:element name="QueryResponse"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="QueryResult" type="s:string" /> </s:sequence> </s:complexType> </s:element> </s:schema> </types>

  8. WSDL 도식화 created by XMLSpy

  9. <types> <element name="TradePriceRequest"> <complexType> <all> <elementname="tickerSymbol" type="string" /> 5 <message name="GetLastTradePriceInput"> <partname="body" element="xsd1:TradePriceRequest" /> </message> 4 <portType name="StockQuotePortType"> <inputmessage="impl:GetLastTradePriceInput" /> <outputmessage="impl:GetLastTradePriceOutput" /> 3 <binding name="StockQuoteSoapBinding“ type="impl:StockQuotePortType"> 1 2 <service> <port name="StockQuotePort“ binding="impl:StockQuoteBinding"> <service> WSDL을 읽는 방법

  10. WSDL SOAP Binding • SOAP 메시지 구성 방법을 기술 • <wsdl:binding> 및 <wsdl:port> 아래에 element 아래에 extensibility element로 기술 • soap:binding • soap:operation • soap:body • soap:header • soap:headerfault • soap:fault • soap:address

  11. soap:binding • soap:binding <binding …> <soap:binding transport=“uri” style=“rpc|document”/> </binding> • style : • document • SOAP Body 구성시 <message>의 part들을 그대로 SOAP Body에 사용 • rpc • SOAP의 RPC convention에 따라서 SOAP Body 구성 • transport: SOAP메시지 전송에 사용될 transport • HTTP : http://schemas.soap.org/soap/http

  12. soap:operation • soap:operation <binding> <operation…> <soap:operation soapAction=“uri” style=“rpc|document”/> </operation> </binding> • soapAction : SOAPAction의 값을 지정 • style: rpc/document. <soap:binding>에서 지정한 style을 override 할 수 있으나 일반적으로 이런 방식으로는 사용하지 않음

  13. soap:body • soap:body <binding…> <operation…> <input> <soap:body parts=“nmtokens”? use=“literal|encoded”? encodingStyle=“uri-list”? namespace=“uri”?/> </input> </operation> </binding> • parts: SOAP Body에 사용될 part들. 생략하면 해당 메시지의 모든 파트가 사용됨 • use : • literal : <types>에 지정된 XML Schema의 instance를 SOAP 메시지 구성에 사용함 • encoded : <types>에 지정된 XML Schema에 encodingStyle에 지정된 encoding rule을 적용하여 SOAP 메시지에 담을 concrete한 메시지를 구성 • encodingStyle: • encoding에 사용될 encoding 방식을 기술 • namespace: • encoding시 types에 명시적으로 정의되지 않은 content에 적용되는 namespace

  14. Document/RPC, Literal/SOAP Encoding ? • 네 가지 조합 • RPC/Encoded • RPC/Literal • DOC/Encoded • DOC/Literal • XML 문서의 validation • Encoded 방식 • WSDL의 <Types> 에 정의된 XML Schema를 따르지 않는 XML 문서가 발생될 수 있음 • encoded 방식의 XML 문서를 받아서 검증(validate) 할 수 없음 • Literal 방식 • WSDL의 <Types>에 정의된 XML Schema로 검증가능한 XML 문서를 주고 받음 • 현재까지, 그리고 향후에는… • 현재까지 RPC/Encoded 방식과 DOC/Literal 방식이 가장 많이 사용됨 • WS-I Basic Profile 에서는 interoperable한 SOAP 메시징에서는 SOAP Encoding 방식을 사용하는 것을 금지하고 있음 • 향후 웹서비스에서는 RPC/Literal과 , DOC/Literal 방식만이 interaoperable 할것 임 • 그러나 과거 호환성을 위해서 RPC/encoded 방식도 지원될 것. • SOAP 규격은 Document 중심으로 가고 있음

  15. WSDL binding (I) RPC/Literal Document • <message name=“Request”> • <part name=“x” type=“xs:int”/> • </message> • <message name=“empty”/> • <portType name=“foo”> • <operation name=“method”> • <input message=“Request”/> • <output message=“empty”/> • </operation> • </portType> • <types> • <schema> • <element name=“xElement” type=“xs:int”/> • </schema> • </types> • <message name=“Request”> • <part name=“x” element=“xElement”/> • </message> • <message name=“empty”/> • <portType name=“foo”> • <operation name=“method”> • <input message=“Request”/> • <output message=“empty”/> • </operation> • </portType> RPC/Encoding • <message name=“Request”> • <part name=“x” type=“xs:int”/> • </message> • <message name=“empty”/> • <portType name=“foo”> • <operation name=“method”> • <input message=“Request”/> • <output message=“empty”/> • </operation> • </portType>

  16. WSDL binding (II) RPC/ Literal Document • <soap:envelope> • <soap:body> • <method> • <x>5</x> • </method> • </soap:body> • </soap:envelope> • <soap:envelope> • <soap:body> • <xElement>5</xElement> • </soap:body> • </soap:envelope> RPC/Encoding • <soap:envelope> • <soap:body> • <method> • <x xsi:type=“xs:int”>5</x> • </method> • </soap:body> • </soap:envelope>

  17. WSDL binding (III) Document/literal wrapped • <types> • <schema> • <element name=“method”> • <complexType> • <sequence> • <element name=“x” type=“xs:int”/> • </sequence> • </complexType> • </element> • </schema> • </types> • <message name=“Request”> • <part name=“parameters” element=“method”/> • </message> • <message name=“empty”/> • <portType name=“foo”> • <operation name=“method”> • <input message=“Request”/> • <output message=“empty”/> • </operation> • </portType • <soap:envelope> • <soap:body> • <method> • <x>5</x> • </method>> • </soap:body> • </soap:envelope>

  18. Top-down Web service development

  19. <그림: top-down design> 웹서비스개발 모델 • 웹서비스 top-down 모델 • 웹 브라우저로 서비스의 URL에 접근 가능한 서비스 interface를 만든다. Ex) http://localhost:8080/axis/services/WidgetPrice • WSDL파일을 만들다. • 주고 받을 Type에 대한 정의를 한다. -> simple type 정의 • complex type 정의하고 simple type을 포함한다. • 웹서비스 툴을 이용 server skeleton JavaBeans components를 생성한다. • skeleton JavaBeans에 비즈니스 로직을 작성한다. • 웹서비스 툴을 이용 client stubJavaBeans components를 생성한다. • stubJavaBeans components에 비즈니스 로직을 작성한다. • Test

  20. Basic Data Type

  21. Custom Data Type [Order WSDL Type] <wsdl:types> <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Example6"> <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/> <complexType name="ArrayOf_xsd_string"> <complexContent> <restriction base="soapenc:Array"> <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/> </restriction> </complexContent> </complexType> <complexType name="ArrayOf_xsd_int"> <complexContent> <restriction base="soapenc:Array"> <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:int[]"/> </restriction> </complexContent> </complexType> <complexType name="Order"> <sequence> <element name="customerName" nillable="true" type="xsd:string"/> <element name="itemCodes" nillable="true" type="impl:ArrayOf_xsd_string"/> <element name="quantities" nillable="true" type="impl:ArrayOf_xsd_int"/> <element name="shippingAddress" nillable="true" type="xsd:string"/> </sequence> </complexType> </schema> </wsdl:types> [Order Java class] public class Order { private String customerName; private String itemCodes[]; private int quantities[]; private String shippingAddress; }

  22. Axis의 WSDL 지원 • WSDL 문서 제공 • 웹서비스 툴인 Axis에서 서비스를 전개할 때, 웹서비스 사용자들는 웹 브라우저로 서비스의 URL에 접근 가능 • URL의 끝에 "http://localhost:8080/axis/services/WidgetPrice?WSDL”를 덧붙이는 것에 의해 WSDL제공 • WSDL을 이용해 proxies(stub) 와 skeletons 제공 • AXIS WSDL -> Java tool : org.apache.axis.wsdl.WSDL2Java • WSDL -> Java class 매칭 • type -> java class(Adress, Book, Order), in/out parameter • portType -> interface class • binding -> stub, skeletons class • service -> client service interface, client service implementation • Client / Server 공통 • WidgetPrice.java (java.rmi.Remote usages), deploy.wsdd, undeploy.wsdd • Client proxies • WidgetPriceService.java (client side service interface) • WidgetPriceServiceLocator.java (client side service implementation) • WidgetPriceSoapBindingStub.java (Client side stub) • Server skeletons • WidgetPriceSoapBindingSkeleton.java (Server side skeleton) • WidgetPriceSoapBindingImpl.java (fill out the implementation)

  23. Axis의 WSDL 지원 • Java2WSDL 도구 제공 • java2wsdl은 자바 클래스들에서 WSDL을 추출 제공 • ex) 아래와 같은 service Interface 작성후 java2wsdl실행 후 WSDL얻음 public interface WidgetPrice { public void setWidgetPrice(String widgetName, String price); public String getWidgetPrice(String widgetName); public String processOrder(Order order); }

  24. WSDL2.0

  25. definitions 네임스페이스 변경 • WSDL2.0에서의 변화 • W3C의 Web Services Description Working Group은 WSDL 2.0 working drafts on 26 March 2004 • definitions 네임스페이스 변경 <definitions name="StockQuote" targetNamespace="http://example.com/stockquote/definitions" xmlns:tns="http://example.com/stockquote/definitions" xmlns:xsd1="http://example.com/stockquote/schemas" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/"> --> <definitions name="StockQuote" targetNamespace="http://example.com/stockquote/definitions" xmlns:tns="http://example.com/stockquote/definitions" xmlns:xsd1="http://example.com/stockquote/schemas" xmlns:soap="http://www.w3.org/2003/11/wsdl/soap12" xmlns="http://www.w3.org/2003/11/wsdl">

  26. message element(construct)의 삭제 <message name="GetLastTradePriceInput"> <part name="body" element="xsd1:TradePriceRequest"/> </message> <message name="GetLastTradePriceOutput"> <part name="body" element="xsd1:TradePrice"/> </message> --> <types> <schema targetNamespace="http://example.com/stockquote/definitions"> <element name="GetLastTradePriceInput" type="xsd1:TradePriceRequest"/> <element name="GetLastTradePriceOutput" type="xsd1:TradePrice"/> </schema> </types>

  27. PortTypes 과 Ports변경 <portType name="StockQuotePortType"> -> <interface name="StockQuoteInterface"> <port name="StockQuotePort" binding="tns:StockQuoteBinding"> <soap:address location="http://example.com/stockquote"/> </port> -> <endpoint name="StockQuoteEndPoint" binding="tns:StockQuoteSoapBinding"> <wsoap:address location="http://example.com/stockquote"/> </endpoint>

More Related