0% found this document useful (0 votes)
72 views25 pages

U6 - M1 - L3 - SOAP, REST Web Services and Technology Trends - Annotated - Tagged

SOAP and REST are two technologies for developing web services. SOAP uses XML-based WSDL and runs on top of HTTP, while REST uses web-accessible URLs. REST is more popular for mobile and web apps due to lower bandwidth needs, while SOAP is used for financial apps needing high security. JSON is now more commonly used than XML for data exchange due to its simplicity.

Uploaded by

Marwan cleancode
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views25 pages

U6 - M1 - L3 - SOAP, REST Web Services and Technology Trends - Annotated - Tagged

SOAP and REST are two technologies for developing web services. SOAP uses XML-based WSDL and runs on top of HTTP, while REST uses web-accessible URLs. REST is more popular for mobile and web apps due to lower bandwidth needs, while SOAP is used for financial apps needing high security. JSON is now more commonly used than XML for data exchange due to its simplicity.

Uploaded by

Marwan cleancode
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

SOAP, REST Web Services and

Technology Trends

Janaka Balasooriya, Ph.D.


Lecturer, Barrett Honors Faculty
Arizona State University
Objectives

SOAP and REST Fundamental Fundamental


Web Services characteristics of Characteristics of
SOC SOC
Discuss the design Compare and Illustrate the
fundamentals and contrast key web implementation and
applicability of SOAP services usage scenarios of
and REST Web technologies. SOAP and REST
Services. Web Services.
SOAP vs. REST

| Two types of web services: SOAP and


REST.
| The main difference is how each type
exposes web service functionality to the
outside world and the communication
protocol used to communicate with the
web services.
SOAP vs. REST: Interface Definition
SOAP vs. REST: Communication
SOAP vs. REST: Messaging Format
SOAP vs. REST: Applications
SOAP vs. REST: Comparison Review

SOAP REST

Interface Definition XML-based WSDL API

Communication SOAP on top of HTTP HTTP methods

Messaging format XML XML, JSON, Plain text, HTML,


etc.

Applications More closely connected systems Mobile and web applications


such as financial services

High security, more More scalable, flexible,


standardized, higher and low bandwidth
bandwidth requirement requirement
Pros / Cons
Anatomy of a SOAP Web Service
WSDL is used to describe Web services, including four critical aspects
of Web services:
| Functionality description of the services in standard taxonomy
| Contract of parameter types and return type of the function (service) calls
| Binding information about the transport protocol to be used (usually
SOAP)
| Address information for locating the specified service

SOAP Web Service Structure


Anatomy of a SOAP Web Service
| WSDL Can be automatically generated:
- Contract of parameter type
- Binding
- Address
| Web services described in WSDL can be searched and matched with
the requirement.
| Web services described in WSDL provide the remote call detail.

SOAP Web Service Structure


Main Components of a WSDL
<definitions>: Root WSDL Element
<types>: What data types will be <?xml version="1.0"?>
transmitted? <definitions
name="StockQuote"
<message>: What messages will (namespaces used)
be transmitted? <types> ... </types>
<messages> … </messages>
<portType>: What operations <portType>
(functions) will be supported? <operation> …
</operation>
<binding>: How will messages be </portType>
transmitted on the wire? What <binding> … </binding>
SOAP-specific details are there? <service>
<port> … </port>
<service>: Where is the service </service>
located? </definitions>

WSDL Template Sample WSDL – XML layout


WSDL Example: Organization of the Code
definitions
<?xml version="1.0"?> service
<definitions
name="StockQuote"
(namespaces used) Port
<types> ... </types> (URL) .
<messages> … Binding .
</messages> (soap) .
<portType>
<operation> …
</operation> PortType
</portType>
<binding> … </binding> Operation
<service>
<port> … </port> Message
</service> in
</definitions> Types
Message
out
Types
Logical Structure of WSDL Documents Elements
definitions, with a name and namespaces
A class used Namespace
service service of classes
Address
port endpoints port
Binding (URL) . (URL) Multiple
binding . binding methods
(soap) . (soap)
Method name portType portType
of class
operation operation
Method message message
Contract

parameter in . in
types .
types types
Method return .
message message
type
out out
types types
Web Services are Wrapped Classes/Objects

Return value in XML/SOAP/HTTP To UDDI server


requester
Service

Remote invocation WSDL Description


in for UDDI
XML/SOAP/HTTP publication
Reactor

Web service interfaces in WSDL


Automatically
Function call Return value
generate the
WSDL file
Functions/Methods written in C#
Service agent
or Java

Manually write the functions/methods in the classes in C# or Java;


each function corresponds to a service.
SOAP Web Service Example: Math SOAP Service

This web service


provides a few math
functionalities that can
be accessed through the
web using the SOAP
protocol.
SOAP Web Service Example: Math SOAP Service

Functionalities provided by
the Math SOAP service
include:
piValue: returns the PI
value when the method is
called; no parameter for
this method
absValue: take an integer
value as a parameter and
returns the absolute value
of the parameter
SOAP Web Service Example: Math SOAP Service

Functionalities provided by
the Math SOAP service
include:

sum: takes two integers


as parameters and returns
the summation of the two

computeStat: takes a
string as parameters,
determines uppercase
letter, lowercase letters
and digits in the string and
return analysis as a
results object
WSDL Interface of the Math SOAP Service
Using Math SOAP Service

Client Code

mathRef.MathServiceClient mc = new
mathRef.MathServiceClient();
int number = -10
int result = mc.absValue(number);

http://
webstrar99.fulton.asu.edu/
page0/MathService.svc?wsdl
Anatomy of a REST Web Service
| Even if the REST services has
a WSDL description, it will be
used by clients to invoke the
web service.
| Web service method
invocations are done as URL-
based method calls.
REST Web Service Invocation
| REST uses the HTTP methods
such as GET, POST, PUT,
DELETE, etc. when
communicating with the
client.

REST API Architecture

Anatomy of a REST API query


REST Web Service Example: Math REST Service

/piValue

/add2? x= & y=

/absValue? x=

/computeStat?str=

REST API Call


XML vs. JSON in new API’s

Source: trends.google.com
Advancement in REST API’s

Source: trends.google.com
Summary

| SOAP and REST are two technologies for developing web


services.
- SOAP uses XML-based WSDL to expose the web service
functionality, whereas REST uses web-accessible URL to
expose functionality as API resources.
- REST is more popular in web based applications and mobile
applications; SOAP is more applicable in areas such as
financial applications where high security and complex objects
are needed.
- SOAP protocol runs on top of HTTP. Thus, SOAP needs a
heavy payload compared to REST.
| XML and JSON are two commonly-used data exchange
formats. Due to the simplicity of representation and
processing requirements, JSON is more popular.

You might also like