2. COM, DCOM Microsoft specific EJB, RMI Java Specific CORBA Platform and Language Independent 2010-02-08 2 Popular Distributed Application Frameworks/Technologies
3.
4. Self-contained module that perform a predetermined task Software component that have published contracts/interfaces Black-box to the consumers Platform-Independent Interoperable 2010-02-08 4 What is Service ?
5. Systems today are bigger than ever before Complexity increases exponentially with size Systems need to be interconnected OO solved the problems of small-medium sized systems CO (Component Orientation) solved problems of medium-large systems Neither OO nor CO could cope with the problems of very large systems, systems of systems, or integration between systems Why SOA?
6. 2010-02-08 6 Why SOA? End Customer Portal Operator Portal Partner Portal Customer Info Management Order Management Credit Management Sales Management Billing Lets take a telecom enterprise system Invoicing Provisioning Network Management Inventory Service Catalog Customer Profiles
7. 2010-02-08 7 Why SOA? End Customer Portal Operator Portal Partner Portal Services Credit Management Sales Management Customer Info Management Order Management Provisioning Invoicing Inventory Network Management Customer Profiles Billing Service Catalog
22. Loose coupling Minimize dependencies. Service contract Services adhere to a communications agreement. Service abstraction Hide the service execution logic from the outside world. Service reusability Logic is divided into services for reuse. 2010-02-08 10 SOA: Architectural Principles
23. Service composability Services can be assembled to form composite service. Service autonomy Services have control over the logic they encapsulate. Service discoverability Services can be found and assessed via available discovery mechanisms. Service relevance Service presented at a granularity recognized by user a meaningful service. 2010-02-08 11 SOA: Architectural Principles
24. SOA can be implemented using any service based technology such as CORBA, but 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 2010-02-08 12 SOA Implementation
26. Web 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. 2010-02-08 14 What is web service ?
27.
28. Lookup for the Service Provider Registry: contain providers that are selling services, their location, and contact information. Find the service offered according to my needs Where, when and how can I get the service? Access the servicedo the transaction 2010-02-08 16 How to access a service?
29. XML (eXtensibleMarkup Language) A uniform data representation and exchange mechanism SOAP (Simple Object Access Protocol) Lightweight (XML-based) protocol for exchange of information in a decentralized, distributed environment WSDL (Web Service Description Language) XML format that describes the web service UDDI (Universal Description Discovery and Integration) Like yellow pages of Web services 2010-02-08 17 Components of a web service
31. 2010-02-08 19 Service Vs. Consumer Policy Adheres to governed by End Point Binds to Exposes Serves Service Consumer Service Contracts implements Understands describes Messages Sends/Receives Sends/Receives
32. Define the service implementation and compile it. S>javac -d . HelloImpl.java Use wsgen to generate the artifacts required to deploy the service. S>wsgen -wsdlserver.HelloImpl 3. Package the files into a WAR file and deploy it . 2010-02-08 20 Steps to develop a web serviceusing JAX-WS package server; import javax.jws.WebService; @WebService public class HelloImpl { /** * @param name * @return Say hello to the person. */ public String sayHello(String name) { return "Hello, " + name + "!"; } }
36. Implement Client Code 5. Use wsimport to generate and compile the web service artifacts needed to connect to the service. S>wsimportHelloImplService.wsdl parsing WSDL... generating code... compiling code... 6. Run the client. 2010-02-08 24 Steps to develop a web service contd… package 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(); } } }
37. WSDL is a contract between service provider and the consumer A WSDL document describes What the service can do Where it resides How to invoke it 2010-02-08 25 WSDL WSDL elements Types Message Operation Port Type WSDL Binding Port Service
38. Types Data type definition used in exchanging messages Message Describes the logical content of data being communicated Operation An Abstract description of an action supported by the service Port Type A set of operations and messages involved with the service Binding A concrete protocol and data format specification for a port type Port A single end point defined as a combination of a binding and a network address Service Identifies which ports to group together 2010-02-08 26 WSDL elements
39. 2010-02-08 27 SOAP SOAP Envelope SOAP Header Header Block SOAP Body Message Body Fault Handlers SOAP message structure SOAP is a lightweight (XML-based) protocol for exchange of information in a decentralized, distributed environment. SOAP is a format for sending messages SOAP is independent of transport protocol A SOAP message is an ordinary XML document containing the following elements: Envelope - identifies the XML document as a SOAP message Header - contains application specific info like authentication etc. Body - contains the message in request and response Fault - contains errors and status information
41. SOAP errors are handled using a specialised envelope known as a Fault Envelope A SOAP Fault is a special element which must appear as an immediate child of the body element <faultcode> and <faultstring> are required. 2010-02-08 29 SOAP Fault
42. Printing SOAP Message public class MySOAPHandler implements SOAPHandler<SOAPMessageContext>{ public booleanhandleMessage(SOAPMessageContext context) { try { SOAPMessage message = context.getMessage(); if ((Boolean)context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY) == true){ System.out.println("Request Message: "); }else{ System.out.println("Response Message: "); } message.writeTo(System.out); } catch (Exception ex) { ex.printStackTrace(); } return true; } public Set<QName> getHeaders() { return null; } public booleanhandleFault(SOAPMessageContext context) { return true; } public void close(MessageContext context) { } } Wite a new Class MySOAPHandler Implement handleMessage
43. Printing SOAP Message contd... public class MyMessageHandlerResolver implements HandlerResolver { public List<Handler> getHandlerChain(PortInfoportInfo) { List<Handler> handlerChain = new ArrayList<Handler>(); MySOAPHandlerhh = new MySOAPHandler(); handlerChain.add(hh); return handlerChain; } } Wite a new Class MyHandlerResolver Implement getHandleChain Set the Handler Resolver in Client Invoke the web method Run the client service.setHandlerResolver(new MyMessageHandlerResolver());
44. UDDI 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. 2010-02-08 32 UDDI 3 levels of information in UDDI White Pages To query companies with their names and attributes Yellow Pages To query businesses with their categories Green Pages Contains technical info on how to interact with the services
71. Printing SOAP Message in AXIS Edit the generated code in AdderSoapBindingStub.class - In the corresponding method of the Stub class add the following lines of code after the _call.invoke(...) statement String requestMessage = _call.getMessageContext().getRequestMessage().getSOAPEnvelope().toString(); String responseMessage = _call.getMessageContext().getResponseMessage().getSOAPEnvelope().toString(); System.out.println(“Request SOAP Message” + requestMessage); System.out.println(“Request SOAP Message” + responseMessage);
72. Adding attachments to SOAP Message in AXIS Client Side Code CalculatorService service = new CalculatorServiceLocator(); Calculator calc = service.getcalculator(); Stub stub = (Stub) calc; FileDataSourcefs = new FileDataSource(new File("E:/Code/testA.txt") ); DataHandler dh = new DataHandler(fs); stub.addAttachment(dh); Display the Attachment in Stub Edit the generated code in AdderSoapBindingStub.class - In the corresponding method of the Stub class add the following lines of code after the _call.invoke(...) statement MessageContext message = _call.getMessageContext(); //.getRequestMessage(); Iterator it = message.getRequestMessage().getAttachments(); while (it.hasNext()) { AttachmentPart part = (AttachmentPart) it.next(); try { System.out.println("File Name : " + part.getDataHandler().getDataSource().getName()); InputStream is = part.getDataHandler().getInputStream(); while (is.available() > 0) { System.out.print((char) is.read()); } } catch (Exception ex) { ex.printStackTrace(); }
74. Each unique URL is a representation of some object Ex : http://www.mycompany.com/india/hyd/employees http://www. mycompany.com/india/hyd/employees/1234 HTTP GET Method operates on the resource. Object state is transferred and stored at client. Representation of the resource state in XML, JSON etc. 2010-02-08 39 RESTful web services REpresentationalState Transfer
83. 2010-02-08 43 Developing a RESTful web service using JAX-WS package com.sun.jersey.samples.helloworld.resources; import javax.ws.rs.GET; import javax.ws.rs.Produces; import javax.ws.rs.Path; @Path("/employees/{empid}") public class Employee{ @GET @Produces("text/xml") public String getEmployee(@PathParam(“empid") String empId) { ... … } }
86. Securing web services SSL is not enough SSL provides point to point security WS needs end to end security SSL provides security at transport level WS needs security at message level SSL doesn’t support non-repudiation Non-repudiation is critical for business WS Web service security requirements Authentication ( Identity check ) Authorization ( Access Control ) Confidentiality ( Encryption ) Integrity ( Signature Support ) Non-repudiation ( Ability to prove that a particular transaction is performed) Accessibility ( Ensuring that the service is not impacted by attacks) 2010-02-08 46
87. XML digital signature ( IETF and W3C) XML Encryption ( W3C) SAML (Secure Assertion Markup Language) ( OASIS) WS-Security (Web Services Security) (OASIS) WS-SecureConversation WS-Federation WS-Policy WS-Trust WS-Privacy XACML (Extensible Access Control Markup Language) (OASIS) 2010-02-08 47 Web service security standards
88. “BPEL is an XML language for defining the composition of web services into new services” BPEL would require that every process Either has a “center” of execution A process is composed of a large set of orchestration definitions interacting with each other BPEL assumes that business processes can be fully captured in a single definition, including all possible exception paths Not sure this is the right assumption BPEL
89. Identify the partners in the process Declare the Partners in the Process Design the workflow of the process Define up the workflow process Declare the Process Using BPEL Activity Constructs Add Business Logic Using BPELConstructs BPEL Steps
90. Open source specification project from the Object Management Group (OMG), describing a UML profile and metamodel for the modeling and design of services within a service-oriented architecture. SoaML(SOA Modeling Language)
91. Dealer Network Architecture The dealer network is defined as a community “collaboration” involving three primary roles for participants in this community: the dealer, manufacturer, and shipper. The following diagram illustrates these roles and services in the dealer network architecture. SOAML Example
92. The enterprise service bus (ESB) is a software infrastructure that facilitates application integration. An ESB does not itself implement SOA but provides the features with which SOA can be implemented. Examples Glassfish ESB (Sun) Websphere ESB (IBM) Biztalk Server (Microsoft) JBOSS ESB ESB
93. Invocation Routing Mediation Message Processing Service Orchestration Complex Event Processing Management Common ESB Characteristics
94. SOAP - http://www.w3c.org/TR/soap WSDL - http://www.w3c.org/TR/wsdl UDDI - http://www.uddi.xml.org SAML - http://saml.xml.org ebXML - http://www.ebxml.org CORBA Vs. Web services - http://www2002.og/CDROM/alternate/395 SoaML - http://www.omg.org/spec/SoaML BPEL - www.oasis-open.org/committees/wsbpel 2010-02-08 54 For more information