exposing ejbs as web services

Download Exposing EJBs As Web Services

Post on 15-Jan-2015

13.329 views

Category:

Technology

0 download

Embed Size (px)

DESCRIPTION

EJBs can be exposed as web services on a fly with EJB3. This is an introductory presentation about the same.

TRANSCRIPT

  • 1. Exposing EJBs as web services [email_address]

2. Whats Inside

  • What is a web service?
  • Types
  • WSDL, UDDI and SOAP
  • Development Approaches
  • EJB Vs POJO for a web service
  • Clients
  • Debugging and Testing
  • Best practices
  • Resources

3. What Are Web Services ?

  • Software Components that can be published, located and run over the internet

[W3C (working group) definition] "A Web service is a software application identified by a URI, whose interfaces and bindings are capable of being defined, described and discovered as XML artifacts. A Web service supports direct interactions with other software agents using XML based messages exchanged via internet-based protocols." 4. Web Services Vision 5. Type of Web services SOAP REST and more .. 6. SOAP Web Services

  • The key players: WSDL, UDDI and SOAP

7. Describing a web service: WSDL

  • The types element defines the data types exchanged when the web service is invoked.The parameters passed to and returned from a method are considered data types.
  • The messages used by the web service. A message may contain more than a message part. Each message part is actually part of the SOAP message being sent, and is either a parameter or result being passed.
  • A portType is the most important part of a WSDL. it defines operations that can be performed and the messages involved.
  • The communication protocols used by the web service

The Web Services Description Language (WSDL) describesall details about how the web service works, where it can be found, and what the client should expect in return etc.. 8. Discovering a service: UDDI

  • UDDI is a platform-independent framework for describing services, discovering businesses, and integrating business services by using the Internet .

http://www.xmethods.com/ve2/index.po 9. Defining a message: SOAP ... ... ... SOAP is an XML-based protocol to let applications exchange information over HTTP. 10. Approaches to developing web services

  • Bottom up strategy
    • The bottom-up strategy is the most popular approach to developing a web service. It allows you to reuse your investments by exposing your existing applications. If the implementation class already exists. All that is needed is to create a WSDL and expose the implementation class as a web service.
  • Top down strategy
    • Top down is often termed the pure approach to building a web service. Also known as contract first web services, this approach starts with the WSDL (the contract) by defining operations, messages, and so forth. Then you build the endpoint interface, and finally the implementation class.

11. Why choose EJB over a POJO for a web service? 12. Developing EJB web services with JAX-WS 2.0

  • @WebService
  • @SOAPBinding
  • @WebMethod
  • @WebParam
  • @WebResult
  • Lets write some code.

13. @WebService Marks a Java class as implementing a Web Service, or a Java interface as defining a Web Service interface. 14. @SOAPBinding Specifies the mapping of the Web Service onto the SOAP message protocol. 15. @WebMethod Customizes a method that is exposed as a Web Service operation. 16. @WebParam Customizes the mapping of an individual parameter to a Web Service message part and XML element. 17. @WebResult Customizes the mapping of the return value to a WSDL part and XML element.. 18. Writing clients in java

  • Java application client
  • EJB as a web service client

19. Debugging and Testing EJB web Service

  • JUnit
  • Eclipse Web Service Explorer
  • SoapUI
  • Web Service Call Composer
  • WebInject
  • JMeter
  • SOAPSonar Personal Edition
  • SOA Cleaner
  • Vordel SOAPbox
  • Storm

20. Best practices for web service development

  • Determine whether you really need your application to be exposed as a web service and that your application requires interoperability.
  • Analyze whether you need RPC-oriented or document-oriented web services.
  • Design your EJB web service so that it creates very minimal network traffic.
  • Use JAX-WS data types as the method parameters for your web service to give it interoperability with heterogeneous web services.
  • Best practices for Web services versioning
  • http://www.ibm.com/developerworks/webservices/library/ws-version/

21. Resources

  • http://www.w3schools.com/webservices/default.asp
  • http://www.w3schools.com/soap/default.asp
  • http://www.w3schools.com/wsdl/default.asp
  • Manning EJB 3 in Action

22. Thank You