SlideShare a Scribd company logo
1 of 16
WEB
SERVICES
Web Service
A Web Service is can be defined by following:
• It is a client-server application or application
component for communication.
• The method of communication between two
devices over the network.
• It is a software system for the interoperable
machine to machine communication.
• It is a collection of standards or protocols for
exchanging information between two devices or
application.
Components of Web Services
XML:
Stands for Extensible Markup Language. It is used to tag the data.
SOAP:
Stands for Simple Object Access Protocol. It is used to transfer the data.
UDDI:
Stands for Universal Description, Discovery and Integration. It is used for listing
what services are available
WSDL:
Stands for Web Services Description Language. It is used for describing the
services available.
Types of Web Services
There are two types of web services.
- SOAP: SOAP stands for Simple Object Access Protocol. SOAP is an XML
based industry standard protocol for designing and developing web
services. Since it’s XML based, it’s platform and language independent.
So our server can be based on JAVA and client can be on .NET, PHP etc.
and vice versa.
- REST: REST is an architectural style for developing web services. It’s
getting popularity recently because it has small learning curve when
compared to SOAP.
Java Web Services
There are two main API's defined by Java for developing web service applications
since JavaEE 6.
1) JAX-WS: JAX-WS stands for Java API for XML Web Services. JAX-WS is XML
based Java API to build web services server and client application. There are
two ways to write JAX-WS application code: by RPC style and Document
style.
2) JAX-RS: Java API for RESTful Web Services (JAX-RS) is the Java API for
creating REST web services. JAX-RS uses annotations to simplify the
development and deployment of web services. There are mainly 2
implementation for creating JAX-RS application: Jersey and RESTeasy.
Creating a Web Service from WSDL
- Begin with WSDL for building a web service either by implementing already defined by
standard or existing instance of service
- The JAX-WS wsimport tool processes the existing WSDL document, either from a local copy
or from a network address/ URL.
- To create a web service from WSDL, create the following source files:
 WSDL File
 Web Service Implementation File
 custom-server.xml
 web.xml
 sun-jaxws.xml
 build.xml
 build.properties
standard files
required for JAX-WS
files are standard in
any Ant build
environment
Creating a Web Service from WSDL…
WSDL File
<wsp:Policy wsu:Id="AddNumbers_policy">
<wsp:ExactlyOne>
<wsp:All>
<wsrm:RMAssertion>
<wsrm:InactivityTimeout Milliseconds="600000"/>
<wsrm:AcknowledgementInterval Milliseconds="200"/>
</wsrm:RMAssertion>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
Creating a Web
Service from
WSDL…
if (number1 < 0 || number2 < 0) {
String message = "Negative number cannot be added!";
String detail = "Numbers: " + number1 + ", " + number2;
AddNumbersFault fault = new AddNumbersFault ();
fault.setMessage (message);
fault.setFaultInfo (detail);
throw new AddNumbersFault_Exception(message, fault);
}
return number1 + number2;
}
public void oneWayInt(int number) {
System.out.println("Service received: " + number);
}
}
Web Service Implementation File
import javax.jws.WebService;
import javax.jws.WebMethod;
@WebService (endpointInterface=
"fromwsdl.server.AddNumbersPortType")
public class AddNumbersImpl{
@WebMethod(action="addNumbers")
public int addNumbers (int number1, int
number2)
throws AddNumbersFault_Exception
{
Publishing a Web service
Prerequisites:
- Register with a registry,
- Launch the Web Services Explorer,
- Add the registry to the Web Services Explorer,
- Create a Web service,
- Deploy the Web service,
- Publish a Business Entity.
Publishing a Web service…
Web services are published using two different publication formats: simple and
advanced.
Publish a business service using the simple option:
• In the Web Services Explorer, select UDDI Main and select the registry to which
the users want to publish the business entity.
• In the Actions pane toolbar, click the Publish icon Picture of the Publish icon.
• Select Service and select the Simple radio button.
• Enter the publish URL, your user ID, password, WSDL URL, service name, and
• Service description in the respective fields.
• Click Go to publish your business entity.
Publishing a Web service…
Publish a Web service using the advanced option:
 In the Actions pane toolbar, click the Publish icon Picture of the Publish icon.
 Select Service and select the Advanced radio button.
 Enter the publish URL, your user ID, password, and WSDL URL in the respective fields.
 Click Get or Find to associate the service with a business entity.
 Click Get or Find to associate a specific service interface with the service.
 Click Add to create service names.
Publishing a Web service…
 Click Add to create service descriptions.
 Click Add to create categories. Enter your service categories. Select a category type
from the drop down list.
 Click Browse to open the Categories pane.
 Navigate through the hierarchical taxonomy and select the appropriate
 classification for your business service, then exit the Categories pane.
 Click Go to publish your business entity
Testing a web service
The loosely coupled nature of web services and non-existence of a User
interface present a challenge to the developers and testers alike.
Following are some of the challenges:
 Scalability and Security,
 Absence of User Interface,
 Distributed across network
 Testing the service
Types of testing
Proof of concept Testing
- Used for making sure that the architecture that we have chosen for our application is a correct one.
Functional testing
- This type of testing validates whether the service performs the intended function correctly, does it handle the
exception conditions gracefully and does it handle the boundary value conditions.
Regression testing
- Regression testing aims to ensure that the web service is still working across builds or releases. This sort of
testing needs to be carried out during each release; hence it is an ideal candidate for automation.
Load testing
- Load or stress testing is a test of the performance of the web service when many simultaneous users are
accessing the system. The response of the web service must be consistent and also its performance must not
degrade with the increase in the number of users.
Types of testing…
Unit testing
- Unit test cases must be written before the application is developed. As and when the application is built, test
cases are applied on the code. Hence the functionality is verified as and when we develop the web service.
Basic testing
- The main aim of this testing is to test whether the web service is accessible and can be invoked properly.
Testing SOA
- As organizations create a web service interface to their systems and overcome security issues, they will be
able to exchange data with business entities such as customers, suppliers and partners in a more uninhibited
and loosely coupled manner
Interoperability testing
- In the loosely coupled environment of a service-oriented architecture, separate sources don't need to know the
details of each other’s working, but they need to have enough common ground for reliably exchanging
messages without error or misunderstanding.
Web Service

More Related Content

Similar to Web Services.pptx

SOA Fundamentals
SOA  FundamentalsSOA  Fundamentals
SOA Fundamentals
abhi1112
 

Similar to Web Services.pptx (20)

Introduction to soapui and webservices
Introduction to soapui  and webservicesIntroduction to soapui  and webservices
Introduction to soapui and webservices
 
Testing soapui
Testing soapuiTesting soapui
Testing soapui
 
Web service architecture
Web service architectureWeb service architecture
Web service architecture
 
Application integration framework & Adaptor ppt
Application integration framework & Adaptor pptApplication integration framework & Adaptor ppt
Application integration framework & Adaptor ppt
 
Testing soapui
Testing soapuiTesting soapui
Testing soapui
 
Web services and SOA [Modified]
Web services and SOA [Modified]Web services and SOA [Modified]
Web services and SOA [Modified]
 
Exposing EJBs As Web Services
Exposing EJBs As Web ServicesExposing EJBs As Web Services
Exposing EJBs As Web Services
 
Microservices - Hitchhiker's guide to cloud native applications
Microservices - Hitchhiker's guide to cloud native applicationsMicroservices - Hitchhiker's guide to cloud native applications
Microservices - Hitchhiker's guide to cloud native applications
 
SOA Fundamentals
SOA  FundamentalsSOA  Fundamentals
SOA Fundamentals
 
C09
C09C09
C09
 
Unit 3-SOA Technologies
Unit 3-SOA TechnologiesUnit 3-SOA Technologies
Unit 3-SOA Technologies
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
 Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1... Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
 
Fundamentals of Web Development For Non-Developers
Fundamentals of Web Development For Non-DevelopersFundamentals of Web Development For Non-Developers
Fundamentals of Web Development For Non-Developers
 
Java web services
Java web servicesJava web services
Java web services
 
web services-May 25.ppt
web services-May 25.pptweb services-May 25.ppt
web services-May 25.ppt
 
Detailed information on webservice by websoles
Detailed information on webservice by websolesDetailed information on webservice by websoles
Detailed information on webservice by websoles
 
Web services Tutorial /Websoles Strategic Digital Solutions
Web services Tutorial /Websoles Strategic Digital SolutionsWeb services Tutorial /Websoles Strategic Digital Solutions
Web services Tutorial /Websoles Strategic Digital Solutions
 
Web services | Websoles
Web services | WebsolesWeb services | Websoles
Web services | Websoles
 
Best Web services tutorial | Websoles Strategic Digital Solutions
Best Web services tutorial | Websoles Strategic Digital SolutionsBest Web services tutorial | Websoles Strategic Digital Solutions
Best Web services tutorial | Websoles Strategic Digital Solutions
 
Continuous Integration and Continuous Delivery to Facilitate Web Service Testing
Continuous Integration and Continuous Delivery to Facilitate Web Service TestingContinuous Integration and Continuous Delivery to Facilitate Web Service Testing
Continuous Integration and Continuous Delivery to Facilitate Web Service Testing
 

Recently uploaded

Maher Othman Interior Design Portfolio..
Maher Othman Interior Design Portfolio..Maher Othman Interior Design Portfolio..
Maher Othman Interior Design Portfolio..
MaherOthman7
 
Final DBMS Manual (2).pdf final lab manual
Final DBMS Manual (2).pdf final lab manualFinal DBMS Manual (2).pdf final lab manual
Final DBMS Manual (2).pdf final lab manual
BalamuruganV28
 
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Lovely Professional University
 

Recently uploaded (20)

Intelligent Agents, A discovery on How A Rational Agent Acts
Intelligent Agents, A discovery on How A Rational Agent ActsIntelligent Agents, A discovery on How A Rational Agent Acts
Intelligent Agents, A discovery on How A Rational Agent Acts
 
Maher Othman Interior Design Portfolio..
Maher Othman Interior Design Portfolio..Maher Othman Interior Design Portfolio..
Maher Othman Interior Design Portfolio..
 
Module-III Varried Flow.pptx GVF Definition, Water Surface Profile Dynamic Eq...
Module-III Varried Flow.pptx GVF Definition, Water Surface Profile Dynamic Eq...Module-III Varried Flow.pptx GVF Definition, Water Surface Profile Dynamic Eq...
Module-III Varried Flow.pptx GVF Definition, Water Surface Profile Dynamic Eq...
 
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas SachpazisSeismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
 
Final DBMS Manual (2).pdf final lab manual
Final DBMS Manual (2).pdf final lab manualFinal DBMS Manual (2).pdf final lab manual
Final DBMS Manual (2).pdf final lab manual
 
Introduction to Artificial Intelligence and History of AI
Introduction to Artificial Intelligence and History of AIIntroduction to Artificial Intelligence and History of AI
Introduction to Artificial Intelligence and History of AI
 
Artificial Intelligence Bayesian Reasoning
Artificial Intelligence Bayesian ReasoningArtificial Intelligence Bayesian Reasoning
Artificial Intelligence Bayesian Reasoning
 
Introduction to Heat Exchangers: Principle, Types and Applications
Introduction to Heat Exchangers: Principle, Types and ApplicationsIntroduction to Heat Exchangers: Principle, Types and Applications
Introduction to Heat Exchangers: Principle, Types and Applications
 
Low rpm Generator for efficient energy harnessing from a two stage wind turbine
Low rpm Generator for efficient energy harnessing from a two stage wind turbineLow rpm Generator for efficient energy harnessing from a two stage wind turbine
Low rpm Generator for efficient energy harnessing from a two stage wind turbine
 
Linux Systems Programming: Semaphores, Shared Memory, and Message Queues
Linux Systems Programming: Semaphores, Shared Memory, and Message QueuesLinux Systems Programming: Semaphores, Shared Memory, and Message Queues
Linux Systems Programming: Semaphores, Shared Memory, and Message Queues
 
Lesson no16 application of Induction Generator in Wind.ppsx
Lesson no16 application of Induction Generator in Wind.ppsxLesson no16 application of Induction Generator in Wind.ppsx
Lesson no16 application of Induction Generator in Wind.ppsx
 
Electrical shop management system project report.pdf
Electrical shop management system project report.pdfElectrical shop management system project report.pdf
Electrical shop management system project report.pdf
 
Research Methodolgy & Intellectual Property Rights Series 2
Research Methodolgy & Intellectual Property Rights Series 2Research Methodolgy & Intellectual Property Rights Series 2
Research Methodolgy & Intellectual Property Rights Series 2
 
Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...
Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...
Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...
 
How to Design and spec harmonic filter.pdf
How to Design and spec harmonic filter.pdfHow to Design and spec harmonic filter.pdf
How to Design and spec harmonic filter.pdf
 
Electrostatic field in a coaxial transmission line
Electrostatic field in a coaxial transmission lineElectrostatic field in a coaxial transmission line
Electrostatic field in a coaxial transmission line
 
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
 
The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...
The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...
The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...
 
Insurance management system project report.pdf
Insurance management system project report.pdfInsurance management system project report.pdf
Insurance management system project report.pdf
 
Quiz application system project report..pdf
Quiz application system project report..pdfQuiz application system project report..pdf
Quiz application system project report..pdf
 

Web Services.pptx

  • 2. Web Service A Web Service is can be defined by following: • It is a client-server application or application component for communication. • The method of communication between two devices over the network. • It is a software system for the interoperable machine to machine communication. • It is a collection of standards or protocols for exchanging information between two devices or application.
  • 3. Components of Web Services XML: Stands for Extensible Markup Language. It is used to tag the data. SOAP: Stands for Simple Object Access Protocol. It is used to transfer the data. UDDI: Stands for Universal Description, Discovery and Integration. It is used for listing what services are available WSDL: Stands for Web Services Description Language. It is used for describing the services available.
  • 4. Types of Web Services There are two types of web services. - SOAP: SOAP stands for Simple Object Access Protocol. SOAP is an XML based industry standard protocol for designing and developing web services. Since it’s XML based, it’s platform and language independent. So our server can be based on JAVA and client can be on .NET, PHP etc. and vice versa. - REST: REST is an architectural style for developing web services. It’s getting popularity recently because it has small learning curve when compared to SOAP.
  • 5. Java Web Services There are two main API's defined by Java for developing web service applications since JavaEE 6. 1) JAX-WS: JAX-WS stands for Java API for XML Web Services. JAX-WS is XML based Java API to build web services server and client application. There are two ways to write JAX-WS application code: by RPC style and Document style. 2) JAX-RS: Java API for RESTful Web Services (JAX-RS) is the Java API for creating REST web services. JAX-RS uses annotations to simplify the development and deployment of web services. There are mainly 2 implementation for creating JAX-RS application: Jersey and RESTeasy.
  • 6. Creating a Web Service from WSDL - Begin with WSDL for building a web service either by implementing already defined by standard or existing instance of service - The JAX-WS wsimport tool processes the existing WSDL document, either from a local copy or from a network address/ URL. - To create a web service from WSDL, create the following source files:  WSDL File  Web Service Implementation File  custom-server.xml  web.xml  sun-jaxws.xml  build.xml  build.properties standard files required for JAX-WS files are standard in any Ant build environment
  • 7. Creating a Web Service from WSDL… WSDL File <wsp:Policy wsu:Id="AddNumbers_policy"> <wsp:ExactlyOne> <wsp:All> <wsrm:RMAssertion> <wsrm:InactivityTimeout Milliseconds="600000"/> <wsrm:AcknowledgementInterval Milliseconds="200"/> </wsrm:RMAssertion> </wsp:All> </wsp:ExactlyOne> </wsp:Policy>
  • 8. Creating a Web Service from WSDL… if (number1 < 0 || number2 < 0) { String message = "Negative number cannot be added!"; String detail = "Numbers: " + number1 + ", " + number2; AddNumbersFault fault = new AddNumbersFault (); fault.setMessage (message); fault.setFaultInfo (detail); throw new AddNumbersFault_Exception(message, fault); } return number1 + number2; } public void oneWayInt(int number) { System.out.println("Service received: " + number); } } Web Service Implementation File import javax.jws.WebService; import javax.jws.WebMethod; @WebService (endpointInterface= "fromwsdl.server.AddNumbersPortType") public class AddNumbersImpl{ @WebMethod(action="addNumbers") public int addNumbers (int number1, int number2) throws AddNumbersFault_Exception {
  • 9. Publishing a Web service Prerequisites: - Register with a registry, - Launch the Web Services Explorer, - Add the registry to the Web Services Explorer, - Create a Web service, - Deploy the Web service, - Publish a Business Entity.
  • 10. Publishing a Web service… Web services are published using two different publication formats: simple and advanced. Publish a business service using the simple option: • In the Web Services Explorer, select UDDI Main and select the registry to which the users want to publish the business entity. • In the Actions pane toolbar, click the Publish icon Picture of the Publish icon. • Select Service and select the Simple radio button. • Enter the publish URL, your user ID, password, WSDL URL, service name, and • Service description in the respective fields. • Click Go to publish your business entity.
  • 11. Publishing a Web service… Publish a Web service using the advanced option:  In the Actions pane toolbar, click the Publish icon Picture of the Publish icon.  Select Service and select the Advanced radio button.  Enter the publish URL, your user ID, password, and WSDL URL in the respective fields.  Click Get or Find to associate the service with a business entity.  Click Get or Find to associate a specific service interface with the service.  Click Add to create service names.
  • 12. Publishing a Web service…  Click Add to create service descriptions.  Click Add to create categories. Enter your service categories. Select a category type from the drop down list.  Click Browse to open the Categories pane.  Navigate through the hierarchical taxonomy and select the appropriate  classification for your business service, then exit the Categories pane.  Click Go to publish your business entity
  • 13. Testing a web service The loosely coupled nature of web services and non-existence of a User interface present a challenge to the developers and testers alike. Following are some of the challenges:  Scalability and Security,  Absence of User Interface,  Distributed across network  Testing the service
  • 14. Types of testing Proof of concept Testing - Used for making sure that the architecture that we have chosen for our application is a correct one. Functional testing - This type of testing validates whether the service performs the intended function correctly, does it handle the exception conditions gracefully and does it handle the boundary value conditions. Regression testing - Regression testing aims to ensure that the web service is still working across builds or releases. This sort of testing needs to be carried out during each release; hence it is an ideal candidate for automation. Load testing - Load or stress testing is a test of the performance of the web service when many simultaneous users are accessing the system. The response of the web service must be consistent and also its performance must not degrade with the increase in the number of users.
  • 15. Types of testing… Unit testing - Unit test cases must be written before the application is developed. As and when the application is built, test cases are applied on the code. Hence the functionality is verified as and when we develop the web service. Basic testing - The main aim of this testing is to test whether the web service is accessible and can be invoked properly. Testing SOA - As organizations create a web service interface to their systems and overcome security issues, they will be able to exchange data with business entities such as customers, suppliers and partners in a more uninhibited and loosely coupled manner Interoperability testing - In the loosely coupled environment of a service-oriented architecture, separate sources don't need to know the details of each other’s working, but they need to have enough common ground for reliably exchanging messages without error or misunderstanding.