Service Oriented Architectureand Web servicesMohammed LuqmanShareef
Popular Distributed Application Frameworks/Technologies2010-02-082COM, DCOM Microsoft specificEJB, RMI	Java SpecificCORBA  	Platform and Language Independent
What is SOA?2010-02-083SOA is an architectural style of building software applications that promotes loose coupling between components for their reuse.A software system is divided into highly flexible and re-usable components called services. SOA is just an architecture blue print It is NOT a technical standardIt is NOT a technology
What is Service ?2010-02-084Self-contained module that perform a predetermined taskSoftware component that have published contracts/interfacesBlack-box to the consumersPlatform-IndependentInteroperable
Why SOA?2010-02-085End Customer PortalOperator PortalPartner PortalCustomer InfoManagementOrder ManagementCredit ManagementSalesManagementBillingLets take a telecom enterprise systemInvoicingProvisioningNetwork ManagementInventoryServiceCatalogCustomer Profiles
Why SOA?2010-02-086End Customer PortalOperator PortalPartner PortalServicesCredit ManagementSalesManagementCustomer InfoManagementOrder ManagementProvisioningInvoicingInventoryNetwork ManagementCustomer ProfilesBillingServiceCatalog
SOA: Architectural Principles2010-02-087Loose couplingMinimize dependencies.Service contractServices adhere to a communications agreement.Service abstraction Hide the service execution logic from the outside world.Service reusabilityLogic is divided into services for reuse.
SOA: Architectural Principles2010-02-088Service composabilityServices can be assembled to form composite service.Service autonomyServices have control over the logic they encapsulate.Service discoverabilityServices can be found and assessed via available discovery mechanisms.Service relevance		Service presented at a granularity recognized by user a meaningful service.
SOA Implementation2010-02-089	While SOA can be implemented using any service based technology such as CORBA, the SOAP based web services standard implementation has gained wide industry acceptance, because these standards provide greater interoperability.	Key differences between CORBA and web service are
Realizing SOA with Web Services2010-02-0810W WW
What is web service ?2010-02-0811Web service is a standard way of integrating Web-based applications using the XML, SOAP, WSDL and UDDI open standards over an Internet protocol backbone. 	XML is used to tag the data, 	SOAP is used to transfer the data, 	WSDL is used for describing the services available and 	UDDI is used for listing what services are available. 	Web services are loosely coupled computing services that can reduce the complexity of building business applications, save costs, and enable new business models. Services running on an arbitrary machine can be accessed in a platform- and language-independent fashion.
How to buy tomatoes ?2010-02-0812Lookup for the tomato sellersYellow Pages: contain companies that are selling tomatoes, their location, and contact information. Find the service offered according to my needsWhere, when and how can I buy tomatoes? Buy the tomatoes	do the transactionHow to access a service?2010-02-0813Lookup for the Service ProviderRegistry: contain providers that are selling services, their location, and contact information. Find the service offered according to my needsWhere, when and how can I get the service? Access the servicedo the transaction
Components of a web service2010-02-0814XML (eXtensible Markup Language)A uniform data representation and exchange mechanismSOAP (Simple Object Access Protocol)Lightweight (XML-based) protocol for exchange 	of information in a decentralized, distributed environmentWSDL (Web Service Description Language)XML format that describes the web serviceUDDI (Universal Description Discovery and Integration)Like yellow pages of Web services
3 roles of service2010-02-0815
Service Vs. Consumer2010-02-0816PolicyAdheres togoverned byEnd PointBinds toExposesServesService ConsumerServiceContractsimplementsUnderstandsdescribesMessagesSends/ReceivesSends/Receives
Steps to develop a web serviceusing JAX-WS2010-02-0817Define the service implementation and compile it.	\WS>javac -d . HelloImpl.javaUse wsgen to generate the artifacts required to deploy the service.	\WS>wsgen -wsdlserver.HelloImpl3.   Package the files into a WAR file and deploy it .package server;import javax.jws.WebService;@WebServicepublic class HelloImpl {  /**   * @param name   * @return Say hello to the person.   */   public String sayHello(String name) {     return "Hello, " + name + "!";   }}
HelloImplService.wsdl2010-02-0818
HelloImplService.wsdl contd…2010-02-0819
HelloImplService_schema1.xsd2010-02-0820
Steps to develop a web service contd…2010-02-0821package myClient;import helloservice.endpoint.HelloService;import helloservice.endpoint.Hello;public class HelloClient {    public static void main(String[] args) {        try {HelloService service = new HelloService();            Hello port = service.getHelloPort();            String response = port.sayHello(“Luqman");System.out.println(response);        } catch (Exception e) {e.printStackTrace();        }    }}Implement Client Code5.  Use wsimport to generate and compile the web service artifacts needed to connect to the service.	\WS>wsimport HelloImplService.wsdl	parsing WSDL...	generating code...	compiling code...6.  Run the client.
WSDL2010-02-0822WSDL elementsWSDL is a contract between service provider and the consumerA WSDL document describesWhat the service can doWhere it residesHow to invoke itTypesMessageOperationPort TypeWSDLBindingPortService
WSDL elements2010-02-0823Types	Data type definition used in exchanging messagesMessage	Describes the logical content of data being communicatedOperation	An Abstract description of an action supported by the servicePort Type	A set of operations and messages involved with the serviceBinding	A concrete protocol and data format specification for a port typePort	A single end point defined as a combination of a binding and a network addressService	Identifies which ports to group together
SOAP2010-02-0824SOAP EnvelopeSOAP HeaderHeader BlockSOAP BodyMessage BodyFault HandlersSOAP message structureSOAP is a lightweight (XML-based) protocol for exchange of information in a decentralized, distributed environment. SOAP is a format for sending messagesSOAP is independent of transport protocolA SOAP message is an ordinary XML document containing the following elements:Envelope  - identifies the XML document as a SOAP messageHeader  - contains application specific info like authentication etc.Body  - contains the message in request and responseFault  - contains errors and status information
SOAP Example<?xml version="1.0"?><soap:Envelopexmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"><soap:Bodyxmlns:m="http://www.example.org/Hello">  <m:sayHello>    <m:name>Luqman</m:name>  </m:sayHello></soap:Body></soap:Envelope> 2010-02-0825RequestResponse<?xml version="1.0"?><soap:Envelopexmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"><soap:Bodyxmlns:m="http://www.example.org/stock">  <m:sayHelloResponse>    <m:return>Hello Luqman</m:return>  </m:sayHelloResponse></soap:Body></soap:Envelope>
SOAP Fault2010-02-0826SOAP errors are handled using a specialised envelope known as a Fault EnvelopeA SOAP Fault is a special element which must appear as an immediate child of the body element<faultcode> and <faultstring> are required.
UDDI2010-02-08273 levels of information in UDDIUDDI is a set of specifications that is used to publish information for describing and discovering web services, finding businesses, building registries. UDDI is a directory for storing information about web services.UDDI communicates via SOAP.White PagesTo query companies with their names and attributesYellow PagesTo query businesses with their categoriesGreen PagesContains technical info on how to interact with the services
UDDI Structure2010-02-0828
Registry APIs (SOAP Messages)2010-02-0829Publishers API
Save things
save_business
save_service
save_binding
save_tModel
Delete things
delete_business
delete_service
delete_binding
delete_tModel
security…
get_authToken

Service Oriented Architecture

  • 1.
    Service Oriented ArchitectureandWeb servicesMohammed LuqmanShareef
  • 2.
    Popular Distributed ApplicationFrameworks/Technologies2010-02-082COM, DCOM Microsoft specificEJB, RMI Java SpecificCORBA Platform and Language Independent
  • 3.
    What is SOA?2010-02-083SOAis an architectural style of building software applications that promotes loose coupling between components for their reuse.A software system is divided into highly flexible and re-usable components called services. SOA is just an architecture blue print It is NOT a technical standardIt is NOT a technology
  • 4.
    What is Service?2010-02-084Self-contained module that perform a predetermined taskSoftware component that have published contracts/interfacesBlack-box to the consumersPlatform-IndependentInteroperable
  • 5.
    Why SOA?2010-02-085End CustomerPortalOperator PortalPartner PortalCustomer InfoManagementOrder ManagementCredit ManagementSalesManagementBillingLets take a telecom enterprise systemInvoicingProvisioningNetwork ManagementInventoryServiceCatalogCustomer Profiles
  • 6.
    Why SOA?2010-02-086End CustomerPortalOperator PortalPartner PortalServicesCredit ManagementSalesManagementCustomer InfoManagementOrder ManagementProvisioningInvoicingInventoryNetwork ManagementCustomer ProfilesBillingServiceCatalog
  • 7.
    SOA: Architectural Principles2010-02-087LoosecouplingMinimize dependencies.Service contractServices adhere to a communications agreement.Service abstraction Hide the service execution logic from the outside world.Service reusabilityLogic is divided into services for reuse.
  • 8.
    SOA: Architectural Principles2010-02-088ServicecomposabilityServices can be assembled to form composite service.Service autonomyServices have control over the logic they encapsulate.Service discoverabilityServices can be found and assessed via available discovery mechanisms.Service relevance Service presented at a granularity recognized by user a meaningful service.
  • 9.
    SOA Implementation2010-02-089 While SOAcan be implemented using any service based technology such as CORBA, the SOAP based web services standard implementation has gained wide industry acceptance, because these standards provide greater interoperability. Key differences between CORBA and web service are
  • 10.
    Realizing SOA withWeb Services2010-02-0810W WW
  • 11.
    What is webservice ?2010-02-0811Web service is a standard way of integrating Web-based applications using the XML, SOAP, WSDL and UDDI open standards over an Internet protocol backbone. XML is used to tag the data, SOAP is used to transfer the data, WSDL is used for describing the services available and UDDI is used for listing what services are available. Web services are loosely coupled computing services that can reduce the complexity of building business applications, save costs, and enable new business models. Services running on an arbitrary machine can be accessed in a platform- and language-independent fashion.
  • 12.
    How to buytomatoes ?2010-02-0812Lookup for the tomato sellersYellow Pages: contain companies that are selling tomatoes, their location, and contact information. Find the service offered according to my needsWhere, when and how can I buy tomatoes? Buy the tomatoes do the transactionHow to access a service?2010-02-0813Lookup for the Service ProviderRegistry: contain providers that are selling services, their location, and contact information. Find the service offered according to my needsWhere, when and how can I get the service? Access the servicedo the transaction
  • 13.
    Components of aweb service2010-02-0814XML (eXtensible Markup Language)A uniform data representation and exchange mechanismSOAP (Simple Object Access Protocol)Lightweight (XML-based) protocol for exchange of information in a decentralized, distributed environmentWSDL (Web Service Description Language)XML format that describes the web serviceUDDI (Universal Description Discovery and Integration)Like yellow pages of Web services
  • 14.
    3 roles ofservice2010-02-0815
  • 15.
    Service Vs. Consumer2010-02-0816PolicyAdherestogoverned byEnd PointBinds toExposesServesService ConsumerServiceContractsimplementsUnderstandsdescribesMessagesSends/ReceivesSends/Receives
  • 16.
    Steps to developa web serviceusing JAX-WS2010-02-0817Define the service implementation and compile it. \WS>javac -d . HelloImpl.javaUse wsgen to generate the artifacts required to deploy the service. \WS>wsgen -wsdlserver.HelloImpl3. Package the files into a WAR file and deploy it .package server;import javax.jws.WebService;@WebServicepublic class HelloImpl { /** * @param name * @return Say hello to the person. */ public String sayHello(String name) { return "Hello, " + name + "!"; }}
  • 17.
  • 18.
  • 19.
  • 20.
    Steps to developa web service contd…2010-02-0821package myClient;import helloservice.endpoint.HelloService;import helloservice.endpoint.Hello;public class HelloClient { public static void main(String[] args) { try {HelloService service = new HelloService(); Hello port = service.getHelloPort(); String response = port.sayHello(“Luqman");System.out.println(response); } catch (Exception e) {e.printStackTrace(); } }}Implement Client Code5. Use wsimport to generate and compile the web service artifacts needed to connect to the service. \WS>wsimport HelloImplService.wsdl parsing WSDL... generating code... compiling code...6. Run the client.
  • 21.
    WSDL2010-02-0822WSDL elementsWSDL isa contract between service provider and the consumerA WSDL document describesWhat the service can doWhere it residesHow to invoke itTypesMessageOperationPort TypeWSDLBindingPortService
  • 22.
    WSDL elements2010-02-0823Types Data typedefinition used in exchanging messagesMessage Describes the logical content of data being communicatedOperation An Abstract description of an action supported by the servicePort Type A set of operations and messages involved with the serviceBinding A concrete protocol and data format specification for a port typePort A single end point defined as a combination of a binding and a network addressService Identifies which ports to group together
  • 23.
    SOAP2010-02-0824SOAP EnvelopeSOAP HeaderHeaderBlockSOAP BodyMessage BodyFault HandlersSOAP message structureSOAP is a lightweight (XML-based) protocol for exchange of information in a decentralized, distributed environment. SOAP is a format for sending messagesSOAP is independent of transport protocolA SOAP message is an ordinary XML document containing the following elements:Envelope - identifies the XML document as a SOAP messageHeader - contains application specific info like authentication etc.Body - contains the message in request and responseFault - contains errors and status information
  • 24.
    SOAP Example<?xml version="1.0"?><soap:Envelopexmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"><soap:Bodyxmlns:m="http://www.example.org/Hello"> <m:sayHello>    <m:name>Luqman</m:name>  </m:sayHello></soap:Body></soap:Envelope> 2010-02-0825RequestResponse<?xml version="1.0"?><soap:Envelopexmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"><soap:Bodyxmlns:m="http://www.example.org/stock">  <m:sayHelloResponse>    <m:return>Hello Luqman</m:return>  </m:sayHelloResponse></soap:Body></soap:Envelope>
  • 25.
    SOAP Fault2010-02-0826SOAP errorsare handled using a specialised envelope known as a Fault EnvelopeA SOAP Fault is a special element which must appear as an immediate child of the body element<faultcode> and <faultstring> are required.
  • 26.
    UDDI2010-02-08273 levels ofinformation in UDDIUDDI is a set of specifications that is used to publish information for describing and discovering web services, finding businesses, building registries. UDDI is a directory for storing information about web services.UDDI communicates via SOAP.White PagesTo query companies with their names and attributesYellow PagesTo query businesses with their categoriesGreen PagesContains technical info on how to interact with the services
  • 27.
  • 28.
    Registry APIs (SOAPMessages)2010-02-0829Publishers API
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.

Editor's Notes

  • #38 OASIS formed a committee to identify gaps in standards coverage for using SOA techniques in a telecom environment called SOA-Tel