SlideShare a Scribd company logo
Java EE 6 – Web Service
Vladan Pulec
Objectives
 Overview
 Distinguish between the two types of web
services
 RESTful Service & Demo
 Web Service & Demo
Key Features
• Platform independent
• Language independent
• Interoperable across disparate programming
languages
• Leveraging existing technologies (HTTP, XML)
• Supported in SE and EE version of Java
Benefits
• Flexibility of supporting unknown future client
platforms
• Use of HTTP
• Easier communication via firewalls and proxies
• Flexible to use a variety of transmission
protocols (ie. SMTP)
Disadvantages
• Verbose (can be slower than other
middleware technologies)
• Relying on HTTP, the roles are fixed (only one
party can use the service of the other).
– Service cannot push, client must pull
Web Service Standards
• There are two prevailing types:
• Representational State Transfer (REST) – JSR 311
• Simple Object Access Protocol (SOAP) – JSR 224
RESTful Web Services
• Representation State Transfer (REST) revolve
around resources (candidate, client, etc)
• The state of the resource is captured and
transferred using the service
JAX-RS API
• Does not require any specific data format
• Often CSV, JSON (JavaScript Object Notation), or
XML
• Provides only server-side API
• Can be combined with JAXB or any other Java
XML API
Web Service Endpoints
• Remotely executable components that exist
on the server and are executed as a result of
receiving a web service request.
• Both JAX-RS and JAX-WS can use the
following:
• Annotated POJOs
• Session bean components (Stateless or Singleton
beans only)
JAVA-RS Endpoints
• The end point is:
• Annotated class created to provide web service
functionality
• Is instantiated per request
• Does not require an EJB container
• JAVA-RS will provide a servlet implementation
to handle the requests
JAVA-RS Web Endpoints
• Must have the following:
– @javax.ws.rs.Path class annotation
– Public methods that are annotated with method
designator (ie. @GET)
– Uses @Produces and/or @Consumers annotations
– Cannot be abstract
• Web.xml must have a web a JAVA-RS servlet
configured
– Classes with @Path annotation will be handled by
it.
REST Example
1. A resource is given a specific URL (such as
http://localhost/clients/adobe)
2. HTTP methods are used to perform operations
– HTTP GET – retrieves the resource representation
– HTTP POST – adds new element to the resource
– HTTP PUT – creates or updates resource
– HTTP DELETE – deletes the resource
• Content can be of any MIME Type (text, XML, etc.)
SOAP Web Services
• Simple Object Access Protocol (SOAP)
• More complex than REST but provides more
benefits
• To implement SOAP client, developer only
needs to know the Web Services Description
Language (WSDL) file, which exposes all API
information
• Utilizes HTTP request/response and XML
JAX-WS
• Replaces JAX-RPC
• Required minimal knowledge of XML or WSDL
to use basic services
• Provides both server and client APIssd SOAP
Client Service
JAX-WS runtime JAX-WS runtimeSOAP Message
Sample SOAP Request
• <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/“
xmlns:xsd="http://www.w3.org/2001/XMLSchema“ xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance">
• <SOAP-ENV:Header>
• <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-
1.0.xsd">
• <wsse:UsernameToken>
• <wsse:Username>123456</wsse:Username>
• <wsse:Password>mypassword</wsse:Password>
• </wsse:UsernameToken>
• <service_attributes ignore_warnings="false" />
• </wsse:Security>
• </SOAP-ENV:Header>
• <SOAP-ENV:Body>
• <ser:findByTestCenterID xmlns:ser="http://services.capacity.vue/">
• <testCenterID>4</testCenterID>
• </ser:findByTestCenterID>
• </SOAP-ENV:Body>
• </SOAP-ENV:Envelope>
sd SOAP
Envelope
Header
Body
Sample SOAP Response
• <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
• <soap:Body>
• <ns2:findByTestCenterIDResponse xmlns:ns2="http://services.capacity.vue/">
• <workstationSearchResponse>
• <testCenter id="4" name="Electronic Systems" tws="-1" />
• <workstationRules>
• <workstationRule activeRuleCount="1">
• <asset assetCategoryCode="Workstation" assetID="53412"
• assetName="Test 7" siteID="4" isEnabled="true" />
• </workstationRule>
• </workstationRules>
• </workstationSearchResponse>
• </ns2:findByTestCenterIDResponse>
• </soap:Body>
• </soap:Envelope>
JAVA-WS Endpoints
• Must have the following:
– @javax.jws.WebService annotation
– Public methods (cannot be final or static) with
@javax.jws.WebMethod annotation
– Class cannot be abstract or final
– Must have no args constructor
Data Types
• JAX-WS does not contain JAVA to XML binding
• Java Architecture for XML Binding (JAXB) is
designed to handle the binding
• Basic Java types are supported, complex ones
require JAXB programming
Java APIs for Web Services
JDOM – provides OO Java model of an XML document
JAXP – abstraction of an XML processing
JAXB – converts objects to XML schemas
JAX-RPC – remote access API (replaced by JAX-WS)
JAXR – standard for using UDDI registries
SAAJ – standard for transmitting and parsing SOAP messages
JAX-RS – RESTful API
JAX-WS – high-level web service API
Additional Resources
JSR 224 – Java API for Web Services (JAX-WS)
JSR 331 – Java API for Restful Services (JAX-RS)

More Related Content

What's hot

Complete integration with mule esb
Complete integration with mule esbComplete integration with mule esb
Complete integration with mule esb
Son Nguyen
 
Enterprise java unit-3_chapter-1-jsp
Enterprise  java unit-3_chapter-1-jspEnterprise  java unit-3_chapter-1-jsp
Enterprise java unit-3_chapter-1-jsp
sandeep54552
 
Introduction to mule esb
Introduction to mule esbIntroduction to mule esb
Introduction to mule esb
Khasim Cise
 
Mule technologies
Mule technologiesMule technologies
Mule technologies
D.Rajesh Kumar
 
Mule ESB
Mule ESBMule ESB
Mule ESB
Yura Nosenko
 
Session 28 - Servlets - Part 4
Session 28 - Servlets - Part 4Session 28 - Servlets - Part 4
Session 28 - Servlets - Part 4
PawanMM
 
Servlet.ppt
Servlet.pptServlet.ppt
Servlet.ppt
VMahesh5
 
Soap in mule
Soap in muleSoap in mule
Soap in mule
D.Rajesh Kumar
 
Maven introduction in Mule
Maven introduction in MuleMaven introduction in Mule
Maven introduction in Mule
Shahid Shaik
 
Log management system for Microservices
Log management system for MicroservicesLog management system for Microservices
Log management system for Microservices
Võ Duy Tuấn
 
Enterprise java unit-2_chapter-3
Enterprise  java unit-2_chapter-3Enterprise  java unit-2_chapter-3
Enterprise java unit-2_chapter-3
sandeep54552
 
Mule agent architecture
Mule agent architectureMule agent architecture
Mule agent architecture
Krishna_in
 
Java/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBCJava/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBC
FAKHRUN NISHA
 
Session 25 - Introduction to JEE, Servlets
Session 25 - Introduction to JEE, ServletsSession 25 - Introduction to JEE, Servlets
Session 25 - Introduction to JEE, Servlets
PawanMM
 
Mule components
Mule componentsMule components
Mule components
Krishna_in
 
Java online training
Java online trainingJava online training
Java online trainingVikram Prasad
 
Mule compatible technologies
Mule compatible technologiesMule compatible technologies
Mule compatible technologies
himajareddys
 
Mule soap
Mule soapMule soap
Mule soap
Khasim Saheb
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivity
Tanmoy Barman
 

What's hot (19)

Complete integration with mule esb
Complete integration with mule esbComplete integration with mule esb
Complete integration with mule esb
 
Enterprise java unit-3_chapter-1-jsp
Enterprise  java unit-3_chapter-1-jspEnterprise  java unit-3_chapter-1-jsp
Enterprise java unit-3_chapter-1-jsp
 
Introduction to mule esb
Introduction to mule esbIntroduction to mule esb
Introduction to mule esb
 
Mule technologies
Mule technologiesMule technologies
Mule technologies
 
Mule ESB
Mule ESBMule ESB
Mule ESB
 
Session 28 - Servlets - Part 4
Session 28 - Servlets - Part 4Session 28 - Servlets - Part 4
Session 28 - Servlets - Part 4
 
Servlet.ppt
Servlet.pptServlet.ppt
Servlet.ppt
 
Soap in mule
Soap in muleSoap in mule
Soap in mule
 
Maven introduction in Mule
Maven introduction in MuleMaven introduction in Mule
Maven introduction in Mule
 
Log management system for Microservices
Log management system for MicroservicesLog management system for Microservices
Log management system for Microservices
 
Enterprise java unit-2_chapter-3
Enterprise  java unit-2_chapter-3Enterprise  java unit-2_chapter-3
Enterprise java unit-2_chapter-3
 
Mule agent architecture
Mule agent architectureMule agent architecture
Mule agent architecture
 
Java/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBCJava/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBC
 
Session 25 - Introduction to JEE, Servlets
Session 25 - Introduction to JEE, ServletsSession 25 - Introduction to JEE, Servlets
Session 25 - Introduction to JEE, Servlets
 
Mule components
Mule componentsMule components
Mule components
 
Java online training
Java online trainingJava online training
Java online training
 
Mule compatible technologies
Mule compatible technologiesMule compatible technologies
Mule compatible technologies
 
Mule soap
Mule soapMule soap
Mule soap
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivity
 

Viewers also liked

Java 8
Java 8Java 8
Java 8vpulec
 
Ejb 2.0
Ejb 2.0Ejb 2.0
Ejb 2.0sukace
 
Internet Technology
Internet TechnologyInternet Technology
Internet Technologyhome
 
Enterprise Java Beans - EJB
Enterprise Java Beans - EJBEnterprise Java Beans - EJB
Enterprise Java Beans - EJB
Peter R. Egli
 

Viewers also liked (6)

Java 8
Java 8Java 8
Java 8
 
TYBSc[IT]_SEM-6
TYBSc[IT]_SEM-6TYBSc[IT]_SEM-6
TYBSc[IT]_SEM-6
 
Ejb 2.0
Ejb 2.0Ejb 2.0
Ejb 2.0
 
Internet Technology
Internet TechnologyInternet Technology
Internet Technology
 
Enterprise Java Beans - EJB
Enterprise Java Beans - EJBEnterprise Java Beans - EJB
Enterprise Java Beans - EJB
 
EJB .
EJB .EJB .
EJB .
 

Similar to Java Web services

What’s new in Java SE, EE, ME, Embedded world & new Strategy
What’s new in Java SE, EE, ME, Embedded world & new StrategyWhat’s new in Java SE, EE, ME, Embedded world & new Strategy
What’s new in Java SE, EE, ME, Embedded world & new Strategy
Mohamed Taman
 
Java Web services
Java Web servicesJava Web services
Java Web servicesSujit Kumar
 
AJppt.pptx
AJppt.pptxAJppt.pptx
AJppt.pptx
SachinSingh217687
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)
slire
 
Web Technologies in Java EE 7
Web Technologies in Java EE 7Web Technologies in Java EE 7
Web Technologies in Java EE 7Lukáš Fryč
 
JavaEE and RESTful development - WSO2 Colombo Meetup
JavaEE and RESTful development - WSO2 Colombo Meetup JavaEE and RESTful development - WSO2 Colombo Meetup
JavaEE and RESTful development - WSO2 Colombo Meetup
Sagara Gunathunga
 
Intro To Web and Web Services (REST Series 01)
Intro To Web and Web Services (REST Series 01)Intro To Web and Web Services (REST Series 01)
Intro To Web and Web Services (REST Series 01)
Heartin Jacob
 
Java on Windows Azure (Cloud Computing Expo 2010)
Java on Windows Azure (Cloud Computing Expo 2010)Java on Windows Azure (Cloud Computing Expo 2010)
Java on Windows Azure (Cloud Computing Expo 2010)
David Chou
 
Lecture 19 - Dynamic Web - JAVA - Part 1.ppt
Lecture 19 - Dynamic Web - JAVA - Part 1.pptLecture 19 - Dynamic Web - JAVA - Part 1.ppt
Lecture 19 - Dynamic Web - JAVA - Part 1.ppt
KalsoomTahir2
 
Oracle API Gateway
Oracle API GatewayOracle API Gateway
Oracle API Gateway
Rakesh Gujjarlapudi
 
Java EE 8 Update
Java EE 8 UpdateJava EE 8 Update
Java EE 8 Update
Ryan Cuprak
 
Advance java1.1
Advance java1.1Advance java1.1
Advance java1.1
Prince Soni
 
Lecture 19 dynamic web - java - part 1
Lecture 19   dynamic web - java - part 1Lecture 19   dynamic web - java - part 1
Lecture 19 dynamic web - java - part 1Д. Ганаа
 
JavaEE6 my way
JavaEE6 my wayJavaEE6 my way
JavaEE6 my way
Nicola Pedot
 
Java EE 8
Java EE 8Java EE 8
Java EE 8
Ryan Cuprak
 
REST API Recommendations
REST API RecommendationsREST API Recommendations
REST API RecommendationsJeelani Shaik
 
Java Web Services [4/5]: Java API for XML Web Services
Java Web Services [4/5]: Java API for XML Web ServicesJava Web Services [4/5]: Java API for XML Web Services
Java Web Services [4/5]: Java API for XML Web Services
IMC Institute
 

Similar to Java Web services (20)

What’s new in Java SE, EE, ME, Embedded world & new Strategy
What’s new in Java SE, EE, ME, Embedded world & new StrategyWhat’s new in Java SE, EE, ME, Embedded world & new Strategy
What’s new in Java SE, EE, ME, Embedded world & new Strategy
 
Java Web services
Java Web servicesJava Web services
Java Web services
 
AJppt.pptx
AJppt.pptxAJppt.pptx
AJppt.pptx
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)
 
Coursejspservlets00
Coursejspservlets00Coursejspservlets00
Coursejspservlets00
 
Web Technologies in Java EE 7
Web Technologies in Java EE 7Web Technologies in Java EE 7
Web Technologies in Java EE 7
 
JavaEE and RESTful development - WSO2 Colombo Meetup
JavaEE and RESTful development - WSO2 Colombo Meetup JavaEE and RESTful development - WSO2 Colombo Meetup
JavaEE and RESTful development - WSO2 Colombo Meetup
 
Intro To Web and Web Services (REST Series 01)
Intro To Web and Web Services (REST Series 01)Intro To Web and Web Services (REST Series 01)
Intro To Web and Web Services (REST Series 01)
 
Java on Windows Azure (Cloud Computing Expo 2010)
Java on Windows Azure (Cloud Computing Expo 2010)Java on Windows Azure (Cloud Computing Expo 2010)
Java on Windows Azure (Cloud Computing Expo 2010)
 
Java part 3
Java part  3Java part  3
Java part 3
 
Lecture 19 - Dynamic Web - JAVA - Part 1.ppt
Lecture 19 - Dynamic Web - JAVA - Part 1.pptLecture 19 - Dynamic Web - JAVA - Part 1.ppt
Lecture 19 - Dynamic Web - JAVA - Part 1.ppt
 
Oracle API Gateway
Oracle API GatewayOracle API Gateway
Oracle API Gateway
 
Java EE 8 Update
Java EE 8 UpdateJava EE 8 Update
Java EE 8 Update
 
Advance java1.1
Advance java1.1Advance java1.1
Advance java1.1
 
Lecture 19 dynamic web - java - part 1
Lecture 19   dynamic web - java - part 1Lecture 19   dynamic web - java - part 1
Lecture 19 dynamic web - java - part 1
 
JavaEE6 my way
JavaEE6 my wayJavaEE6 my way
JavaEE6 my way
 
Java EE 8
Java EE 8Java EE 8
Java EE 8
 
Ntg web services
Ntg   web servicesNtg   web services
Ntg web services
 
REST API Recommendations
REST API RecommendationsREST API Recommendations
REST API Recommendations
 
Java Web Services [4/5]: Java API for XML Web Services
Java Web Services [4/5]: Java API for XML Web ServicesJava Web Services [4/5]: Java API for XML Web Services
Java Web Services [4/5]: Java API for XML Web Services
 

Recently uploaded

Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
Rohit Gautam
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
ThomasParaiso2
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 

Recently uploaded (20)

Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 

Java Web services

  • 1. Java EE 6 – Web Service Vladan Pulec
  • 2. Objectives  Overview  Distinguish between the two types of web services  RESTful Service & Demo  Web Service & Demo
  • 3. Key Features • Platform independent • Language independent • Interoperable across disparate programming languages • Leveraging existing technologies (HTTP, XML) • Supported in SE and EE version of Java
  • 4. Benefits • Flexibility of supporting unknown future client platforms • Use of HTTP • Easier communication via firewalls and proxies • Flexible to use a variety of transmission protocols (ie. SMTP)
  • 5. Disadvantages • Verbose (can be slower than other middleware technologies) • Relying on HTTP, the roles are fixed (only one party can use the service of the other). – Service cannot push, client must pull
  • 6. Web Service Standards • There are two prevailing types: • Representational State Transfer (REST) – JSR 311 • Simple Object Access Protocol (SOAP) – JSR 224
  • 7. RESTful Web Services • Representation State Transfer (REST) revolve around resources (candidate, client, etc) • The state of the resource is captured and transferred using the service
  • 8. JAX-RS API • Does not require any specific data format • Often CSV, JSON (JavaScript Object Notation), or XML • Provides only server-side API • Can be combined with JAXB or any other Java XML API
  • 9. Web Service Endpoints • Remotely executable components that exist on the server and are executed as a result of receiving a web service request. • Both JAX-RS and JAX-WS can use the following: • Annotated POJOs • Session bean components (Stateless or Singleton beans only)
  • 10. JAVA-RS Endpoints • The end point is: • Annotated class created to provide web service functionality • Is instantiated per request • Does not require an EJB container • JAVA-RS will provide a servlet implementation to handle the requests
  • 11. JAVA-RS Web Endpoints • Must have the following: – @javax.ws.rs.Path class annotation – Public methods that are annotated with method designator (ie. @GET) – Uses @Produces and/or @Consumers annotations – Cannot be abstract • Web.xml must have a web a JAVA-RS servlet configured – Classes with @Path annotation will be handled by it.
  • 12. REST Example 1. A resource is given a specific URL (such as http://localhost/clients/adobe) 2. HTTP methods are used to perform operations – HTTP GET – retrieves the resource representation – HTTP POST – adds new element to the resource – HTTP PUT – creates or updates resource – HTTP DELETE – deletes the resource • Content can be of any MIME Type (text, XML, etc.)
  • 13. SOAP Web Services • Simple Object Access Protocol (SOAP) • More complex than REST but provides more benefits • To implement SOAP client, developer only needs to know the Web Services Description Language (WSDL) file, which exposes all API information • Utilizes HTTP request/response and XML
  • 14. JAX-WS • Replaces JAX-RPC • Required minimal knowledge of XML or WSDL to use basic services • Provides both server and client APIssd SOAP Client Service JAX-WS runtime JAX-WS runtimeSOAP Message
  • 15. Sample SOAP Request • <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/“ xmlns:xsd="http://www.w3.org/2001/XMLSchema“ xmlns:xsi="http://www.w3.org/2001/XMLSchema- instance"> • <SOAP-ENV:Header> • <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext- 1.0.xsd"> • <wsse:UsernameToken> • <wsse:Username>123456</wsse:Username> • <wsse:Password>mypassword</wsse:Password> • </wsse:UsernameToken> • <service_attributes ignore_warnings="false" /> • </wsse:Security> • </SOAP-ENV:Header> • <SOAP-ENV:Body> • <ser:findByTestCenterID xmlns:ser="http://services.capacity.vue/"> • <testCenterID>4</testCenterID> • </ser:findByTestCenterID> • </SOAP-ENV:Body> • </SOAP-ENV:Envelope> sd SOAP Envelope Header Body
  • 16. Sample SOAP Response • <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> • <soap:Body> • <ns2:findByTestCenterIDResponse xmlns:ns2="http://services.capacity.vue/"> • <workstationSearchResponse> • <testCenter id="4" name="Electronic Systems" tws="-1" /> • <workstationRules> • <workstationRule activeRuleCount="1"> • <asset assetCategoryCode="Workstation" assetID="53412" • assetName="Test 7" siteID="4" isEnabled="true" /> • </workstationRule> • </workstationRules> • </workstationSearchResponse> • </ns2:findByTestCenterIDResponse> • </soap:Body> • </soap:Envelope>
  • 17. JAVA-WS Endpoints • Must have the following: – @javax.jws.WebService annotation – Public methods (cannot be final or static) with @javax.jws.WebMethod annotation – Class cannot be abstract or final – Must have no args constructor
  • 18. Data Types • JAX-WS does not contain JAVA to XML binding • Java Architecture for XML Binding (JAXB) is designed to handle the binding • Basic Java types are supported, complex ones require JAXB programming
  • 19. Java APIs for Web Services JDOM – provides OO Java model of an XML document JAXP – abstraction of an XML processing JAXB – converts objects to XML schemas JAX-RPC – remote access API (replaced by JAX-WS) JAXR – standard for using UDDI registries SAAJ – standard for transmitting and parsing SOAP messages JAX-RS – RESTful API JAX-WS – high-level web service API
  • 20. Additional Resources JSR 224 – Java API for Web Services (JAX-WS) JSR 331 – Java API for Restful Services (JAX-RS)