+ All Categories
Home > Documents > Web Services Introduction

Web Services Introduction

Date post: 16-Mar-2016
Category:
Upload: valora
View: 49 times
Download: 0 times
Share this document with a friend
Description:
Web Services Introduction. Jan Odstrčil. Přehled. Web services - technologie WSDL, SOAP, UDDI Advanced Web services Web services – aplikace a použití Platformy pro Web services WS-I – úvodní představení WS-I Basic Profile 1.1 Otázky a odpovědi. Web services - technologie. - PowerPoint PPT Presentation
38
Web Services Introduction Jan Odstrčil
Transcript
Page 1: Web Services Introduction

Web Services Introduction

Jan Odstrčil

Page 2: Web Services Introduction

Přehled

• Web services - technologie• WSDL, SOAP, UDDI• Advanced Web services• Web services – aplikace a použití• Platformy pro Web services• WS-I – úvodní představení• WS-I Basic Profile 1.1• Otázky a odpovědi

Page 3: Web Services Introduction
Page 4: Web Services Introduction

Web services - technologie• Nezávislá na platformě, jazyce, hardware• Samopopisující, loosely coupled• Založená na standardech Internetu a XML

• WSDL – jazyk pro popis Web services založený na XML– XSD – datové typy popsány v XML Schema

• SOAP – protokol pro výměnu zpráv založených na XML– HTTP typicky využíváno jako transportní vrstva

• UDDI – platformově nezávislá service registry– založené na XML

Page 5: Web Services Introduction

Web services - technologie

Page 6: Web Services Introduction

WSDL

• Web Services Description Language

• otevřený standard podporovaný W3C• popis služby a její komunikace v XML• využívá XML Schema pro popis typů

Page 7: Web Services Introduction

WSDL

• Definitions– hlavní tag uzavírající dokument

• Types– sekce pro definici datových typů– obsahuje komplexní typy jako XML Schema

• Message– definice zprávý – jak příchozí tak odchozí – Definuje parametry a návratové hodnoty

Page 8: Web Services Introduction

WSDL

• Operation– Definuje operaci (metodu) služby– Obsahuje obvykle input a output message

• PortType– definuje rozhraní Web service deklarativně– obsahuje operace– Nehovoří o určité instanci, nelze se připojit

Page 9: Web Services Introduction

WSDL

• Binding– definuje způsob jak se budou posílat zprávy– Konkrétní protokol a datový formát

(document/literal, rcp/encoded)• Port

– endpoint – adresa a binding• Service

– skupina souvisejících endpointu

Page 10: Web Services Introduction

WSDL• <?xml version="1.0"?>• <definitions name="StockQuote"

• targetNamespace="http://example.com/stockquote.wsdl"• xmlns:tns="http://example.com/stockquote.wsdl"• xmlns:xsd1="http://example.com/stockquote.xsd"• xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"• xmlns="http://schemas.xmlsoap.org/wsdl/">

• <types>• <schema targetNamespace="http://example.com/stockquote.xsd"• xmlns="http://www.w3.org/2000/10/XMLSchema">• <element name="TradePriceRequest">• <complexType>• <all>• <element name="tickerSymbol" type="string"/>• </all>• </complexType>• </element>• <element name="TradePrice">• <complexType>

Page 11: Web Services Introduction

WSDL• <message name="GetLastTradePriceInput">• <part name="body" element="xsd1:TradePriceRequest"/>• </message>

• <message name="GetLastTradePriceOutput">• <part name="body" element="xsd1:TradePrice"/>• </message>

• <portType name="StockQuotePortType">• <operation name="GetLastTradePrice">• <input message="tns:GetLastTradePriceInput"/>• <output message="tns:GetLastTradePriceOutput"/>• </operation>• </portType>

Page 12: Web Services Introduction

WSDL <binding name="StockQuoteSoapBinding" type="tns:StockQuotePortType">• <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>• <operation name="GetLastTradePrice">• <soap:operation soapAction="http://example.com/GetLastTradePrice"/>• <input>• <soap:body use="literal"/>• </input>• <output>• <soap:body use="literal"/>• </output>• </operation>• </binding>

• <service name="StockQuoteService">• <documentation>My first service</documentation>• <port name="StockQuotePort" binding="tns:StockQuoteBinding">• <soap:address location="http://example.com/stockquote"/>• </port>• </service>

• </definitions>

Page 13: Web Services Introduction

WSDL• Documentation – wsdl je samo-dokumentované• Import - dokumenty je možné importovat

– vhodné pro oddělení statické definice datových typů a portu od instance

– Instance obsahuje binding, service a import

<wsdl:definitions name="nmtoken"? targetNamespace="uri"?>

<import namespace=„http://myS.org" location=„ http://myS.org/wsdl/StockType.wsdl"/> <wsdl:documentation>…text… </wsdl:documentation>

Page 14: Web Services Introduction

SOAP

• Simple Object Access Protocol

• Protokol pro výměnu zpráv založených na XML

• HTTP typicky využíváno jako transportní vrstva

• SMTP také vhodný pro transport SOAP

Page 15: Web Services Introduction

SOAP

• Různé druhy kódování zpráv– RPC / Encoded– Document / Literal– Wrapped / Literal

• Definováno v binding sekci WSDL

Page 16: Web Services Introduction

SOAP rpc/encoded• public void myMethod(int x, float y);

• <message name="myMethodRequest">• <part name="x" type="xsd:int"/>• <part name="y" type="xsd:float"/>• </message>• <message name="empty"/>

• <portType name="PT">• <operation name="myMethod">• <input message="myMethodRequest"/>• <output message="empty"/>• </operation>• </portType>

Page 17: Web Services Introduction

SOAP rpc/encoded• <soap:envelope>• <soap:body>• <myMethod>• <x xsi:type="xsd:int">5</x>• <y xsi:type="xsd:float">5.0</y>• </myMethod>• </soap:body>• </soap:envelope>

• Jednoduchý zápis ve wsdl• Jméno operace je v message – rychlé předání implementaci• Type encoding info (xsi:type="xsd:int") zabírá moc místa• Není ve shodě s WS-I

Page 18: Web Services Introduction

SOAP wrapped/literal• <soap:envelope>• <soap:body>• <myMethod>• <x>5</x>• <y>5.0</y>• </myMethod>• </soap:body>• </soap:envelope>

• Složitý zápis ve wsdl• Jméno operace je v message – rychlé předání implementaci• Type encoding info (xsi:type="xsd:int") zabírá moc místa• Je ve shodě s WS-I

Page 19: Web Services Introduction

UDDI

• Universal Description, Discovery and Integration– otevřený standard podporovaný OASIS– umožňuje publikaci, vyhledávání, kategorizaci– v počátcích globální UDDI registry (MS, IBM, SAP)

• 3 základní komponenty– White Pages — adresy, kontakty– Yellow Pages — kategorizace podle standardních

taxonomii; – Green Pages — technické informace o services

zveřejněných společnostmi

Page 20: Web Services Introduction

UDDI• businessEntity

– informace o straně publikující service• businessService

– popisné informace o určité skupině technických services

• bindingTemplate– technické informace endpointu služby a

implementační specifikaci• tModel

– popis specifikaci pro služby, základ pro technícký popis

Page 21: Web Services Introduction

UDDI

Page 22: Web Services Introduction

UDDI• <tModel authorizedName="..." operator="..." tModelKey="...">•    <name>StockQuote Service</name>•    <description xml:lang="en">•       WSDL description of a standard stock quote service interface •    </description>•    <overviewDoc>•       <description xml:lang="en">WSDL source document.•      </description>•      <overviewURL>•          http://stockquote-definitions/stq.wsdl•      </overviewURL>•    </overviewDoc>•    <categoryBag>• <keyedReference tModelKey="uuid:C1ACF26D-9672-4404-9D70-39B756E62AB4" •                 keyName="uddi-org:types" •                 keyValue="wsdlSpec"/> •    </categoryBag>• </tModel>

Page 23: Web Services Introduction

Advenced Web services

• WS - Reliable Messaging – jednoduché posílání, spolehlivé

• WS - Attachment– posílání velkých dokumentů / binárních

• WS – Security– rozšíření SOAP message o security– chrání pomocí integrity zprávy– message authentication

Page 24: Web Services Introduction

Web services – aplikace a použití

• Více než informace o počasí• Aplikace dostupné jako služba „masám“

– Google Search API, eBay– SalesForce (CRM, lze rozšířit, integrovat)– Mobile Portal Content

• Integrační scénáře– banka koupí banku– jedna divize s druhou

• Intereoperabilita vítězí nad „efektivitou“

Page 25: Web Services Introduction

Web services – aplikace a použití

Page 26: Web Services Introduction

Platformy pro Web services

Page 27: Web Services Introduction

Platformy pro Web services

• Microsoft .Net• Apache Axis• Sun J2EE, JAX-WS JAX-B• Systinet Server for Java / C++• webMethods Glue• IONA Artix• IBM

Page 28: Web Services Introduction

WS-I – úvodní představení

• Web Services Interoperability Organization• Otevřená organizace zaměřená na

podporu interopertabilty Web services– různé platformy, jazyky, operační systémy

• Přibližně 130 členů: BEA, IBM, Accenture, CA, DaimlerChrysler, DISA, HP, Microsoft, Nokia, OMG, SAP, Sun, webMethods

Page 29: Web Services Introduction

WS-I – doporuční, profiles, tools

• Samotná specifikace obvykle nestačí– nepřesná, konflikt s jinou specifikací / verzí

• Poskytuje doporučení, návody a nástroje– profile – sada specifikací určité verze, říká jak

je používat dohromady– demo aplikace – demonstruje interoperabilitu

profilu– testovací nástroje – testují shodu

implementace s profilem

Page 30: Web Services Introduction

WS-I – rozšířené služby

• Pro členy poskytuje další služby• Organizuje interoperability setkání

– několikadenní setkání na určité téma– snaha o živé ověření interoperability a

případné testování• Publikuje výsledky o interop setkáních• Organizuje poskytování testovacích Web

service pro pravidelné testy

Page 31: Web Services Introduction

WS-I – existující profily

• XML Schema Work Plan• Basic Profile 1.1• Attachment Profile 1.0• Basic Security Profile 1.1

Page 32: Web Services Introduction

WS-I Basic Profile 1.1

• Sada Web services specifikací rozšířená o– vyjasnění, upřesnění, rozvedení, interpretace

• Zaměřuje se na:– Zprávy (SOAP)– Popis služeb (WSDL, XSD)– Publikace a vyhledávání služeb (UDDI)– Zabezpečení (HTTPS)

Page 33: Web Services Introduction

WS-I Basic Profile 1.1

• Conformance requrements– požadavané kritérium které je třeba splnit– MUST, SHOULD, MAY

• Conformance Targets – Indikuje na co je Conformance requrements

aplikován – SOAP message– WSDL document– UDDI tModel

Page 34: Web Services Introduction

WS-I Basic Profile 1.1

• Conformance requrements– požadavané kritérium které je třeba splnit– MUST, SHOULD, MAY

• Conformance Targets – Indikuje na co je Conformance requrements

aplikován – SOAP message– WSDL document– UDDI tModel

Page 35: Web Services Introduction

BP 1.1 Test Assertions

• Dokument obsahuje sadu testovacích assertion

• Assertion je ve stavu OK nebo FAILED

• Testovací tool implementuje požadované assertions a generuje reporty o stavu

Page 36: Web Services Introduction

WSDL Assertions - ukázka• BP2700

– The wsdl:definitions is a well-formed XML 1.0 document • BP2202

– The XML declaration statement uses UTF-8 or UTF-16 for the encoding.

• BP2098 – The "location" attribute is specified for the wsdl:import element,

and has a non-empty value.• BP2104

– The targetNamespace attribute on the wsdl:definitions element for the imported WSDL description has the same value as the namespace attribute on the wsdl:import element that imported the WSDL description.

Page 37: Web Services Introduction

UDDI a SOAP Assertions

• BP3002 – The uddi:bindingTemplate element contains a

uddi:accessPoint element, with a non-empty value.

• BP1004 – The request message is a POST message,

without any use of framework extension.

Page 38: Web Services Introduction

Otázky a odpovědi


Recommended