SOAandWebservices LenaBuffoni Title/Lecturer APRIL 13, 2016 ConceptofSOA A collection of services that communicate and coordinate with each other 2 Title/Lecturer APRIL 13, 2016 3 Title/Lecturer SOAprinciples APRIL 12, 2016 4 APRIL 13, 2016 Title/Lecturer Encapsula<on • All access through API • Explicit API definitions • No hidden interactions • Explicit data passing • Context-free calls Service logic A P I 5 APRIL 13, 2016 Title/Lecturer 6 Autonomy • Replaced, managed and deployed independently Service logic A P I Service logic A P I Title/Lecturer Loosecoupling Low dependency/connection level in terms of – Time – Location – Type – Version – Cardinality – Lookup – Interface APRIL 13, 2016 7 Title/Lecturer APRIL 13, 2016 Contractdriven • Not class driven API • Description based • Loose coupling = few assumptions on implementation ex: RMI is implementation dependent – not SO Service Implemen ta1on 8 Title/Lecturer SOA-layers APRIL 13, 2016 9 Title/Lecturer APRIL 13, 2016 SOA-maturity • A metric to evaluate SOA quality – Defines different levels of maturity (ex: initial, managed, defined…) – Evaluates the different aspects/views of the SOA according to these maturity criteria 10 Title/Lecturer APRIL 13, 2016 Interoperabilityandstandards • Relies on open standards not proprietary APIs • All message formats are described using an open standard, or a human readable description • The semantics and syntax for additional information necessary for successful communication, such as headers for purposes such as security or reliability, follow a public specification or standard • At least one of the transport (or transfer) protocols used to interact with the service is a (or is accessible via a) standard network protocol 11 Title/Lecturer APRIL 13, 2016 Vendor&Technologyindependent To ensure the utmost accessibility (and therefore, longterm usability), a service must be accessible from any platform that supports the exchange of messages adhering to the service interface as long as the interaction conforms to the policy defined for the service. 12 APRIL 13, 2016 Title/Lecturer 13 Composability ComplexService Sub-service1 Sub-service3 Sub-service2 Title/Lecturer APRIL 13, 2016 14 Web-services • A realization of the SOA paradigm • Relies on XML and the Web for implementation • Attention: a web service is not necessarily SOA compliant! Service provider client Title/Lecturer XMLformat • W3C standard • Open & extensible • Structured • Readable But • Heavy • No semantics APRIL 13, 2016 15 Title/Lecturer APRIL 13, 2016 16 Example <breakfast-menu> <food> <name>Belgian Waffles</name> <price>$5.95</price> <description> two of our famous Belgian Waffles with plenty of real maple syrup </description> <calories>650</calories> </food> <food> <name>Strawberry Belgian Waffles</name> <price>$7.95</price> <description> light Belgian waffles covered with strawberry's and whipped cream </description> <calories>900</calories> </food> </breakfast-menu> We need some way to define XML structure APRIL 13, 2016 Title/Lecturer 17 XMLSchema:typedefini<on <item> <title>EmpireBurlesque</title> <note>SpecialEdition</note> <quantity>1</quantity> <price>10.90</price> </item> Item instance Item type definition <xs:elementname="item"maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:elementname="title"type="xs:string"/> <xs:elementname="note"type="xs:string"minOccurs="0"/> <xs:elementname="quantity"type="xs:positiveInteger"/> <xs:elementname="price"type="xs:decimal"/> </xs:sequence> </xs:complexType> </xs:element> Title/Lecturer APRIL 13, 2016 SimpleObjectAccessProtocol(SOAP) • XML based message exchange protocol • Used for remote procedure calls (RPC) • Platform and language independent • Uses predefined channels (HTTP, SMTP, TPC) 18 APRIL 13, 2016 Title/Lecturer 19 SOAPmessagestructure <?xmlversion="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope/" soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding"> <soap:Header> ... </soap:Header> <soap:Body> ... <soap:Fault> ... </soap:Fault> </soap:Body> </soap:Envelope> Define the message as a soap envelope Optional, application specific information Contains the actual message, can contain error information Title/Lecturer SOAPexample <?xmlversion="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope/" soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding"> <soap:Body> <m:GetPricexmlns:m="http://www.w3schools.com/prices"> <m:Item>Apples</m:Item> </m:GetPrice> </soap:Body> </soap:Envelope> APRIL 13, 2016 20 Title/Lecturer APRIL 13, 2016 SOAPPros&Cons +W3C Recommendation (standard) + Implements RPC - Untyped user data, types to encode in the message Interpretation of SOAP messages required - High overhead / low performance - Ongoing standardizations 21 Title/Lecturer APRIL 13, 2016 WDSL(WebServicesDescrip<onLanguage) • WSDL is an XML format for describing network services as a set of endpoints operating on messages containing either document-oriented or procedureoriented information. • Used to describe: – a service for its clients – a standard service for WS implementers • W3C standard 22 Title/Lecturer APRIL 13, 2016 23 WDSLInterfaceDefini<on • defines services as collections of network endpoints, or ports • the abstract definition of endpoints and messages is separated from their concrete network deployment or data format bindings • messages, which are abstract descriptions of the data being exchanged, and port types which are abstract collections of operations Title/Lecturer WSDLinterfacestructure <definitions> <types> datatypedefinitions........ </types> <message> definitionofthedatabeingcommunicated.... </message> <portType> setofoperations...... </portType> <binding> protocolanddataformatspecification.... </binding> </definitions> APRIL 13, 2016 24 Title/Lecturer WDSLexample:Glossary <messagename="getTermRequest"> <partname="term"type="xs:string"/> </message> <messagename="getTermResponse"> <partname="value"type="xs:string"/> </message> <portTypename="glossaryTerms"> <operationname="getTerm"> <inputmessage="getTermRequest"/> <outputmessage="getTermResponse"/> </operation> </portType> APRIL 13, 2016 25 Title/Lecturer APRIL 13, 2016 WSDLBindingtoSOAP • binding = associating protocol or data format information with an abstract entity like a message, operation, or portType • SOAP specific elements include: – soap:binding – soap:operation – soap:body 26 APRIL 13, 2016 Title/Lecturer Bindingexample <bindingtype="glossaryTerms"name="b1"> <soap:bindingstyle="document" transport="http://schemas.xmlsoap.org/soap/http"/> <operation> <soap:operationsoapAction="http://example.com/getTerm"/ > <input><soap:bodyuse="literal"/></input> <output><soap:bodyuse="literal"/></output> </operation> </binding> binding of one-way operation over SMTP using a SOAP Header 27 Title/Lecturer APRIL 13, 2016 28 WSDLPros&Cons WSDL abstracts from underlying – Protocol (Binding to HTTP, SOAP, MIME, IIOP…) – Component model (Mappings to CORBA, EJB, DCOM, .NET …) But: • No inheritance on WSDL • Not recursively composable Title/Lecturer APRIL 13, 2016 Categoriza<onanddiscovery • Providers need a way to propose their services • Clients need a way to find available services • UDDI (Universal Description, Discovery, and Integration) is an XML-based registry for businesses worldwide to list themselves on the Internet • Like a telephone book for services 29 Title/Lecturer APRIL 13, 2016 UDDI • a specification for a distributed registry of web services. • platform-independent, open framework. • can communicate via SOAP, CORBA, Java RMI Protocol. • Uses WSDL to describe interfaces to web services. 30 Title/Lecturer APRIL 13, 2016 31 Title/Lecturer APRIL 13, 2016 UDDIExample <tModel authorizedName="..." operator="..." tModelKey="...">! <name>HertzReserveService</name>! <description xml:lang="en">! WSDL description of the Hertz reservation service interface! </description>! ! <overviewDoc>! <description xml:lang="en">! WSDL source document.! </description>! <overviewURL>! http://mach3.ebphost.net/wsdl/hertz_reserve.wsdl! </overviewURL>! </overviewDoc>! ! <categoryBag>! <keyedReference tModelKey="uuid:C1ACF26D-9672-4404-9D70-39B756E62AB4"! keyName="uddi-org:types" keyValue="wsdlSpec"/>! </categoryBag> ! </tModel> 32 Title/Lecturer APRIL 13, 2016 33 BusinessProcessExecu<onLanguage(BPEL) BPEL is used to model the behavior of both executable and abstract processes. The scope includes: – Sequencing of process activities, especially Web Service interactions – Correlation of messages and process instances – Recovery behavior in case of failures and exceptional conditions – Bilateral Web Service based relationships between process roles Title/Lecturer APRIL 13, 2016 34 Title/Lecturer APRIL 13, 2016 35 Receiveac<vity APRIL 13, 2016 <receive name="receiveInput" partnerLink="client" portType="client:NflowHotels" operation="initiate" variable="inputVariable" createInstance="yes"/> <!-The 'count()' Xpath function is used to get the number of hotelName noded passed in. An intermediate variable called "NbParallelFlow" is used to store the number of N flows being executed --> <assign name="getHotelsN"> <copy> <from expression="count(bpws:getVariableData('inputVariable','payload','/client:Nflow HotelsProcessRequest/client:ListOfHotels/client:HotelName'));"/> <to variable="NbParallelFlow"/> </copy> </assign> <!-- Initiating the FlowN activity The N value is initialized with the value stored in the "NbParallelFlow" variable The variable call "Index" is defined as the index variable NOTE: Both "NbParallelFlow" and "Index" variables have to be declared --> class="example" 36 Title/Lecturer APRIL 13, 2016 SOAandSecurity • Confidentiality, Integrity, Authenticity: XML Encryption, XML Signature. • Message-Level Security: WS-Security. • Secure Message Delivery: WS-Addressing, WSReliableMessaging. • Metadata: WS-Policy, WS-SecurityPolicy. • Trust Management: SAML, WS-Trust, WSSecureConversation, WS- Federation. • Public Key Infrastructure: PKCS, PKIX, XKMS 37 APRIL 13, 2016 Title/Lecturer SOA&CloudCompu<ng • Cloud computing is a model for enabling ubiquitous, convenient, on-demand network access to a shared pool of configurable computing resources (The NIST Definition of Cloud Computing) SOA SOA Cloud Compu1ng Web Services 38 Title/Lecturer SummaryandContext APRIL 13, 2016 39 Title/Lecturer SummaryandContext APRIL 13, 2016 40 Ques<ons? www.liu.se