SlideShare a Scribd company logo
Implementing Web Services in Java
www.edureka.co/java-j2ee-soa-training
View Java/J2EE and SOA course details at http://www.edureka.co/java-j2ee-soa-training
For Queries:
Post on Twitter @edurekaIN: #askEdureka
Post on Facebook /edurekaIN
For more details please contact us:
US : 1800 275 9730 (toll free)
INDIA : +91 88808 62004
Email Us : sales@edureka.co
www.edureka.co/java-j2ee-soa-trainingSlide 2 Twitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions
Objectives
At the end of this webinar, you will be able to:
 Understand SOAP
 Implement WSDL
 Work Of REST Services
 Create a Restful App in JAVA
Slide 3 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions
SOAP
 SOAP is a protocol to access Web services.
 SOAP stands for Simple Object Access Protocol. This protocol is based on XML.
 SOAP was designed in 1998 by Dave Winer, Don Box, Bob Atkinson, and Mohsen Al-Ghose.
Request 1 Request 1
Response1 Response1
SOAP
message
context
SOAP
message
context
Handler 1 Handler 2
Client
Request 1
Response1
SOAP
message
context
Handler
Service
SOAP
Service Requester Service Provider
Slide 4 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions
SOAP
 SOAP stands for Simple Object Access Protocol
 SOAP is used for communicating between two applications
 SOAP is a format for sending messages
 SOAP communicates via Internet using HTTP
 SOAP is platform independent
 SOAP is written using XML
 SOAP is a W3C recommendation
Slide 5 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions
SOAP - Example
For example: If we want to get the approval/declined status for credit card transaction from
bank using SOAP, following steps to be done/will be executed:
In client module, write the details about the customer details like credit card, account number,
expiry date, CVV2 etc., in SOAP format.
This SOAP message is sent on web to web service which provides the desired service.
The web service unpacks the SOAP message and converts into a command that the
application can understand. Application will get the credit card information. It does the
required processing and generates the response either approval/declined status in SOAP
message.
This SOAP message is sent back to the client.
Client unpacks the SOAP message and gets the required information.
Slide 6 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions
Credit card
account number
expiry date
CVV2
……..
Client Module
SOAP Format
Output in
Web
Web Service
unpacks the SOAP message
and converts into a command
that the application can
understand
SOAP
Message
SOAP – Flow Diagram
Slide 7 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions
SOAP Files - WSDL, Client Generation
Server
Java Code - which does the actual operation/provides the service.
WSDL File - Web Service Description Language. This file says the information about the
services like the functions and what input it takes and what output it generates etc.
Client
Using WSDL file, we can generate the client and can execute the web services.
Slide 8 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions
Web Services - SOAP
 Web Service is published in UDDI registry
 UDDI stands for Universal Description, Discovery and Integration
 Client looks in the registry for the services and gets connected with the required service and interacts with it
UDDI
Registry
Web
Service
Requestor
Web
Service
Providerinvoke SOAP
register/publish
UDDI
locate/get description
UDDI
Slide 9 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions
Example of SOAP Request
Slide 10 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions
Example of SOAP Response
Slide 11 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions
WSDL
 WSDL is Web Services Description Language
 WSDL is written in XML and it is a XML document
 WSDL describes the Web services
 WSDL is a W3C recommendation
Slide 12 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions
WSDL
WSDL XML document has the following elements:
 <types> - This section is used to specify the data types used by the web services.
 <messages> - Messages for communication will be specified in this section. Input message
and output message can be specified in this section.
 <portType> - This defines the web service and the operations / methods to be executed.
Also the messages that are involved in this operation /method. Messages could be input
message and output message.
 <binding> - This section defines the message bindings and transportation protocol.
 <service> - Location of the service – URL.
Slide 13 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions
Example of WSDL File
Slide 14 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions
REST Services
 REST stands for Representational State Transfer
 This service is developed using HTTP protocol
 In Rest based architecture, similar to SOAP based Architecture, service is developed in REST
and REST client has to be written to use the REST Service
 Java defines REST support via the Java Specification Request (JSR) 311. This specification is
called JAX-RS (The Java API for RESTful Web Services)
Slide 15 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions
JAX-RS
 Jersey is the reference implementation for JSR (Java Specification Request)-311
 Jersey provides the library for RESTful Web Services using Servlet container
 Download Jersey distribution from the site: https://jersey.java.net/download.html
Slide 16 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions
Restful Services
 REST is an architecture. RESTful service is a service which follows the REST architecture.
 Following Annotations are used:
» @Path (path) – Sets the path to the base URL. The base URL is the application name,
servlet and URL specified in the web.xml.
» @GET – Indicates the following method will address HTTP GET request.
» @Produces – This function will generate the given output. It could be TEXT/HTML/XML
formats etc.
Slide 17 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions
Creating Restful Service
 Create a dynamic web project in eclipse.
 Add jersey jar files to the build path.
 Add the web.xml under web content/WEB-INF directory.
 Add a Java file and add the required code of the service.
Slide 18 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions
Restful Service – web.xml
Slide 19 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions
RESTful Service – Java Code
Slide 20 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions
Creating Restful Service
 Hello should be added for the path of this service.
 Name of the class is Hello.
 @GET – The following method will respond to GET method of the client request.
 @Produces – This method returns the data specified in the Produces annotation.
 Method returns the data.
 Run the project so that Service is running on Apache Tomcat.
Slide 21 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions
RESTful – Client
Slide 22 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions
RESTful – Client
 Base URL is obtained for the service.
 Methods of RESTful services are invoked by using the path and the media type.
 Apart from writing the client, service can be tested with the URL too
For example:
» http://localhost:8080/jax_rest2/rest/Hello?name=edureka
» Here, service is running under 8080 port.
Name of the application is jax_rest2, /rest/Hello is the Path and name=edureka
is passed as parameter to this service.
Questions
www.edureka.co/java-j2ee-soa-trainingSlide 23 Twitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions
Implementing Web Services In Java

More Related Content

PDF
Getting Started With AngularJS
PDF
Deep Dive into AngularJS Javascript Framework
PDF
Webinar: Microsoft .NET Framework : An IntelliSense Way of Web Development
PDF
Webinar: Front End Web Development - Trendy Web Designs Using HTML5
PDF
Develop Mobile App Using Android Lollipop
PDF
Design patterns 1july
PDF
A Work Day Of A Web Developer
PPTX
Java/J2EE & SOA
Getting Started With AngularJS
Deep Dive into AngularJS Javascript Framework
Webinar: Microsoft .NET Framework : An IntelliSense Way of Web Development
Webinar: Front End Web Development - Trendy Web Designs Using HTML5
Develop Mobile App Using Android Lollipop
Design patterns 1july
A Work Day Of A Web Developer
Java/J2EE & SOA

What's hot (18)

PDF
Animation And Testing In AngularJS
PDF
Using Android 5.0 Lollipop
PDF
Learn How to Animate your Android App
PDF
Webinar: Microsoft SharePoint-The Ultimate Enterprise Collaboration Platform
PDF
Design Patterns : Solution to Software Design Problems
PDF
Training report on web developing
PDF
AngularJS : Superheroic JavaScript MVW Framework
PDF
Webinar on Angular JS titled 'Develop Responsive Single Page Application'
PDF
Wa html5-pdf
PPT
Beyond The MVC
PDF
Wa html5-pdf
PDF
Day In A Life Of A Node.js Developer
PPTX
Web development presentation
PDF
Android development 1july
PDF
Angular 2 - How we got here?
PDF
Wordpress as a framework
PDF
How to optimize the performance of vue js large application structure
Animation And Testing In AngularJS
Using Android 5.0 Lollipop
Learn How to Animate your Android App
Webinar: Microsoft SharePoint-The Ultimate Enterprise Collaboration Platform
Design Patterns : Solution to Software Design Problems
Training report on web developing
AngularJS : Superheroic JavaScript MVW Framework
Webinar on Angular JS titled 'Develop Responsive Single Page Application'
Wa html5-pdf
Beyond The MVC
Wa html5-pdf
Day In A Life Of A Node.js Developer
Web development presentation
Android development 1july
Angular 2 - How we got here?
Wordpress as a framework
How to optimize the performance of vue js large application structure
Ad

Viewers also liked (20)

PDF
Web Service Implementation Using ASP.NET
PPT
Web Service Presentation
PPT
JAX-WS Basics
PPT
Using Java to implement SOAP Web Services: JAX-WS
PDF
OAuth with Restful Web Services
PPTX
Overview of RESTful web services
PDF
Java Web Services [1/5]: Introduction to Web Services
PDF
Spring Data JPA - Repositories done right
PPTX
Chp2 - Vers les Architectures Orientées Services
PPTX
Introduction to RESTful Webservices in JAVA
PDF
RESTful Web services using JAX-RS
PPT
Spring + JPA + DAO Step by Step
PPTX
Chp3 - Les Services Web
PPTX
Spring data jpa
PDF
Java API for XML Web Services (JAX-WS)
PDF
Java web services using JAX-WS
PPTX
What's New in Java 8
PDF
Java Web Application Security with Java EE, Spring Security and Apache Shiro ...
PDF
Web Services (SOAP, WSDL, UDDI)
PDF
Spring Framework - Spring Security
Web Service Implementation Using ASP.NET
Web Service Presentation
JAX-WS Basics
Using Java to implement SOAP Web Services: JAX-WS
OAuth with Restful Web Services
Overview of RESTful web services
Java Web Services [1/5]: Introduction to Web Services
Spring Data JPA - Repositories done right
Chp2 - Vers les Architectures Orientées Services
Introduction to RESTful Webservices in JAVA
RESTful Web services using JAX-RS
Spring + JPA + DAO Step by Step
Chp3 - Les Services Web
Spring data jpa
Java API for XML Web Services (JAX-WS)
Java web services using JAX-WS
What's New in Java 8
Java Web Application Security with Java EE, Spring Security and Apache Shiro ...
Web Services (SOAP, WSDL, UDDI)
Spring Framework - Spring Security
Ad

Similar to Implementing Web Services In Java (20)

DOCX
Server side programming bt0083
PDF
Building apps with tuscany
PPTX
Introduction to JQuery, ASP.NET MVC and Silverlight
PDF
Ajaykumar_last
PPTX
SpringBootCompleteBootcamp.pptx
PPT
Top school in gurgaon
PDF
Building Restful Web App Rapidly in CakePHP
PDF
Lec6 ecom fall16
PPTX
Http and REST APIs.
PDF
Restful web services_tutorial
PDF
IRJET- Lightweight MVC Framework in PHP
PPT
Struts 2 Overview
PDF
Rapid Development With CakePHP
PPT
Struts,Jsp,Servlet
PPT
Strutsjspservlet
PPT
Strutsjspservlet
ODP
servlet 2.5 & JSP 2.0
PDF
Karim mahmoud cv
PDF
Servlet Tutorial | JSP Tutorial | Advanced Java Tutorial | Java Certification...
PDF
Pathway,I Ts Web Client Programming Manual
Server side programming bt0083
Building apps with tuscany
Introduction to JQuery, ASP.NET MVC and Silverlight
Ajaykumar_last
SpringBootCompleteBootcamp.pptx
Top school in gurgaon
Building Restful Web App Rapidly in CakePHP
Lec6 ecom fall16
Http and REST APIs.
Restful web services_tutorial
IRJET- Lightweight MVC Framework in PHP
Struts 2 Overview
Rapid Development With CakePHP
Struts,Jsp,Servlet
Strutsjspservlet
Strutsjspservlet
servlet 2.5 & JSP 2.0
Karim mahmoud cv
Servlet Tutorial | JSP Tutorial | Advanced Java Tutorial | Java Certification...
Pathway,I Ts Web Client Programming Manual

More from Edureka! (20)

PDF
What to learn during the 21 days Lockdown | Edureka
PDF
Top 10 Dying Programming Languages in 2020 | Edureka
PDF
Top 5 Trending Business Intelligence Tools | Edureka
PDF
Tableau Tutorial for Data Science | Edureka
PDF
Python Programming Tutorial | Edureka
PDF
Top 5 PMP Certifications | Edureka
PDF
Top Maven Interview Questions in 2020 | Edureka
PDF
Linux Mint Tutorial | Edureka
PDF
How to Deploy Java Web App in AWS| Edureka
PDF
Importance of Digital Marketing | Edureka
PDF
RPA in 2020 | Edureka
PDF
Email Notifications in Jenkins | Edureka
PDF
EA Algorithm in Machine Learning | Edureka
PDF
Cognitive AI Tutorial | Edureka
PDF
AWS Cloud Practitioner Tutorial | Edureka
PDF
Blue Prism Top Interview Questions | Edureka
PDF
Big Data on AWS Tutorial | Edureka
PDF
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
PDF
Kubernetes Installation on Ubuntu | Edureka
PDF
Introduction to DevOps | Edureka
What to learn during the 21 days Lockdown | Edureka
Top 10 Dying Programming Languages in 2020 | Edureka
Top 5 Trending Business Intelligence Tools | Edureka
Tableau Tutorial for Data Science | Edureka
Python Programming Tutorial | Edureka
Top 5 PMP Certifications | Edureka
Top Maven Interview Questions in 2020 | Edureka
Linux Mint Tutorial | Edureka
How to Deploy Java Web App in AWS| Edureka
Importance of Digital Marketing | Edureka
RPA in 2020 | Edureka
Email Notifications in Jenkins | Edureka
EA Algorithm in Machine Learning | Edureka
Cognitive AI Tutorial | Edureka
AWS Cloud Practitioner Tutorial | Edureka
Blue Prism Top Interview Questions | Edureka
Big Data on AWS Tutorial | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Kubernetes Installation on Ubuntu | Edureka
Introduction to DevOps | Edureka

Recently uploaded (20)

PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Approach and Philosophy of On baking technology
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Electronic commerce courselecture one. Pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Unlocking AI with Model Context Protocol (MCP)
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Spectral efficient network and resource selection model in 5G networks
Diabetes mellitus diagnosis method based random forest with bat algorithm
MYSQL Presentation for SQL database connectivity
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Approach and Philosophy of On baking technology
The Rise and Fall of 3GPP – Time for a Sabbatical?
20250228 LYD VKU AI Blended-Learning.pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Per capita expenditure prediction using model stacking based on satellite ima...
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Electronic commerce courselecture one. Pdf
The AUB Centre for AI in Media Proposal.docx
Building Integrated photovoltaic BIPV_UPV.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Programs and apps: productivity, graphics, security and other tools
Unlocking AI with Model Context Protocol (MCP)

Implementing Web Services In Java

  • 1. Implementing Web Services in Java www.edureka.co/java-j2ee-soa-training View Java/J2EE and SOA course details at http://www.edureka.co/java-j2ee-soa-training For Queries: Post on Twitter @edurekaIN: #askEdureka Post on Facebook /edurekaIN For more details please contact us: US : 1800 275 9730 (toll free) INDIA : +91 88808 62004 Email Us : [email protected]
  • 2. www.edureka.co/java-j2ee-soa-trainingSlide 2 Twitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions Objectives At the end of this webinar, you will be able to:  Understand SOAP  Implement WSDL  Work Of REST Services  Create a Restful App in JAVA
  • 3. Slide 3 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions SOAP  SOAP is a protocol to access Web services.  SOAP stands for Simple Object Access Protocol. This protocol is based on XML.  SOAP was designed in 1998 by Dave Winer, Don Box, Bob Atkinson, and Mohsen Al-Ghose. Request 1 Request 1 Response1 Response1 SOAP message context SOAP message context Handler 1 Handler 2 Client Request 1 Response1 SOAP message context Handler Service SOAP Service Requester Service Provider
  • 4. Slide 4 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions SOAP  SOAP stands for Simple Object Access Protocol  SOAP is used for communicating between two applications  SOAP is a format for sending messages  SOAP communicates via Internet using HTTP  SOAP is platform independent  SOAP is written using XML  SOAP is a W3C recommendation
  • 5. Slide 5 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions SOAP - Example For example: If we want to get the approval/declined status for credit card transaction from bank using SOAP, following steps to be done/will be executed: In client module, write the details about the customer details like credit card, account number, expiry date, CVV2 etc., in SOAP format. This SOAP message is sent on web to web service which provides the desired service. The web service unpacks the SOAP message and converts into a command that the application can understand. Application will get the credit card information. It does the required processing and generates the response either approval/declined status in SOAP message. This SOAP message is sent back to the client. Client unpacks the SOAP message and gets the required information.
  • 6. Slide 6 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions Credit card account number expiry date CVV2 …….. Client Module SOAP Format Output in Web Web Service unpacks the SOAP message and converts into a command that the application can understand SOAP Message SOAP – Flow Diagram
  • 7. Slide 7 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions SOAP Files - WSDL, Client Generation Server Java Code - which does the actual operation/provides the service. WSDL File - Web Service Description Language. This file says the information about the services like the functions and what input it takes and what output it generates etc. Client Using WSDL file, we can generate the client and can execute the web services.
  • 8. Slide 8 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions Web Services - SOAP  Web Service is published in UDDI registry  UDDI stands for Universal Description, Discovery and Integration  Client looks in the registry for the services and gets connected with the required service and interacts with it UDDI Registry Web Service Requestor Web Service Providerinvoke SOAP register/publish UDDI locate/get description UDDI
  • 9. Slide 9 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions Example of SOAP Request
  • 10. Slide 10 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions Example of SOAP Response
  • 11. Slide 11 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions WSDL  WSDL is Web Services Description Language  WSDL is written in XML and it is a XML document  WSDL describes the Web services  WSDL is a W3C recommendation
  • 12. Slide 12 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions WSDL WSDL XML document has the following elements:  <types> - This section is used to specify the data types used by the web services.  <messages> - Messages for communication will be specified in this section. Input message and output message can be specified in this section.  <portType> - This defines the web service and the operations / methods to be executed. Also the messages that are involved in this operation /method. Messages could be input message and output message.  <binding> - This section defines the message bindings and transportation protocol.  <service> - Location of the service – URL.
  • 13. Slide 13 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions Example of WSDL File
  • 14. Slide 14 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions REST Services  REST stands for Representational State Transfer  This service is developed using HTTP protocol  In Rest based architecture, similar to SOAP based Architecture, service is developed in REST and REST client has to be written to use the REST Service  Java defines REST support via the Java Specification Request (JSR) 311. This specification is called JAX-RS (The Java API for RESTful Web Services)
  • 15. Slide 15 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions JAX-RS  Jersey is the reference implementation for JSR (Java Specification Request)-311  Jersey provides the library for RESTful Web Services using Servlet container  Download Jersey distribution from the site: https://jersey.java.net/download.html
  • 16. Slide 16 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions Restful Services  REST is an architecture. RESTful service is a service which follows the REST architecture.  Following Annotations are used: » @Path (path) – Sets the path to the base URL. The base URL is the application name, servlet and URL specified in the web.xml. » @GET – Indicates the following method will address HTTP GET request. » @Produces – This function will generate the given output. It could be TEXT/HTML/XML formats etc.
  • 17. Slide 17 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions Creating Restful Service  Create a dynamic web project in eclipse.  Add jersey jar files to the build path.  Add the web.xml under web content/WEB-INF directory.  Add a Java file and add the required code of the service.
  • 18. Slide 18 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions Restful Service – web.xml
  • 19. Slide 19 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions RESTful Service – Java Code
  • 20. Slide 20 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions Creating Restful Service  Hello should be added for the path of this service.  Name of the class is Hello.  @GET – The following method will respond to GET method of the client request.  @Produces – This method returns the data specified in the Produces annotation.  Method returns the data.  Run the project so that Service is running on Apache Tomcat.
  • 21. Slide 21 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions RESTful – Client
  • 22. Slide 22 www.edureka.co/java-j2ee-soa-trainingTwitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions RESTful – Client  Base URL is obtained for the service.  Methods of RESTful services are invoked by using the path and the media type.  Apart from writing the client, service can be tested with the URL too For example: » http://localhost:8080/jax_rest2/rest/Hello?name=edureka » Here, service is running under 8080 port. Name of the application is jax_rest2, /rest/Hello is the Path and name=edureka is passed as parameter to this service.
  • 23. Questions www.edureka.co/java-j2ee-soa-trainingSlide 23 Twitter @edurekaIN, Facebook /edurekaIN, use #askEdureka for Questions