Web Services Report: Implementation, Benefits and Architecture

Verified

Added on  2019/10/18

|10
|2189
|357
Report
AI Summary
This report provides a comprehensive overview of web services, defining them as services accessible over a network using XML or JSON. It emphasizes interoperability, allowing communication between different programming languages and platforms. The report details the benefits of web services, including reusability, usability, ease of integration, and deployment. It then differentiates between REST and SOAP web services, explaining their architectural constraints, operations, and protocols. The report includes a practical example of creating a REST web service using Java, with TopicService.java, Topic.java and TopicController.java. The conclusion highlights security concerns and the evolving nature of web services. References to web service tutorials are also provided.
Document Page
Web services
WEB SERVICE
Student Name:XXXX
Student ID:XXXX
Date:XXXX
1
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Web services
Table of contents
Abstract 3
Introduction 3-4
Reuse the functionality 4
Usability 5
Interoperability 5
Ease of Integration 5
Deploy 5
REST web services 5-6
SOAP web services 6
Body of the report 7-10
Conclusion 11
References 11
2
Document Page
Web services
Abstract:
This report explain the web services, where and when we use web services what are the benefits
of using the web service in our application, It gives an idea of reusing ability of web services,
This report also describes the types of web services and how we use it in our application, and
how web services are interoperable.
Introduction:
Simple meaning of web services “the services which can access over web (Network) are called
the web services.”
Web services access the data in the format of XML, JSON etc.
Web services is a technology where one programming language can communicate with other
programming language for example programming language java can communicate with dot net
programming language this is called interoperability.
We can define the web services in the following ways:
Web services are the client server application which communicates over network.
Web services are used as a system for exchanging the information between two machine or
devices.
A web service is the part of any software which is available over internet and also uses the
stander XML format. XML encode the communication to the web services for example, when a
client wants to use web service they simply invoke it by sending the XML message and get XML
response from web services.
Actually web services is not tied with any programming language or tied with any operating
system.
Web services are the collection of multiple protocols (open) which is used for exchanging the
data between different application (written in different programming language) and also running
on various platforms.
Web services are XML based.XML is used for data representation as well as data transportation
layer in web services.
Web services are loosely coupled, web service can change but it does not compromising the
clients service.
3
Document Page
Web services
In loosely coupled make the web services more manageable and it also allows the integration
between different systems.
Nowadays web services are used everywhere when we interact with any web pages, web services
are involved for example when we send some request to browser and also get the response from
browser via HTML in web page. Web services use similar concept only they send request and
get response from XML, JSON etc. not via HTML.
In general it is used for other applications or the other programs.
Suppose we are creating a websites for showing the weather forecast for all the important cities
in the world. We are not going to each and every city to record the weather of particular city. We
only consume the web services which are already published for weather forecast and get the
weather data for cities, when we consume the web service and get response in the form of XML
or any other web service supporting format, we parse the response data in our desired format and
can show it in or weather forecast websites.
Now we can say it is the way of communication which allow the interoperability between the
different application
According to World Wide Web consortium (W3C)
“Web Services are the message-based design frequently found on the Web and in enterprise
software. The Web of Services is based on technologies such as HTTP, XML, SOAP, WSDL,
SPARQL, and others.”
In a simple language a java developer we can develop a function (web service) and publish it on
internet or the Local Area Network after published the web service any one can consume (use)
the web service, they may be a .NET developer.
Followings are the benefits of web services:
Reuse the functionality:
Using web services we actually reuse it, we develop one web service and publish it multiple
programming language can use it multiple times.
For example:
Suppose we develop a software for manage the billing system for a grocery company in java
programming language and its working fine, Now we have a similar type of grocery company
and their software is using .NET programming language and they also need a software for
managing the billing system.
In this scenario if we go for development of another billing system for .NET programming
language it will not only take time it take money also.
4
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Web services
Using web services we can easily use billing system (which is developed in java) for similar
grocery shop (which is developed in .NET).
So we can say using the web service actually we reuse the functionality.
Usability:
Web services allow the system to expose the business logic over the internet. And it gives us the
benefit to choose the desired web service. No need to re-invent the business logic again and
develop it.
We only need to develop the client side code in our own application language and consume the
web services which are already published over the web.
Interoperability:
The most important feature of web services is the interoperability. Typically web services work
outside the private network; it is virtually plate form independent.
Ease of Integration:
Web services enable the easier communication within the organization.
Deploy:
Web services deployed over the standard internet technology. So it make the possibility of
successfully running across the world.
Types of Web services:
Two types of web service
1. REST web service
2. SOAP web service
REST web services:
Representational State Transfer web services are built to work best on the web, It has specific
constraints like uniform interface.
In the REST architectural data and the functionality are considered as the resources and it is
accessed using URI (Uniform Resource Identifiers,
The rest constrains the client/server architecture and it is designed to use the stateless
communication protocol,
Rest utilizes the feature of HTTP protocol to provide the API of the web services.
5
Document Page
Web services
Followings are the type of operation of REST web services:
GET:
Retrieve existing records
POST:
Create new records
DELETE:
Remove the records
PUT:
It updates the existing records
Using these request types REST API perform the CRUD (Create, Read, Update and Delete)
operation.
REST web service is state less so it is completely standalone it has no knowledge about the
previous request.
SOAP web services:
Simple Object Access Protocol (SOAP). SOAP defines its own security which is known as WS
security.
SOAP is a communication protocol which is designed to communicate over the network; it can
extend Hypertext transfer protocol for XML messaging.
It also provides the data transportation for the web services, SOAP can be used for broadcast a
message; it is also platform and language independent.
SOAP can be used for variety of systems and it can be delivered through various transport
protocol.
The SOAP envelop contains two parts:
1. Header:
It is the optional part, the header provide the information like authentication, data
encoding and it also provide the information how recipient of the soap should process the
message.
2. Body:
It contains the message and the message can be defined using the WSDL
In general SOAP uses the HTTP protocol but we can use other protocol also, It can be used for
complete document exchange or we use it for a small remote procedure.
6
Document Page
Web services
Now we create an application using rest web services
We are developing the application for choose the topic for example in our web services we
publish multiple topic like JavaScript, java, spring etc.
For developing this application we have to create several classes in java programming language.
We created TopicService.java creating the web services using @Service annotation.
It provides the web services functions like addTopic, deleteTopic, updateTopic etc.
TopicService.java
@Service
public class TopicService {
List<Topic> topics = new ArrayList<>(Arrays.asList(
new Topic("Spring", "Spring Framework", "Spring Framework
Desciption"),
new Topic("java", "Core Java", "Core Java Desciption"),
new Topic("Javascript", "Javascript Framework", "Javascript Framework
Desciption")
));
public List<Topic> getAllTopics() {
return topics;
}
public Topic getTopic(String id) {
return topics.stream().filter(t->t.getId().equals(id)).findFirst().get();
}
public void addTopic(Topic topic) {
System.out.println(">>> "+topic);
topics.add(topic);
}
public void updateTopic(Topic topic, String id) {
for (int i = 0; i < topics.size(); i++) {
Topic t = topics.get(i);
if(t.getId().equals(id)){
topics.set(i, topic);
return;
}
}
}
7
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Web services
public void deleteTopic(String id) {
topics.removeIf(t->t.getId().equals(id));
}
}
For Topic we created POJO class Topic.java
public class Topic {
private String id;
private String name;
private String desciption;
public Topic() {
}
public Topic(String id, String name, String desciption) {
super();
this.id = id;
this.name = name;
this.desciption = desciption;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDesciption() {
return desciption;
}
public void setDesciption(String desciption) {
this.desciption = desciption;
}
}
Then we develop the controller class which can map with web services TopicController.java
8
Document Page
Web services
@RestController
public class TopicController {
@Autowired
private TopicService topicService;
@RequestMapping("/topics")
public List<Topic> getAllTopics(){
return topicService.getAllTopics();
}
@RequestMapping("/topics/{id}")
public Topic getTopic(@PathVariable String id) {
return topicService.getTopic(id);
}
@RequestMapping(method=RequestMethod.POST, value="/topics")
public void addTopic(@RequestBody Topic topic){
topicService.addTopic(topic);
}
@RequestMapping(method=RequestMethod.PUT, value="/topics/{id}")
public void updateTopic(@RequestBody Topic topic, @PathVariable String id){
topicService.updateTopic(topic, id);
}
@RequestMapping(method=RequestMethod.DELETE, value="/topics/{id}")
public void deleteTopic(@PathVariable String id) {
topicService.deleteTopic(id);
}
}
Conclusion
9
Document Page
Web services
Security is the main concern for the web service driven world. We use both type of web services
without real understanding of it.
Web services is any small piece of the software that make it available over the network it uses
XML messaging system, XML is used for encoding the all communication to the web service.
A client invokes a web service only by sending the XML message, the client get corresponding
XML response from the web service.
Web services are not tied with any platform or the programming language.
Web services is making our services live (The services which we want to be live so other can use
our services)
Web services also include the web hosting, Domain name hosting.
Using web services is not very complicated but the same time it’s not much handy and its
benefits are not always obvious,
The basic ideas behind it are great but it is still under development.
References
1. Web Services Tutorial (Retrieve by May 23, 2018) from
https://www.javatpoint.com/web-services-tutorial
2. Java Web Service Tutorial (Retrieve by May 23, 2018) from
https://www.journaldev.com/9191/java-web-services-tutorial
3. XML Web Services (Retrieve by May 23, 2018) from
https://www.w3schools.com/xml/xml_services.asp
4. Web Services Tutorial (Retrieve by May 23, 2018) from
https://www.tutorialspoint.com/webservices/index.htm
5. Web service tutorial for beginners (Retrieve by May 23, 2018) from
https://www.guru99.com/web-services-tutorial.html
10
chevron_up_icon
1 out of 10
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]