SlideShare une entreprise Scribd logo
1  sur  26
Created By : Nibha Jain
Web Services
Outlines
What is a Web Service?
Why do we need Web Services?
Types
SOAP vs REST
A Simple Example of SOAP Web Service
WSDL
Web Service Client Example
Queries
What is a Web Service ?
A very simple definition is "a service made available over
the web".
The difference between a standard website and a web
service is this: a website is meant for human consumption, while
a web service is meant for machine (or code)
consumption.
Web services are XML-based information exchange systems
that use the Internet for direct application-to-application
interaction. These systems can include programs, objects,
messages, or documents.
Why do we need
Web Services ?
A Web service is a unit of managed code that can be remotely invoked
using HTTP, that is, it can be activated using HTTP requests. So, Web
Services allows you to expose the functionality of your existing code over
the network. Once it is exposed on the network, other application can
use the functionality of your program.
Web Services allows different applications to talk to each other and
share data and services among themselves. Other applications can also
use the services of the web services. For example VB or .NET application
can talk to java web services and vice versa. So, Web services is used to
make the application platform and technology independent.
Reuse already developed(old) functionality into new software.
Types of Web Services
Simple Object Access Protocol (SOAP)
Representational State Transfer(REST)
In Java we have mainly two types of Web Services :
Types Of Web Services
Simple Object Access Protocol (SOAP)
is a standard protocol
specification for message exchange based on XML.
Communication between the web service and client happens using XML messages.
SOAP defines the rules for communication like
what are all the tags that should be used in XML and their meaning.
Example of SOAP Web
Service
System Requirements:
Java (latest version)
Eclipse (For J2EE developer)
Apache Tomcat (latest version)
Steps for creating web services in eclipse
1. Create new dynamic web project and name it "WebServiceDemo".
2.Create a java file with name ShowProfile and write following code.
3.Right click on project->new->web service
4.Click on next.
5.Click on next , wsdl will be created on WebContent folder.
6.Press finish (You are done with the web service , now you have
Wsdl file which is used to consume web service or say creating a
Client for your web service. )
Before creating the client lets see how the wsdl looks like and what is wsdl ?
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://ws.ht.com"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://ws.ht.com" xmlns:intf=""
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
<wsdl:types>
<schema elementFormDefault="qualified"
targetNamespace="http://ws.ht.com" xmlns="http://www.w3.org/2001/XMLSchema">
<element name="getProfile">
<complexType>
<sequence>
<element name="name" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="getProfileResponse">
<complexType>
<sequence>
<element name="getProfileReturn" type="xsd:string"/>
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
<wsdl:message name="getProfileRequest">
<wsdl:part element="impl:getProfile" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getProfileResponse">
<wsdl:part element="impl:getProfileResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="ShowProfile">
<wsdl:operation name="getProfile">
<wsdl:input message="impl:getProfileRequest" name="getProfileRequest">
</wsdl:input>
<wsdl:output message="impl:getProfileResponse" name="getProfileResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
What is wsdl ?
WSDL stands for Web Services Description Language
WSDL is a language for describing how to interface with XML-based services.
WSDL is an integral part of UDDI, an XML-based worldwide business registry.
WSDL is the language that UDDI uses.
WSDL was developed jointly by Microsoft and IBM.
WSDL is pronounced as 'wiz-dull' and spelled out as 'W-S-D-L'
Definition: element must be the root element of all WSDL documents.
It defines the name of the web service,
declares multiple namespaces used throughout the remainder of the document,
and contains all the service elements described here.
Data types: the data types - in the form of XML
schemas or possibly some other mechanism - to be used in the messages
Message: an abstract definition of the data,
in the form of a message presented either as an
entire document or as arguments to be mapped to a method invocation.
Operation: the abstract definition of the operation for a message,
such as naming a method, message queue, or business process,
that will accept and process the message
Port type : an abstract set of operations mapped to one or more end points,
defining the collection of operations for a binding; the collection of operations,
because it is abstract, can be mapped to multiple transports through various bindings.
Binding: the concrete protocol and data formats
for the operations and messages defined for a particular port type.
Port: a combination of a binding and a network address,
providing the target address of the service communication.
Service: a collection of related end points encompassing
the service definitions in the file; the services map the binding to
the port and include any extensibility definitions.
Following are the elements of WSDL document :
The main structure of a WSDL document looks like this:
<definitions>
<types>
definition of types........
</types>
<message>
definition of a message....
</message>
<portType>
<operation>
definition of operation....... <operation>
</portType>
<binding>
definition of a binding....
</binding>
<service>
definition of a service....
</service>
</definitions>
Web Service Client
It can also be referred to as a consumer or requester.
There are many methods/tools/web-tools are available for consuming web service.
Web tools to generate java classes for Android/iPhone for e.g :
l Easywsdl (http://easywsdl.com/)
l Wsdl2code (http://www.wsdl2code.com/pages/home.aspx)
Java Plugins to generate java stub for e.g:
lCXF wsdl2java plugin
lJax-ws
lApache axis2
Step 1 : Open File -> New -> Other... -> Web Services
-> Web ServiceClient
2. Press Next select wsdl.
3.Press Finish.
5. Done !
You can see the generated java classes like this :
Queries
Q. What about security in webservices ?
Ans :When a Web service exposes private-network data to th
outside world, that data travels through four to seven
separate protocol layers (see: TCP/IP or OSI)
thus introducing potential security vulnerabilities.
Implementing security at a higher layer on the protocol s
the application layer,
For instance — generally provides better protection than
implementation at the lower transport layer,
which provides only HTTPS security.
To implement application-layer security,
enable WS-security (a CXF configuration)
on your Web service. WS-security defines
a new SOAP header which is
capable of carrying various security tokens that systems
a Web service caller's identity and privileges.
Q. How to create client from wsdl ?
Ans : There are many tools/web-tools and plugins available to create
client for webservice. Like : Axis2 , JAX-WS
Thank You

Contenu connexe

Tendances

Java Web Services [3/5]: WSDL, WADL and UDDI
Java Web Services [3/5]: WSDL, WADL and UDDIJava Web Services [3/5]: WSDL, WADL and UDDI
Java Web Services [3/5]: WSDL, WADL and UDDIIMC Institute
 
WebServices SOAP WSDL and UDDI
WebServices SOAP WSDL and UDDIWebServices SOAP WSDL and UDDI
WebServices SOAP WSDL and UDDIRajkattamuri
 
Introduction to webservices
Introduction to webservicesIntroduction to webservices
Introduction to webservicesGagandeep Singh
 
Web Service Presentation
Web Service PresentationWeb Service Presentation
Web Service Presentationguest0df6b0
 
Web services
Web servicesWeb services
Web servicesaspnet123
 
Introduction to SOAP/WSDL Web Services and RESTful Web Services
Introduction to SOAP/WSDL Web Services and RESTful Web ServicesIntroduction to SOAP/WSDL Web Services and RESTful Web Services
Introduction to SOAP/WSDL Web Services and RESTful Web Servicesecosio GmbH
 
Cloud computing 22 soap and uddi in services
Cloud computing 22 soap and uddi in servicesCloud computing 22 soap and uddi in services
Cloud computing 22 soap and uddi in servicesVaibhav Khanna
 
Exposing EJBs As Web Services
Exposing EJBs As Web ServicesExposing EJBs As Web Services
Exposing EJBs As Web ServicesSubin Sugunan
 
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
 
Web service assignment
Web service assignmentWeb service assignment
Web service assignmentancymary1996
 
web service technologies
web service technologiesweb service technologies
web service technologiesYash Darak
 
Efficient retrieval of web services using prioritization and clustering
Efficient retrieval of web services using prioritization and clusteringEfficient retrieval of web services using prioritization and clustering
Efficient retrieval of web services using prioritization and clusteringAlexander Decker
 
Java Web Services [1/5]: Introduction to Web Services
Java Web Services [1/5]: Introduction to Web ServicesJava Web Services [1/5]: Introduction to Web Services
Java Web Services [1/5]: Introduction to Web ServicesIMC Institute
 

Tendances (20)

Java Web Services [3/5]: WSDL, WADL and UDDI
Java Web Services [3/5]: WSDL, WADL and UDDIJava Web Services [3/5]: WSDL, WADL and UDDI
Java Web Services [3/5]: WSDL, WADL and UDDI
 
WebServices SOAP WSDL and UDDI
WebServices SOAP WSDL and UDDIWebServices SOAP WSDL and UDDI
WebServices SOAP WSDL and UDDI
 
Introduction to webservices
Introduction to webservicesIntroduction to webservices
Introduction to webservices
 
web technologies Unit 5
 web technologies Unit 5 web technologies Unit 5
web technologies Unit 5
 
Web service architecture
Web service architectureWeb service architecture
Web service architecture
 
Web Service Presentation
Web Service PresentationWeb Service Presentation
Web Service Presentation
 
Web Services
Web ServicesWeb Services
Web Services
 
Sia webservices
Sia webservicesSia webservices
Sia webservices
 
Webservices
WebservicesWebservices
Webservices
 
Web service
Web serviceWeb service
Web service
 
Web services
Web servicesWeb services
Web services
 
Introduction to SOAP/WSDL Web Services and RESTful Web Services
Introduction to SOAP/WSDL Web Services and RESTful Web ServicesIntroduction to SOAP/WSDL Web Services and RESTful Web Services
Introduction to SOAP/WSDL Web Services and RESTful Web Services
 
Cloud computing 22 soap and uddi in services
Cloud computing 22 soap and uddi in servicesCloud computing 22 soap and uddi in services
Cloud computing 22 soap and uddi in services
 
Exposing EJBs As Web Services
Exposing EJBs As Web ServicesExposing EJBs As Web Services
Exposing EJBs As Web Services
 
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)
 
Web service assignment
Web service assignmentWeb service assignment
Web service assignment
 
web service technologies
web service technologiesweb service technologies
web service technologies
 
Web services
Web servicesWeb services
Web services
 
Efficient retrieval of web services using prioritization and clustering
Efficient retrieval of web services using prioritization and clusteringEfficient retrieval of web services using prioritization and clustering
Efficient retrieval of web services using prioritization and clustering
 
Java Web Services [1/5]: Introduction to Web Services
Java Web Services [1/5]: Introduction to Web ServicesJava Web Services [1/5]: Introduction to Web Services
Java Web Services [1/5]: Introduction to Web Services
 

Similaire à Web Services

Web Services in Cloud Computing.pptx
Web Services in Cloud Computing.pptxWeb Services in Cloud Computing.pptx
Web Services in Cloud Computing.pptxssuser403d87
 
Lecture 16 - Web Services
Lecture 16 - Web ServicesLecture 16 - Web Services
Lecture 16 - Web Servicesphanleson
 
Web services Concepts
Web services ConceptsWeb services Concepts
Web services Conceptspasam suresh
 
Dot net training-navimumbai
Dot net training-navimumbaiDot net training-navimumbai
Dot net training-navimumbaivibrantuser
 
Web programming
Web programmingWeb programming
Web programmingsowfi
 
webservices overview
webservices overviewwebservices overview
webservices overviewelliando dias
 
Understanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company indiaUnderstanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company indiaJignesh Aakoliya
 
Web services concepts, protocols and development
Web services concepts, protocols and developmentWeb services concepts, protocols and development
Web services concepts, protocols and developmentishmecse13
 
SynapseIndia dotnet web applications development
SynapseIndia  dotnet web applications developmentSynapseIndia  dotnet web applications development
SynapseIndia dotnet web applications developmentSynapseindiappsdevelopment
 
Web services for developer
Web services for developerWeb services for developer
Web services for developerRafiq Ahmed
 

Similaire à Web Services (20)

Webservices
WebservicesWebservices
Webservices
 
Web services
Web servicesWeb services
Web services
 
Web Programming
Web ProgrammingWeb Programming
Web Programming
 
dotNETfinal.ppt
dotNETfinal.pptdotNETfinal.ppt
dotNETfinal.ppt
 
dotNETfinal.ppt
dotNETfinal.pptdotNETfinal.ppt
dotNETfinal.ppt
 
Unit 5 WEB TECHNOLOGIES
Unit 5 WEB TECHNOLOGIES Unit 5 WEB TECHNOLOGIES
Unit 5 WEB TECHNOLOGIES
 
Xml.ppt
Xml.pptXml.ppt
Xml.ppt
 
Web Services in Cloud Computing.pptx
Web Services in Cloud Computing.pptxWeb Services in Cloud Computing.pptx
Web Services in Cloud Computing.pptx
 
Lecture 16 - Web Services
Lecture 16 - Web ServicesLecture 16 - Web Services
Lecture 16 - Web Services
 
Web services Concepts
Web services ConceptsWeb services Concepts
Web services Concepts
 
Dot net training-navimumbai
Dot net training-navimumbaiDot net training-navimumbai
Dot net training-navimumbai
 
Web programming
Web programmingWeb programming
Web programming
 
webservices overview
webservices overviewwebservices overview
webservices overview
 
Java web services
Java web servicesJava web services
Java web services
 
Understanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company indiaUnderstanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company india
 
Web services concepts, protocols and development
Web services concepts, protocols and developmentWeb services concepts, protocols and development
Web services concepts, protocols and development
 
.NET Tutorial
.NET Tutorial.NET Tutorial
.NET Tutorial
 
Wsdl1
Wsdl1Wsdl1
Wsdl1
 
SynapseIndia dotnet web applications development
SynapseIndia  dotnet web applications developmentSynapseIndia  dotnet web applications development
SynapseIndia dotnet web applications development
 
Web services for developer
Web services for developerWeb services for developer
Web services for developer
 

Dernier

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 

Dernier (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 

Web Services

  • 1. Created By : Nibha Jain Web Services
  • 2. Outlines What is a Web Service? Why do we need Web Services? Types SOAP vs REST A Simple Example of SOAP Web Service WSDL Web Service Client Example Queries
  • 3. What is a Web Service ? A very simple definition is "a service made available over the web". The difference between a standard website and a web service is this: a website is meant for human consumption, while a web service is meant for machine (or code) consumption. Web services are XML-based information exchange systems that use the Internet for direct application-to-application interaction. These systems can include programs, objects, messages, or documents.
  • 4. Why do we need Web Services ? A Web service is a unit of managed code that can be remotely invoked using HTTP, that is, it can be activated using HTTP requests. So, Web Services allows you to expose the functionality of your existing code over the network. Once it is exposed on the network, other application can use the functionality of your program. Web Services allows different applications to talk to each other and share data and services among themselves. Other applications can also use the services of the web services. For example VB or .NET application can talk to java web services and vice versa. So, Web services is used to make the application platform and technology independent. Reuse already developed(old) functionality into new software.
  • 5. Types of Web Services Simple Object Access Protocol (SOAP) Representational State Transfer(REST) In Java we have mainly two types of Web Services :
  • 6. Types Of Web Services Simple Object Access Protocol (SOAP) is a standard protocol specification for message exchange based on XML. Communication between the web service and client happens using XML messages. SOAP defines the rules for communication like what are all the tags that should be used in XML and their meaning.
  • 7. Example of SOAP Web Service System Requirements: Java (latest version) Eclipse (For J2EE developer) Apache Tomcat (latest version)
  • 8. Steps for creating web services in eclipse 1. Create new dynamic web project and name it "WebServiceDemo".
  • 9. 2.Create a java file with name ShowProfile and write following code.
  • 10. 3.Right click on project->new->web service
  • 12. 5.Click on next , wsdl will be created on WebContent folder.
  • 13. 6.Press finish (You are done with the web service , now you have Wsdl file which is used to consume web service or say creating a Client for your web service. ) Before creating the client lets see how the wsdl looks like and what is wsdl ?
  • 14. <?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions targetNamespace="http://ws.ht.com" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://ws.ht.com" xmlns:intf="" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <!--WSDL created by Apache Axis version: 1.4 Built on Apr 22, 2006 (06:55:48 PDT)--> <wsdl:types> <schema elementFormDefault="qualified" targetNamespace="http://ws.ht.com" xmlns="http://www.w3.org/2001/XMLSchema"> <element name="getProfile"> <complexType> <sequence> <element name="name" type="xsd:string"/> </sequence> </complexType> </element> <element name="getProfileResponse"> <complexType> <sequence> <element name="getProfileReturn" type="xsd:string"/> </sequence> </complexType> </element> </schema> </wsdl:types> <wsdl:message name="getProfileRequest"> <wsdl:part element="impl:getProfile" name="parameters"> </wsdl:part> </wsdl:message> <wsdl:message name="getProfileResponse"> <wsdl:part element="impl:getProfileResponse" name="parameters"> </wsdl:part> </wsdl:message> <wsdl:portType name="ShowProfile"> <wsdl:operation name="getProfile"> <wsdl:input message="impl:getProfileRequest" name="getProfileRequest"> </wsdl:input> <wsdl:output message="impl:getProfileResponse" name="getProfileResponse"> </wsdl:output> </wsdl:operation> </wsdl:portType>
  • 15. What is wsdl ? WSDL stands for Web Services Description Language WSDL is a language for describing how to interface with XML-based services. WSDL is an integral part of UDDI, an XML-based worldwide business registry. WSDL is the language that UDDI uses. WSDL was developed jointly by Microsoft and IBM. WSDL is pronounced as 'wiz-dull' and spelled out as 'W-S-D-L'
  • 16. Definition: element must be the root element of all WSDL documents. It defines the name of the web service, declares multiple namespaces used throughout the remainder of the document, and contains all the service elements described here. Data types: the data types - in the form of XML schemas or possibly some other mechanism - to be used in the messages Message: an abstract definition of the data, in the form of a message presented either as an entire document or as arguments to be mapped to a method invocation. Operation: the abstract definition of the operation for a message, such as naming a method, message queue, or business process, that will accept and process the message Port type : an abstract set of operations mapped to one or more end points, defining the collection of operations for a binding; the collection of operations, because it is abstract, can be mapped to multiple transports through various bindings. Binding: the concrete protocol and data formats for the operations and messages defined for a particular port type. Port: a combination of a binding and a network address, providing the target address of the service communication. Service: a collection of related end points encompassing the service definitions in the file; the services map the binding to the port and include any extensibility definitions. Following are the elements of WSDL document :
  • 17. The main structure of a WSDL document looks like this: <definitions> <types> definition of types........ </types> <message> definition of a message.... </message> <portType> <operation> definition of operation....... <operation> </portType> <binding> definition of a binding.... </binding> <service> definition of a service.... </service> </definitions>
  • 18. Web Service Client It can also be referred to as a consumer or requester. There are many methods/tools/web-tools are available for consuming web service. Web tools to generate java classes for Android/iPhone for e.g : l Easywsdl (http://easywsdl.com/) l Wsdl2code (http://www.wsdl2code.com/pages/home.aspx) Java Plugins to generate java stub for e.g: lCXF wsdl2java plugin lJax-ws lApache axis2
  • 19. Step 1 : Open File -> New -> Other... -> Web Services -> Web ServiceClient
  • 20. 2. Press Next select wsdl.
  • 23. You can see the generated java classes like this :
  • 24. Queries Q. What about security in webservices ? Ans :When a Web service exposes private-network data to th outside world, that data travels through four to seven separate protocol layers (see: TCP/IP or OSI) thus introducing potential security vulnerabilities. Implementing security at a higher layer on the protocol s the application layer, For instance — generally provides better protection than implementation at the lower transport layer, which provides only HTTPS security. To implement application-layer security, enable WS-security (a CXF configuration) on your Web service. WS-security defines a new SOAP header which is capable of carrying various security tokens that systems a Web service caller's identity and privileges.
  • 25. Q. How to create client from wsdl ? Ans : There are many tools/web-tools and plugins available to create client for webservice. Like : Axis2 , JAX-WS