SlideShare a Scribd company logo
Web services - A Practical Approach
What is Web Service?
• Services are available in the Web.
• Communication between the two system
over network.
• Software system designed to support
interoperable machine-machine interaction
over the network (w3c definition).
• Real-time Example:
– Facebook, Google, Twitter, e-commerce sites,
and irctc.
Simple Use case
Application Server-1
bookTicket()
IRCTC- Ticket Service
DB
Dealer site1
(makemytrip.com)
Struts
Application Server-2
Dealer site2
(cleartrip.com)
.NET/RUBY
Application Server-3
cancelTicket()
Interface
Criteria for interface and
request/response
• Interface should be
platform independent. So
what is the format? And
why?
• Request and response
should be language
natural. So what is the
format? And why?
Web Service Terminologies
• SOAP – Simple Object Access Protocol.
– Envelope for soap request/response.
• WSDL – Web Service Description Language.
– Interface for SOAP web service
• UDDI – Universal Description, Discovery and
Integration.
– Repository/yellow pages of web services
• REST – REpresentational State Transfer.
– Architecture style of communication to the services
• HTTP – Hypertext Transfer Protocol.
– Stateless protocol and used for transport
Different Types of Web Services
SOAP REST
JAX-WS standard JAX-RS standard
Required WSDL interface for expos as web
service
No Interface. It uses HTTP methods
(GET,POST,PUT,DELETE)
XML should be communication medium for
request and response
Both XML and JSON used for request
and response.
Maintain session state Stateless (fire and forget)
It uses SOAP protocol to transfer data over
HTTP
Uses only HTTP
Not human readable Human readable
Client – server communication heavy weight
like BLOB
Simple client-server communication
and light weight.
SOAP vs REST
Client ServerData
SOAP
Standard
Huge
Data+ = <=>
SOAP
Client ServerData <=>
Sending data as its
REST
*REST are mostly used in industry
Web service Flow-I
HTTP
HTTP
Web Browser
Mobile
WSDL
SOAP
REST
DB
Web services
Application Server
Not Applicable for Real time
and it FALSE one for SOAP.
Disadvantage of flow-I
• Consuming SOAP services from Java Scripts is
tedious and time consuming task.
• Some browser will not support build in Jquery
functions for SOAP.(Browser compatibility)
• Security validation is needed for every service.
Because anybody can access any service.
• No centralized controlled.
• UI change to be needed for every Web service
enhancements like URL for version update.
Web service Flow-II (Actual)
Web Browser
Mobile
(Toolkit)
Java Web
service Client
DB
WSDL
SOAP
REST
DB
Web Server/application
server
Web/Servlet
application
Web services
Application Server
HTTP
HTTP
Client for Web service
Client for
Web App
Advantage of Flow-II
• Centralized control.
• Only authorized users/vendors can consume
web services.
• No UI changes needed.
• Can use OAUTH/APIGEE for security.
• Standard industry model
Examples
• GeoIP service
– http://www.webservicex.net/ws/WSDetails.aspx?
WSID=64&CATID=12
• One Time Password(OTP) service
– Our own service
Web Service - OTP
• OTP(One-Time-Password) Generator.
– This web service will generate OTP for authentication
for more security.
– Used in banking site, e-commerce site for every
transactions.
• Functionality
– Generate OTP and send to mail.
– Validate OTP.
– Get registered user.
– Get all registered users.
Complete Application architecture
(HealthCare Portal)
Generate OTP
Validate
Get All Subscriber
Get Subscriber
DB
WSDL
SMTP Mail
Server
(GMAIL)
Application Server (Glassfish)
Java
.Net
Ruby
Web Server
(Tomcat)
Servlets
End
User
SOAP Client
JDBC
ORM
(Hibernate)
Setup environments
• Required software
– JDK 1.6
– IDE (Eclipse/NetBeans)
– Application server (GlassFish)
– Mail API
– Database (postgresql DB)
• Technology used
– Java
– XML
– JDBC
Service Development
package com.soapwebtest.service;
import java.util.List;
import java.util.Random;
import javax.jws.WebMethod;
import javax.jws.WebService;
import com.soapwebtest.service.model.Subscriber;
@WebService
public class OTPGenerator {
@WebMethod
public boolean generateOtp(String email) {
return false;
}
public boolean validate(String mail, String otp) {
return false;
}
public Subscriber getSubscriber(String mail) {
return subscriber.
}
public List<Subscriber> getAllSubscriber() {
return List<Subscriber>
}
}
OTP service – WSDL interface
Compare WSDL with java Interface
package com.testapp.webservice //package name
Public interface Calculatore{ //interface name
int add(int a, int b); // method name, input and output parameters
int multiply(int a, int b);
Math add (Math math); //Object
}
WSDL high level elements
-<definition>
+<types> //input and output types reference
+<message> // inputs and outputs (one for input and one for output)
-<portType>
-<operation> //method name of webservice
<input> // all input and output are message
(one for input and one for output)
<output>
</operation>
+<binding> //information about how webservices accepts
its input and output via http (literal via http)
+<service> //list of ports and each port has address location.
port consist of operations
-</definition>
Name Space and types
• Name space represent the package name of
service.
• Name space should be unique.
• Types represents what kind of data type to
passed to service input and output over HTTP.
• Types will be applicable only for document style
binding. Not for RPC.
XSD Elements
SOAP binding style
JAX-RPC Document
no XSD XSD document as an input and
output
easy to read complex to read
no validation validates inputs (ex : minoccurs)
Note:
Document style binding is default
SOAP binding represents what kind of communication and data passed to
request and response for the service.
Document style binding
RPC binding
Service, portType and message
• Service consist of ports and each port will
have address location URL.
• portType has operations of service which
exposed on the particular port.
• Each operation has input/output which
represent as messages.
Example
WSDL Structure
Web service client
• One who consume web service is called web
service client.
• Client needs only WSDL interface.
• Different Types of Clients:
– Java
– .Net
– Ruby
– Python
Steps to create java client
• Use wsimport
– Wsimport –keep –s <src> <wsdl>
• Use Eclipse-IDE
– Create java project.
– Create Web service client.
– Specify the WSDL and Validate.
– Generate required classes using Axis.
Web Service Client Example
package com.soapwebtest.service;
import java.rmi.RemoteException;
import java.util.Arrays;
import java.util.List;
public class OTPClient {
public static void main(String[] args) throws RemoteException {
OTPGenerator service = new OTPGeneratorProxy();
List<Subscriber> ll = Arrays.asList(service.getAllSubscriber());
for (Subscriber subscriber : ll) {
System.out.println(subscriber.getEmail());
}
}
}
Complete Application architecture
(HealthCare Portal)
Generate OTP
Validate
Get All Subscriber
Get Subscriber
DB
WSDL
Mail Server
(GMAIL)
Application Server (Glassfish)
Java
.NET
Ruby
Web Server
(Tomcat)
Servlets
End
User
SOAP Client
JDBC
ORM
(Hibernate)
Developing Web Application and
Integrate SOAP Client
• Required Software:
– Hibernate
– Postgresql(Database)
– Tomcat (web server)
– SOAP Client
• Technology
– HTML
– JSP
– Servlets
– Java
– XML (web.xml)
Tomcat Web Server
Browser
Tomcat
Request
Response
Web Application
Web Application
Web Application
Login Servlet
Web.xml /
annotation
Servlet Terminologies
• Http- Stateless protocol
• HttpRequest – scope will be only on request
• HttpResponse- scope will be only on response
• HttpSession – scope on particular
browser/user
• ServletConfig- Scope on particular servlet
• ServletContext – Scope for all servlet and
every browser/user.
Serialization
• Process of storing object state for streaming
called serialization.
• Every java class should implements
serializable interface
• What is object state?
• Why should we store object state?
Serialization
Network
JVMJVM
SOAP Client Web Service
Serialization Example
Syllabus
• Web Services: JAX-RPC-Concepts-Writing a
Java Web Service-Writing a Java Web Service
Client-Describing Web Services: WSDL-
Representing Data Types: XML Schema-
communicating Object Data: SOAP Related
Technologies-Software Installation-Storing
Java Objects as Files-Databases and Java
Servlets.
Questions???
Thank You
Ad

More Related Content

What's hot (20)

Java Networking
Java NetworkingJava Networking
Java Networking
Sunil OS
 
Introduction to ASP.NET
Introduction to ASP.NETIntroduction to ASP.NET
Introduction to ASP.NET
Rajkumarsoy
 
Server Controls of ASP.Net
Server Controls of ASP.NetServer Controls of ASP.Net
Server Controls of ASP.Net
Hitesh Santani
 
Use case Diagram
Use case Diagram Use case Diagram
Use case Diagram
Rahul Pola
 
ASP.NET Basics
ASP.NET Basics ASP.NET Basics
ASP.NET Basics
baabtra.com - No. 1 supplier of quality freshers
 
web service technologies
web service technologiesweb service technologies
web service technologies
Yash Darak
 
WCF
WCFWCF
WCF
Vishwa Mohan
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
Taha Malampatti
 
Introduction to Visual Studio.NET
Introduction to Visual Studio.NETIntroduction to Visual Studio.NET
Introduction to Visual Studio.NET
Dutch Dasanaike {LION}
 
State Machine Diagram
State Machine DiagramState Machine Diagram
State Machine Diagram
Niloy Rocker
 
Form Validation in JavaScript
Form Validation in JavaScriptForm Validation in JavaScript
Form Validation in JavaScript
Ravi Bhadauria
 
Types of UML diagrams
Types of UML diagramsTypes of UML diagrams
Types of UML diagrams
Mukesh Tekwani
 
Use Case Diagram
Use Case DiagramUse Case Diagram
Use Case Diagram
Kumar
 
Vi editor
Vi editorVi editor
Vi editor
Ramakrishna kapa
 
Full stack development
Full stack developmentFull stack development
Full stack development
Arnav Gupta
 
Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013
Wave Digitech
 
Client Server Architecture in Software engineering
Client Server Architecture in Software engineeringClient Server Architecture in Software engineering
Client Server Architecture in Software engineering
pruthvi2898
 
Android Services
Android ServicesAndroid Services
Android Services
Ahsanul Karim
 
Use Case Diagram
Use Case DiagramUse Case Diagram
Use Case Diagram
Ashesh R
 
CSS framework By Palash
CSS framework By PalashCSS framework By Palash
CSS framework By Palash
PalashBajpai
 

Viewers also liked (20)

Web Service Presentation
Web Service PresentationWeb Service Presentation
Web Service Presentation
guest0df6b0
 
Web Services Tutorial
Web Services TutorialWeb Services Tutorial
Web Services Tutorial
Lorna Mitchell
 
Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)
Peter R. Egli
 
Web Services - A brief overview
Web Services -  A brief overviewWeb Services -  A brief overview
Web Services - A brief overview
Raveendra Bhat
 
Web Services
Web ServicesWeb Services
Web Services
Katrien Verbert
 
Web service introduction
Web service introductionWeb service introduction
Web service introduction
Sagara Gunathunga
 
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
 
Webservices Overview : XML RPC, SOAP and REST
Webservices Overview : XML RPC, SOAP and RESTWebservices Overview : XML RPC, SOAP and REST
Webservices Overview : XML RPC, SOAP and REST
Pradeep Kumar
 
SOAP vs REST
SOAP vs RESTSOAP vs REST
SOAP vs REST
Mário Almeida
 
REST & RESTful Web Services
REST & RESTful Web ServicesREST & RESTful Web Services
REST & RESTful Web Services
Halil Burak Cetinkaya
 
REST vs. SOAP
REST vs. SOAPREST vs. SOAP
REST vs. SOAP
Murat Çakal
 
REST vs SOAP
REST vs SOAPREST vs SOAP
REST vs SOAP
Juan Luis Pérez
 
Testing web services
Testing web servicesTesting web services
Testing web services
Taras Lytvyn
 
Restful Web Services
Restful Web ServicesRestful Web Services
Restful Web Services
Angelin R
 
RESTful Web Services
RESTful Web ServicesRESTful Web Services
RESTful Web Services
Christopher Bartling
 
ReST Vs SOA(P) ... Yawn
ReST Vs SOA(P) ... YawnReST Vs SOA(P) ... Yawn
ReST Vs SOA(P) ... Yawn
ozten
 
Java web services using JAX-WS
Java web services using JAX-WSJava web services using JAX-WS
Java web services using JAX-WS
IndicThreads
 
Soap vs. rest - which is right web service protocol for your need?
Soap vs. rest -  which is right web service protocol for your need?Soap vs. rest -  which is right web service protocol for your need?
Soap vs. rest - which is right web service protocol for your need?
Vijay Prasad Gupta
 
REST - Representational State Transfer
REST - Representational State TransferREST - Representational State Transfer
REST - Representational State Transfer
Peter R. Egli
 
Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. REST
Sam Brannen
 
Web Service Presentation
Web Service PresentationWeb Service Presentation
Web Service Presentation
guest0df6b0
 
Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)
Peter R. Egli
 
Web Services - A brief overview
Web Services -  A brief overviewWeb Services -  A brief overview
Web Services - A brief overview
Raveendra Bhat
 
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
 
Webservices Overview : XML RPC, SOAP and REST
Webservices Overview : XML RPC, SOAP and RESTWebservices Overview : XML RPC, SOAP and REST
Webservices Overview : XML RPC, SOAP and REST
Pradeep Kumar
 
Testing web services
Testing web servicesTesting web services
Testing web services
Taras Lytvyn
 
Restful Web Services
Restful Web ServicesRestful Web Services
Restful Web Services
Angelin R
 
ReST Vs SOA(P) ... Yawn
ReST Vs SOA(P) ... YawnReST Vs SOA(P) ... Yawn
ReST Vs SOA(P) ... Yawn
ozten
 
Java web services using JAX-WS
Java web services using JAX-WSJava web services using JAX-WS
Java web services using JAX-WS
IndicThreads
 
Soap vs. rest - which is right web service protocol for your need?
Soap vs. rest -  which is right web service protocol for your need?Soap vs. rest -  which is right web service protocol for your need?
Soap vs. rest - which is right web service protocol for your need?
Vijay Prasad Gupta
 
REST - Representational State Transfer
REST - Representational State TransferREST - Representational State Transfer
REST - Representational State Transfer
Peter R. Egli
 
Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. REST
Sam Brannen
 
Ad

Similar to Web services - A Practical Approach (20)

Ntg web services
Ntg   web servicesNtg   web services
Ntg web services
Farag Zakaria
 
Introduction to Web Services and the cocnept
Introduction to Web Services and the cocneptIntroduction to Web Services and the cocnept
Introduction to Web Services and the cocnept
PaceInfotech
 
webservicearchitecture-150614164814-lva1-app6892.ppt
webservicearchitecture-150614164814-lva1-app6892.pptwebservicearchitecture-150614164814-lva1-app6892.ppt
webservicearchitecture-150614164814-lva1-app6892.ppt
Matrix823409
 
Servlet.pptx
Servlet.pptxServlet.pptx
Servlet.pptx
SenthilKumar571813
 
Servlet.pptx
Servlet.pptxServlet.pptx
Servlet.pptx
Senthil Kumar
 
web services-May 25.ppt
web services-May 25.pptweb services-May 25.ppt
web services-May 25.ppt
ShivaangiKrish
 
Servlets api overview
Servlets api overviewServlets api overview
Servlets api overview
ramya marichamy
 
Web service architecture
Web service architectureWeb service architecture
Web service architecture
Muhammad Shahroz Anwar
 
Servlet by Rj
Servlet by RjServlet by Rj
Servlet by Rj
Shree M.L.Kakadiya MCA mahila college, Amreli
 
06 web api
06 web api06 web api
06 web api
Bat Programmer
 
UNIT - 5.pptx Servlets And Database Connectivity
UNIT - 5.pptx  Servlets And Database ConnectivityUNIT - 5.pptx  Servlets And Database Connectivity
UNIT - 5.pptx Servlets And Database Connectivity
bmit1
 
IT2255 Web Essentials - Unit V Servlets and Database Connectivity
IT2255 Web Essentials - Unit V Servlets and Database ConnectivityIT2255 Web Essentials - Unit V Servlets and Database Connectivity
IT2255 Web Essentials - Unit V Servlets and Database Connectivity
pkaviya
 
Windows communication foundation (part1) jaliya udagedara
Windows communication foundation (part1)    jaliya udagedaraWindows communication foundation (part1)    jaliya udagedara
Windows communication foundation (part1) jaliya udagedara
Jaliya Udagedara
 
Servlet ppt by vikas jagtap
Servlet ppt by vikas jagtapServlet ppt by vikas jagtap
Servlet ppt by vikas jagtap
Vikas Jagtap
 
Oracle API Gateway
Oracle API GatewayOracle API Gateway
Oracle API Gateway
Rakesh Gujjarlapudi
 
Structured Functional Automated Web Service Testing
Structured Functional Automated Web Service TestingStructured Functional Automated Web Service Testing
Structured Functional Automated Web Service Testing
rdekleijn
 
Servlet
ServletServlet
Servlet
Rajesh Roky
 
Overview of java web services
Overview of java web servicesOverview of java web services
Overview of java web services
Todd Benson (I.T. SPECIALIST and I.T. SECURITY)
 
Web service
Web serviceWeb service
Web service
Vaithiyanathan Govindarajan
 
JAVA SERVLETS acts as a middle layer between a request coming from a web brow...
JAVA SERVLETS acts as a middle layer between a request coming from a web brow...JAVA SERVLETS acts as a middle layer between a request coming from a web brow...
JAVA SERVLETS acts as a middle layer between a request coming from a web brow...
ssuser4f7d71
 
Introduction to Web Services and the cocnept
Introduction to Web Services and the cocneptIntroduction to Web Services and the cocnept
Introduction to Web Services and the cocnept
PaceInfotech
 
webservicearchitecture-150614164814-lva1-app6892.ppt
webservicearchitecture-150614164814-lva1-app6892.pptwebservicearchitecture-150614164814-lva1-app6892.ppt
webservicearchitecture-150614164814-lva1-app6892.ppt
Matrix823409
 
web services-May 25.ppt
web services-May 25.pptweb services-May 25.ppt
web services-May 25.ppt
ShivaangiKrish
 
UNIT - 5.pptx Servlets And Database Connectivity
UNIT - 5.pptx  Servlets And Database ConnectivityUNIT - 5.pptx  Servlets And Database Connectivity
UNIT - 5.pptx Servlets And Database Connectivity
bmit1
 
IT2255 Web Essentials - Unit V Servlets and Database Connectivity
IT2255 Web Essentials - Unit V Servlets and Database ConnectivityIT2255 Web Essentials - Unit V Servlets and Database Connectivity
IT2255 Web Essentials - Unit V Servlets and Database Connectivity
pkaviya
 
Windows communication foundation (part1) jaliya udagedara
Windows communication foundation (part1)    jaliya udagedaraWindows communication foundation (part1)    jaliya udagedara
Windows communication foundation (part1) jaliya udagedara
Jaliya Udagedara
 
Servlet ppt by vikas jagtap
Servlet ppt by vikas jagtapServlet ppt by vikas jagtap
Servlet ppt by vikas jagtap
Vikas Jagtap
 
Structured Functional Automated Web Service Testing
Structured Functional Automated Web Service TestingStructured Functional Automated Web Service Testing
Structured Functional Automated Web Service Testing
rdekleijn
 
JAVA SERVLETS acts as a middle layer between a request coming from a web brow...
JAVA SERVLETS acts as a middle layer between a request coming from a web brow...JAVA SERVLETS acts as a middle layer between a request coming from a web brow...
JAVA SERVLETS acts as a middle layer between a request coming from a web brow...
ssuser4f7d71
 
Ad

Recently uploaded (20)

Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New VersionPixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
saimabibi60507
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
Revolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptxRevolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptx
nidhisingh691197
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New VersionPixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
saimabibi60507
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
Revolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptxRevolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptx
nidhisingh691197
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 

Web services - A Practical Approach

  • 2. What is Web Service? • Services are available in the Web. • Communication between the two system over network. • Software system designed to support interoperable machine-machine interaction over the network (w3c definition). • Real-time Example: – Facebook, Google, Twitter, e-commerce sites, and irctc.
  • 3. Simple Use case Application Server-1 bookTicket() IRCTC- Ticket Service DB Dealer site1 (makemytrip.com) Struts Application Server-2 Dealer site2 (cleartrip.com) .NET/RUBY Application Server-3 cancelTicket() Interface
  • 4. Criteria for interface and request/response • Interface should be platform independent. So what is the format? And why? • Request and response should be language natural. So what is the format? And why?
  • 5. Web Service Terminologies • SOAP – Simple Object Access Protocol. – Envelope for soap request/response. • WSDL – Web Service Description Language. – Interface for SOAP web service • UDDI – Universal Description, Discovery and Integration. – Repository/yellow pages of web services • REST – REpresentational State Transfer. – Architecture style of communication to the services • HTTP – Hypertext Transfer Protocol. – Stateless protocol and used for transport
  • 6. Different Types of Web Services SOAP REST JAX-WS standard JAX-RS standard Required WSDL interface for expos as web service No Interface. It uses HTTP methods (GET,POST,PUT,DELETE) XML should be communication medium for request and response Both XML and JSON used for request and response. Maintain session state Stateless (fire and forget) It uses SOAP protocol to transfer data over HTTP Uses only HTTP Not human readable Human readable Client – server communication heavy weight like BLOB Simple client-server communication and light weight.
  • 7. SOAP vs REST Client ServerData SOAP Standard Huge Data+ = <=> SOAP Client ServerData <=> Sending data as its REST *REST are mostly used in industry
  • 8. Web service Flow-I HTTP HTTP Web Browser Mobile WSDL SOAP REST DB Web services Application Server Not Applicable for Real time and it FALSE one for SOAP.
  • 9. Disadvantage of flow-I • Consuming SOAP services from Java Scripts is tedious and time consuming task. • Some browser will not support build in Jquery functions for SOAP.(Browser compatibility) • Security validation is needed for every service. Because anybody can access any service. • No centralized controlled. • UI change to be needed for every Web service enhancements like URL for version update.
  • 10. Web service Flow-II (Actual) Web Browser Mobile (Toolkit) Java Web service Client DB WSDL SOAP REST DB Web Server/application server Web/Servlet application Web services Application Server HTTP HTTP Client for Web service Client for Web App
  • 11. Advantage of Flow-II • Centralized control. • Only authorized users/vendors can consume web services. • No UI changes needed. • Can use OAUTH/APIGEE for security. • Standard industry model
  • 12. Examples • GeoIP service – http://www.webservicex.net/ws/WSDetails.aspx? WSID=64&CATID=12 • One Time Password(OTP) service – Our own service
  • 13. Web Service - OTP • OTP(One-Time-Password) Generator. – This web service will generate OTP for authentication for more security. – Used in banking site, e-commerce site for every transactions. • Functionality – Generate OTP and send to mail. – Validate OTP. – Get registered user. – Get all registered users.
  • 14. Complete Application architecture (HealthCare Portal) Generate OTP Validate Get All Subscriber Get Subscriber DB WSDL SMTP Mail Server (GMAIL) Application Server (Glassfish) Java .Net Ruby Web Server (Tomcat) Servlets End User SOAP Client JDBC ORM (Hibernate)
  • 15. Setup environments • Required software – JDK 1.6 – IDE (Eclipse/NetBeans) – Application server (GlassFish) – Mail API – Database (postgresql DB) • Technology used – Java – XML – JDBC
  • 16. Service Development package com.soapwebtest.service; import java.util.List; import java.util.Random; import javax.jws.WebMethod; import javax.jws.WebService; import com.soapwebtest.service.model.Subscriber; @WebService public class OTPGenerator { @WebMethod public boolean generateOtp(String email) { return false; } public boolean validate(String mail, String otp) { return false; } public Subscriber getSubscriber(String mail) { return subscriber. } public List<Subscriber> getAllSubscriber() { return List<Subscriber> } }
  • 17. OTP service – WSDL interface
  • 18. Compare WSDL with java Interface package com.testapp.webservice //package name Public interface Calculatore{ //interface name int add(int a, int b); // method name, input and output parameters int multiply(int a, int b); Math add (Math math); //Object }
  • 19. WSDL high level elements -<definition> +<types> //input and output types reference +<message> // inputs and outputs (one for input and one for output) -<portType> -<operation> //method name of webservice <input> // all input and output are message (one for input and one for output) <output> </operation> +<binding> //information about how webservices accepts its input and output via http (literal via http) +<service> //list of ports and each port has address location. port consist of operations -</definition>
  • 20. Name Space and types • Name space represent the package name of service. • Name space should be unique. • Types represents what kind of data type to passed to service input and output over HTTP. • Types will be applicable only for document style binding. Not for RPC.
  • 22. SOAP binding style JAX-RPC Document no XSD XSD document as an input and output easy to read complex to read no validation validates inputs (ex : minoccurs) Note: Document style binding is default SOAP binding represents what kind of communication and data passed to request and response for the service.
  • 25. Service, portType and message • Service consist of ports and each port will have address location URL. • portType has operations of service which exposed on the particular port. • Each operation has input/output which represent as messages.
  • 28. Web service client • One who consume web service is called web service client. • Client needs only WSDL interface. • Different Types of Clients: – Java – .Net – Ruby – Python
  • 29. Steps to create java client • Use wsimport – Wsimport –keep –s <src> <wsdl> • Use Eclipse-IDE – Create java project. – Create Web service client. – Specify the WSDL and Validate. – Generate required classes using Axis.
  • 30. Web Service Client Example package com.soapwebtest.service; import java.rmi.RemoteException; import java.util.Arrays; import java.util.List; public class OTPClient { public static void main(String[] args) throws RemoteException { OTPGenerator service = new OTPGeneratorProxy(); List<Subscriber> ll = Arrays.asList(service.getAllSubscriber()); for (Subscriber subscriber : ll) { System.out.println(subscriber.getEmail()); } } }
  • 31. Complete Application architecture (HealthCare Portal) Generate OTP Validate Get All Subscriber Get Subscriber DB WSDL Mail Server (GMAIL) Application Server (Glassfish) Java .NET Ruby Web Server (Tomcat) Servlets End User SOAP Client JDBC ORM (Hibernate)
  • 32. Developing Web Application and Integrate SOAP Client • Required Software: – Hibernate – Postgresql(Database) – Tomcat (web server) – SOAP Client • Technology – HTML – JSP – Servlets – Java – XML (web.xml)
  • 33. Tomcat Web Server Browser Tomcat Request Response Web Application Web Application Web Application Login Servlet Web.xml / annotation
  • 34. Servlet Terminologies • Http- Stateless protocol • HttpRequest – scope will be only on request • HttpResponse- scope will be only on response • HttpSession – scope on particular browser/user • ServletConfig- Scope on particular servlet • ServletContext – Scope for all servlet and every browser/user.
  • 35. Serialization • Process of storing object state for streaming called serialization. • Every java class should implements serializable interface • What is object state? • Why should we store object state?
  • 38. Syllabus • Web Services: JAX-RPC-Concepts-Writing a Java Web Service-Writing a Java Web Service Client-Describing Web Services: WSDL- Representing Data Types: XML Schema- communicating Object Data: SOAP Related Technologies-Software Installation-Storing Java Objects as Files-Databases and Java Servlets.