Date post: | 10-Apr-2018 |
Category: |
Documents |
Upload: | viveksingh21cs |
View: | 214 times |
Download: | 0 times |
8/8/2019 Ejb Websevice Presentation
http://slidepdf.com/reader/full/ejb-websevice-presentation 1/20
Expose an Stateless Session BeanExpose an Stateless Session Beanas a Web Serviceas a Web Service
Jaliya EkanayakeJaliya Ekanayake
8/8/2019 Ejb Websevice Presentation
http://slidepdf.com/reader/full/ejb-websevice-presentation 2/20
Agenda Agenda
Few DefinitionsFew Definitions
The Basics of Web ServicesThe Basics of Web Services
Benefits of Web ServicesBenefits of Web Services
Simple Web Service ExampleSimple Web Service Example
What is available in J2EE TechnologyWhat is available in J2EE Technology
EJB Web ServicesEJB Web Services
Exposing an EJB as a Web ServiceExposing an EJB as a Web Service
Tools Support Tools Support
Best PracticesBest Practices Sample ScenarioSample Scenario
8/8/2019 Ejb Websevice Presentation
http://slidepdf.com/reader/full/ejb-websevice-presentation 3/20
Web ServicesWeb Services -- BasicsBasics
DefinitionsDefinitions
Web service is a software application identified by a URI [RFC 2396],Web service is a software application identified by a URI [RFC 2396],whose interfaces and bindings are capable of being defined, described,whose interfaces and bindings are capable of being defined, described,and discovered as XML artifacts. A Web service supports direct interactionsand discovered as XML artifacts. A Web service supports direct interactionswith other software agents using XML based messages exchanged viawith other software agents using XML based messages exchanged viaInternet Internet--based protocols.based protocols. W3CW3C
Web servicesWeb services----software components that are programmatically accessiblesoftware components that are programmatically accessibleover standard Internet protocolsover standard Internet protocols Java Blue PrintsJava Blue Prints
Web Services in 2005Web Services in 2005
But ultimately what I really expect in this coming years that that Web But ultimately what I really expect in this coming years that that Webservices will go from that thing that you have tried once or twice, to anservices will go from that thing that you have tried once or twice, to anintegral part of almost all your development projects.integral part of almost all your development projects. --Matt Powell theMatt Powell thecontent strategist at the MSDN Web Services Developer Center.content strategist at the MSDN Web Services Developer Center.
8/8/2019 Ejb Websevice Presentation
http://slidepdf.com/reader/full/ejb-websevice-presentation 4/20
The ModelThe Model
SO AP HandlerSO AP Handler
Takes the parameters from the native client address space and transform (serialize)Takes the parameters from the native client address space and transform (serialize)then to SO AP.then to SO AP.
Takes the SO AP from the network and transform (deTakes the SO AP from the network and transform (de--serialize) it to parameters of serialize) it to parameters of the native service address space.the native service address space.
SO AP Handler may accept SO AP messages sent on various transport protocols.SO AP Handler may accept SO AP messages sent on various transport protocols.
E.g. HTTP, SMTP, TCP etc..E.g. HTTP, SMTP, TCP etc..
HTTP is the most popular protocolHTTP is the most popular protocol
Client
SOAP
Handler Client
Network
Server
SOAP
Handler ServiceSOAP msg SOAP msg
The Web Services Model
8/8/2019 Ejb Websevice Presentation
http://slidepdf.com/reader/full/ejb-websevice-presentation 5/20
Benefits of Web ServicesBenefits of Web Services
Interoperabilit y in a heterogeneous environment Interoperabilit y in a heterogeneous environment
Business services through the WebBusiness services through the Web
Integration with existing systemsIntegration with existing systems
Tools Support Tools Support
Support more client t ypesSupport more client t ypes Programming productivit y Programming productivit y
8/8/2019 Ejb Websevice Presentation
http://slidepdf.com/reader/full/ejb-websevice-presentation 6/20
Simplest way is to use JSE(J AX Simplest way is to use JSE(J AX--RPC Service Endpoint)RPC Service Endpoint) Expose Java classes directly as web servicesExpose Java classes directly as web services
Can use SO AP Endpoints based on Servlet Containers, e.g. Apache AxisCan use SO AP Endpoints based on Servlet Containers, e.g. Apache Axis
E.g. JSE with SO AP over HTTPE.g. JSE with SO AP over HTTP
Example Using Apache AxisExample Using Apache Axis
The Code Snippet for the ServiceThe Code Snippet for the Service >>>>
The Code Snippet for the client The Code Snippet for the client >>>>
DemoDemo
Simple Web Service ExampleSimple Web Service Example
SOAP
Handler
Service
Servlet Container
SOAP
Over HTTP
JAX-RPC Service Endpoint with SOAP Over HTTP
8/8/2019 Ejb Websevice Presentation
http://slidepdf.com/reader/full/ejb-websevice-presentation 7/20
What is available in J2EE TechnologyWhat is available in J2EE Technology
EJB components, by design, are meant for distributed computingEJB components, by design, are meant for distributed computing
EJB components are scalable, transactional, and secureEJB components are scalable, transactional, and secure
J2EE Containers provide primary services such as Naming, Login, Transaction,J2EE Containers provide primary services such as Naming, Login, Transaction,Deployment and Securit yDeployment and Securit y
Developer can focus more on Business LogicsDeveloper can focus more on Business Logics
Tons of applications have already bean written using EJBsTons of applications have already bean written using EJBs
Web Browser, Appletsand optionally
Java BeanComponents
Application Clients(Java)
Client Tier
J2EE Server
Web Tier Business Tier
JSPsand Servlets
Session BeansEntity Beans
Message DrivenBeans
EIS Tier
DB
RMIor IIOP
HTTP
J2EE Architecture
8/8/2019 Ejb Websevice Presentation
http://slidepdf.com/reader/full/ejb-websevice-presentation 8/20
EJB Web Services (JSR 109)EJB Web Services (JSR 109)
J2EE 1.4 Allows J AX J2EE 1.4 Allows J AX--RPC (JSR 101) Web Services using Stateless SessionRPC (JSR 101) Web Services using Stateless Session
Beans.Beans. J AX J AX--RPC hides the complexit y of SO AP messages from the developer.RPC hides the complexit y of SO AP messages from the developer.
J2EE web services can be invoked by any web service client, and any J2EEJ2EE web services can be invoked by any web service client, and any J2EEweb service client can invoke any web service.web service client can invoke any web service.
Web Browser, Appletsand optionally
Java BeanComponents
Application Clients(Java)
Application Clients(Java/Non Java)
Client Tier J2EE Server
Web Tier Business Tier
JSPsand Servlets
Session BeansEntity Beans
Message DrivenBeans
EIS Tier
DB
SOAPHandler SOAP
RMIor IIOP
HTTP
Web Services in J2EE
8/8/2019 Ejb Websevice Presentation
http://slidepdf.com/reader/full/ejb-websevice-presentation 9/20
Exposing an Stateless EJB as a Web ServiceExposing an Stateless EJB as a Web Service
Simple StepsSimple Steps Define the service interface (Depending on the business functionalit y that needs toDefine the service interface (Depending on the business functionalit y that needs to
be exposed)be exposed) >>>>
Generate the WSDL for the above service end point Generate the WSDL for the above service end point >>>>
E.g. Using Java2WSDL from ApacheE.g. Using Java2WSDL from Apache
java org.apache.axis.wsdl.Java2WSDLjava org.apache.axis.wsdl.Java2WSDL --aa --oo"CardValidatorService.wsdl""CardValidatorService.wsdl" --n "urn:ejbn "urn:ejb--ws"ws" --ll
"REPLACE_WITH_ACTUAL_URL" test.ejb.CardValidatorService"REPLACE_WITH_ACTUAL_URL" test.ejb.CardValidatorService
Create or Generate J AX Create or Generate J AX--RPC Mapping fileRPC Mapping file >>>>
Add the WSDL J AX Add the WSDL J AX--RPC Mapping file to the Manifest RPC Mapping file to the Manifest
Modif y the ejbModif y the ejb--jar.xml jar.xml >>>>
Add webservices.xml Add webservices.xml >>>> Package and DeployPackage and Deploy
DemoDemo
Accessing the web service can be done by J2EE, J2SE, J2ME or any other Accessing the web service can be done by J2EE, J2SE, J2ME or any otherclients that are running on different platforms.clients that are running on different platforms.
8/8/2019 Ejb Websevice Presentation
http://slidepdf.com/reader/full/ejb-websevice-presentation 10/20
Tools Support Tools Support
Servers that support JSR109Servers that support JSR109
SunSun JavaJava SystemSystem Application Application Server Platform Edition 8.1Server Platform Edition 8.1
JBOSSJBOSS--4.0.1RC14.0.1RC1
Oracle Application Server Containers for J2EE (OC4J) 10.0.3Oracle Application Server Containers for J2EE (OC4J) 10.0.3
Sun ONE (Open Network Environment) Application ServerSun ONE (Open Network Environment) Application Server
IBM Websphere V6IBM Websphere V6
Weblogic Server 7.0Weblogic Server 7.0
Apache Geronimo Apache Geronimo
IDEs and other toolsIDEs and other tools
Eclipse + Lomboz+ Jboss (Open source tool set)Eclipse + Lomboz+ Jboss (Open source tool set)
IBM WebSphere StudioIBM WebSphere Studio
SunSun JavaJava SystemSystem Application Application Server Platform Edition 8.1Server Platform Edition 8.1
8/8/2019 Ejb Websevice Presentation
http://slidepdf.com/reader/full/ejb-websevice-presentation 11/20
Best PracticesBest Practices
Services should be coarse grainServices should be coarse grain Avoid overusing Web services in your applications Avoid overusing Web services in your applications
Design your Web service so that it creates minimal network traffic >>Design your Web service so that it creates minimal network traffic >>
Avoid maintaining any kind of state information in your EJB components that Avoid maintaining any kind of state information in your EJB components that are exposed as Web services.are exposed as Web services.
Use J AX Use J AX--RPC data t ypes as the method parameters for the Web service toRPC data t ypes as the method parameters for the Web service togive it interoperabilit y with heterogeneous Web servicesgive it interoperabilit y with heterogeneous Web services
Avoid t ypes such as Collection, HashMap, and Lists as parameters for your Avoid t ypes such as Collection, HashMap, and Lists as parameters for yourWeb service if interoperabilit y is important for your applicationWeb service if interoperabilit y is important for your application
Avoid exposing an EJB component that involves long Avoid exposing an EJB component that involves long--running transactions asrunning transactions asa Web service.a Web service.
Weigh the securit y requirements against performance, because securit y Weigh the securit y requirements against performance, because securit y comes with a higher cost. The performance costs of endcomes with a higher cost. The performance costs of end--toto--end securit y areend securit y arehigh.high.
8/8/2019 Ejb Websevice Presentation
http://slidepdf.com/reader/full/ejb-websevice-presentation 12/20
K nown Limitations and IssuesK nown Limitations and Issues
Some Web Service Standards are still in draft levelSome Web Service Standards are still in draft level
May degrade the performance if used incorrectlyMay degrade the performance if used incorrectly
Possible securit y threats (SO AP over HTTP)Possible securit y threats (SO AP over HTTP)
Interoperabilit y issues (WSInteroperabilit y issues (WS--I Basic Profile)I Basic Profile)
Matching RequirementsMatching Requirements
8/8/2019 Ejb Websevice Presentation
http://slidepdf.com/reader/full/ejb-websevice-presentation 13/20
Sample ScenarioSample Scenario
8/8/2019 Ejb Websevice Presentation
http://slidepdf.com/reader/full/ejb-websevice-presentation 14/20
SummarySummary
Basics of Web ServicesBasics of Web Services
What is already there in J2EEWhat is already there in J2EE
How to expose an EJB as a Web ServiceHow to expose an EJB as a Web Service
Best PracticesBest Practices
8/8/2019 Ejb Websevice Presentation
http://slidepdf.com/reader/full/ejb-websevice-presentation 15/20
ReferencesReferences
JBOSS DocumentationJBOSS Documentation
http://docs.jboss.org /jbossas/getting_started/start guide40/ws.htmlhttp://docs.jboss.org /jbossas/getting_started/start guide40/ws.html
Designing Web Services with the J2EE 1.4 Platform: J AX Designing Web Services with the J2EE 1.4 Platform: J AX--RPC, SO AP, and XMLRPC, SO AP, and XMLTechnologiesTechnologies
http://java.sun.com/blueprints/guidelines/designing_webservices/http://java.sun.com/blueprints/guidelines/designing_webservices/
Web Services for J2EE, Version 1.0 (JSR109)Web Services for J2EE, Version 1.0 (JSR109)
ftp://wwwftp://www--126.ibm.com/pub/jsr109/spec/1.0/websvcs126.ibm.com/pub/jsr109/spec/1.0/websvcs--1 _01 _0--fr.pdf fr.pdf
Tutorial for building J2EE Applications using JBOSS and ECLIPSETutorial for building J2EE Applications using JBOSS and ECLIPSE
http://www.tusc.com.au/tutorial/html/chap1.htmlhttp://www.tusc.com.au/tutorial/html/chap1.html
http://www.javaworld.com/javaworld/jwhttp://www.javaworld.com/javaworld/jw--0808--2004/jw2004/jw--08020802--ejbws.htmlejbws.html
http://publib.boulder.ibm.com/infocenter/iadthelp/index.jsp?topic=/com.ibm.etools.webshttp://publib.boulder.ibm.com/infocenter/iadthelp/index.jsp?topic=/com.ibm.etools.webservice.doc/concepts/cjsr109.htmlervice.doc/concepts/cjsr109.html
http://dev2dev.bea.com/products/wlserver/articles/Gilbode.jsphttp://dev2dev.bea.com/products/wlserver/articles/Gilbode.jsp
http://incubator.apache.org /projects/geronimo/http://incubator.apache.org /projects/geronimo/
http://java.sun.com/developer/technical Articles/J2EE/j2ee _ws/#designhttp://java.sun.com/developer/technical Articles/J2EE/j2ee _ws/#design
8/8/2019 Ejb Websevice Presentation
http://slidepdf.com/reader/full/ejb-websevice-presentation 16/20
Thank YouThank You
8/8/2019 Ejb Websevice Presentation
http://slidepdf.com/reader/full/ejb-websevice-presentation 17/20
CardValidator Web Service (JSE)CardValidator Web Service (JSE)
<<<<
8/8/2019 Ejb Websevice Presentation
http://slidepdf.com/reader/full/ejb-websevice-presentation 18/20
CardValidator Client (JSE)CardValidator Client (JSE)
<<<<
8/8/2019 Ejb Websevice Presentation
http://slidepdf.com/reader/full/ejb-websevice-presentation 19/20
Web service endpoint for the stateless EJBWeb service endpoint for the stateless EJB
<<<<
8/8/2019 Ejb Websevice Presentation
http://slidepdf.com/reader/full/ejb-websevice-presentation 20/20
ejbejb--jar.xml jar.xml
<<<<