SlideShare a Scribd company logo
1 of 56
Service Oriented Architectureand Web services Mohammed LuqmanShareef
COM, DCOM Microsoft specific EJB, RMI	Java Specific CORBA  	Platform and Language Independent 2010-02-08 2 Popular Distributed Application Frameworks/Technologies
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 standard It is NOT a technology 2010-02-08 3 What is SOA? ,[object Object],Coarse grained Loosely coupled Platform independent Standard Interface
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 ?
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?
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
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
Towards Service-Oriented Architecture ,[object Object]
Build to change
Incrementally built and deployed
Enterprise solutions
Loosely coupled
Message oriented
Abstraction
Function oriented
Build to last
Prolonged development cycles
Application silos
Tightly coupled
Object oriented
Known implementation,[object Object]
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
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
	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
2010-02-08 13 Realizing SOA with Web Services
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 ?
Lookup for the tomato sellers Yellow Pages: contain companies that are selling tomatoes, their location, and contact information.  2010-02-08 15 How to buy tomatoes ? ,[object Object],Where, when and how can I buy tomatoes?  ,[object Object],Do the  transaction
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?
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
2010-02-08 18 3 roles of service
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
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 + "!";    } }
2010-02-08 21 HelloImplService.wsdl
2010-02-08 22 HelloImplService.wsdl contd…
2010-02-08 23 HelloImplService_schema1.xsd
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();         }     } }
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
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
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
<?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-08 28 SOAP Example Request Response <?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 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
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
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());
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
2010-02-08 33 UDDI Structure
2010-02-08 34 Registry APIs (SOAP Messages) ,[object Object]
Save things
save_business
save_service
save_binding
save_tModel
Delete things
delete_business
delete_service
delete_binding
delete_tModel

More Related Content

What's hot

Cloud computing 20 service modelling
Cloud computing 20 service modellingCloud computing 20 service modelling
Cloud computing 20 service modellingVaibhav Khanna
 
Web service assignment
Web service assignmentWeb service assignment
Web service assignmentancymary1996
 
Introduction to Service Oriented Architectures, SOAP/WSDL Web Services and RE...
Introduction to Service Oriented Architectures, SOAP/WSDL Web Services and RE...Introduction to Service Oriented Architectures, SOAP/WSDL Web Services and RE...
Introduction to Service Oriented Architectures, SOAP/WSDL Web Services and RE...ecosio GmbH
 
Web services concepts, protocols and development
Web services concepts, protocols and developmentWeb services concepts, protocols and development
Web services concepts, protocols and developmentishmecse13
 
Introduction to web services and how to in php
Introduction to web services and how to in phpIntroduction to web services and how to in php
Introduction to web services and how to in phpAmit Kumar Singh
 
Client protocol connectivity flow in Exchange 2013/2010 coexistence | Introdu...
Client protocol connectivity flow in Exchange 2013/2010 coexistence | Introdu...Client protocol connectivity flow in Exchange 2013/2010 coexistence | Introdu...
Client protocol connectivity flow in Exchange 2013/2010 coexistence | Introdu...Eyal Doron
 
Client protocol connectivity flow in Exchange 2013/2007 coexistence | Introdu...
Client protocol connectivity flow in Exchange 2013/2007 coexistence | Introdu...Client protocol connectivity flow in Exchange 2013/2007 coexistence | Introdu...
Client protocol connectivity flow in Exchange 2013/2007 coexistence | Introdu...Eyal Doron
 
Introduction to webservices
Introduction to webservicesIntroduction to webservices
Introduction to webservicesGagandeep Singh
 
Web Services - Architecture and SOAP (part 1)
Web Services - Architecture and SOAP (part 1)Web Services - Architecture and SOAP (part 1)
Web Services - Architecture and SOAP (part 1)Martin Necasky
 
Understanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company indiaUnderstanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company indiaJignesh Aakoliya
 
Web service Introduction
Web service IntroductionWeb service Introduction
Web service IntroductionMadhukar Kumar
 
Web services for developer
Web services for developerWeb services for developer
Web services for developerRafiq Ahmed
 

What's hot (20)

Cloud computing 20 service modelling
Cloud computing 20 service modellingCloud computing 20 service modelling
Cloud computing 20 service modelling
 
Web service assignment
Web service assignmentWeb service assignment
Web service assignment
 
Introduction to Service Oriented Architectures, SOAP/WSDL Web Services and RE...
Introduction to Service Oriented Architectures, SOAP/WSDL Web Services and RE...Introduction to Service Oriented Architectures, SOAP/WSDL Web Services and RE...
Introduction to Service Oriented Architectures, SOAP/WSDL Web Services and RE...
 
Introduction to Web Services
Introduction to Web ServicesIntroduction to Web Services
Introduction to Web Services
 
Web services concepts, protocols and development
Web services concepts, protocols and developmentWeb services concepts, protocols and development
Web services concepts, protocols and development
 
Web services
Web servicesWeb services
Web services
 
WSDL
WSDLWSDL
WSDL
 
Introduction to web services and how to in php
Introduction to web services and how to in phpIntroduction to web services and how to in php
Introduction to web services and how to in php
 
Client protocol connectivity flow in Exchange 2013/2010 coexistence | Introdu...
Client protocol connectivity flow in Exchange 2013/2010 coexistence | Introdu...Client protocol connectivity flow in Exchange 2013/2010 coexistence | Introdu...
Client protocol connectivity flow in Exchange 2013/2010 coexistence | Introdu...
 
Client protocol connectivity flow in Exchange 2013/2007 coexistence | Introdu...
Client protocol connectivity flow in Exchange 2013/2007 coexistence | Introdu...Client protocol connectivity flow in Exchange 2013/2007 coexistence | Introdu...
Client protocol connectivity flow in Exchange 2013/2007 coexistence | Introdu...
 
web technologies Unit 5
 web technologies Unit 5 web technologies Unit 5
web technologies Unit 5
 
Introduction to webservices
Introduction to webservicesIntroduction to webservices
Introduction to webservices
 
Unit 5 WEB TECHNOLOGIES
Unit 5 WEB TECHNOLOGIES Unit 5 WEB TECHNOLOGIES
Unit 5 WEB TECHNOLOGIES
 
Web Services - Architecture and SOAP (part 1)
Web Services - Architecture and SOAP (part 1)Web Services - Architecture and SOAP (part 1)
Web Services - Architecture and SOAP (part 1)
 
Understanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company indiaUnderstanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company india
 
Osbsoa1
Osbsoa1Osbsoa1
Osbsoa1
 
Web service architecture
Web service architectureWeb service architecture
Web service architecture
 
Web service Introduction
Web service IntroductionWeb service Introduction
Web service Introduction
 
Web services wsdl
Web services wsdlWeb services wsdl
Web services wsdl
 
Web services for developer
Web services for developerWeb services for developer
Web services for developer
 

Viewers also liked

The Kobo Vox for Academic Library Circulation
The Kobo Vox for Academic Library CirculationThe Kobo Vox for Academic Library Circulation
The Kobo Vox for Academic Library CirculationBrendan Ryan
 
Crowdpark architecture backend
Crowdpark architecture backendCrowdpark architecture backend
Crowdpark architecture backendFrancis Varga
 
Summary (refrigeration and air conditioning )
Summary (refrigeration and air conditioning )Summary (refrigeration and air conditioning )
Summary (refrigeration and air conditioning )TinHlaing
 
Ch11 cms march1
Ch11 cms march1Ch11 cms march1
Ch11 cms march1Mary Heuer
 
I Care Presentation W 2 Kip
I Care Presentation W 2 KipI Care Presentation W 2 Kip
I Care Presentation W 2 Kipyokh05
 

Viewers also liked (6)

The Kobo Vox for Academic Library Circulation
The Kobo Vox for Academic Library CirculationThe Kobo Vox for Academic Library Circulation
The Kobo Vox for Academic Library Circulation
 
Crowdpark architecture backend
Crowdpark architecture backendCrowdpark architecture backend
Crowdpark architecture backend
 
Summary (refrigeration and air conditioning )
Summary (refrigeration and air conditioning )Summary (refrigeration and air conditioning )
Summary (refrigeration and air conditioning )
 
Skyquestcom by Kolirana
Skyquestcom by KoliranaSkyquestcom by Kolirana
Skyquestcom by Kolirana
 
Ch11 cms march1
Ch11 cms march1Ch11 cms march1
Ch11 cms march1
 
I Care Presentation W 2 Kip
I Care Presentation W 2 KipI Care Presentation W 2 Kip
I Care Presentation W 2 Kip
 

Similar to Service Oriented Architecture Updated Luqman

Service Oriented Architecture
Service Oriented ArchitectureService Oriented Architecture
Service Oriented ArchitectureLuqman Shareef
 
Service Oriented Architecture Luqman
Service Oriented Architecture LuqmanService Oriented Architecture Luqman
Service Oriented Architecture LuqmanLuqman Shareef
 
WebService-Java
WebService-JavaWebService-Java
WebService-Javahalwal
 
webservices overview
webservices overviewwebservices overview
webservices overviewelliando dias
 
Web Services in Cloud Computing.pptx
Web Services in Cloud Computing.pptxWeb Services in Cloud Computing.pptx
Web Services in Cloud Computing.pptxssuser403d87
 
Web Services
Web ServicesWeb Services
Web Serviceschidi
 
Web services and SOA
Web services and SOAWeb services and SOA
Web services and SOASubin Sugunan
 
Day1 : web service basics
Day1 :  web service basics Day1 :  web service basics
Day1 : web service basics Testing World
 
Ogsi protocol perspective
Ogsi protocol perspectiveOgsi protocol perspective
Ogsi protocol perspectivePooja Dixit
 
Performance of Web Services on Smart Phone Platforms
Performance of Web Services on Smart Phone PlatformsPerformance of Web Services on Smart Phone Platforms
Performance of Web Services on Smart Phone PlatformsIOSR Journals
 
Web services and SOA [Modified]
Web services and SOA [Modified]Web services and SOA [Modified]
Web services and SOA [Modified]Subin Sugunan
 
Dot net training-navimumbai
Dot net training-navimumbaiDot net training-navimumbai
Dot net training-navimumbaivibrantuser
 
Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)Peter R. Egli
 
Exposing EJBs As Web Services
Exposing EJBs As Web ServicesExposing EJBs As Web Services
Exposing EJBs As Web ServicesSubin Sugunan
 

Similar to Service Oriented Architecture Updated Luqman (20)

Service Oriented Architecture
Service Oriented ArchitectureService Oriented Architecture
Service Oriented Architecture
 
Service Oriented Architecture Luqman
Service Oriented Architecture LuqmanService Oriented Architecture Luqman
Service Oriented Architecture Luqman
 
WebService-Java
WebService-JavaWebService-Java
WebService-Java
 
Java web services
Java web servicesJava web services
Java web services
 
webservices overview
webservices overviewwebservices overview
webservices overview
 
Web Services in Cloud Computing.pptx
Web Services in Cloud Computing.pptxWeb Services in Cloud Computing.pptx
Web Services in Cloud Computing.pptx
 
Web Services
Web ServicesWeb Services
Web Services
 
Service view
Service viewService view
Service view
 
Web services and SOA
Web services and SOAWeb services and SOA
Web services and SOA
 
SOA and web services
SOA and web servicesSOA and web services
SOA and web services
 
Day1 : web service basics
Day1 :  web service basics Day1 :  web service basics
Day1 : web service basics
 
Ogsi protocol perspective
Ogsi protocol perspectiveOgsi protocol perspective
Ogsi protocol perspective
 
Performance of Web Services on Smart Phone Platforms
Performance of Web Services on Smart Phone PlatformsPerformance of Web Services on Smart Phone Platforms
Performance of Web Services on Smart Phone Platforms
 
Web services and SOA [Modified]
Web services and SOA [Modified]Web services and SOA [Modified]
Web services and SOA [Modified]
 
Xml.ppt
Xml.pptXml.ppt
Xml.ppt
 
Dot net training-navimumbai
Dot net training-navimumbaiDot net training-navimumbai
Dot net training-navimumbai
 
Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)
 
Web Programming
Web ProgrammingWeb Programming
Web Programming
 
Webservices
WebservicesWebservices
Webservices
 
Exposing EJBs As Web Services
Exposing EJBs As Web ServicesExposing EJBs As Web Services
Exposing EJBs As Web Services
 

Service Oriented Architecture Updated Luqman

  • 1. Service Oriented Architectureand Web services Mohammed LuqmanShareef
  • 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
  • 8.
  • 21.
  • 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
  • 25. 2010-02-08 13 Realizing SOA with Web Services
  • 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
  • 30. 2010-02-08 18 3 roles of 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
  • 40. <?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-08 28 SOAP Example Request Response <?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>
  • 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
  • 45. 2010-02-08 33 UDDI Structure
  • 46.
  • 70.
  • 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
  • 75.
  • 76. Resources themselves are the targets for method calls
  • 77.
  • 78.
  • 79.
  • 82.
  • 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