0% found this document useful (0 votes)
10 views18 pages

CS7_SOAP

The document provides an overview of Service Oriented Computing, focusing on SOAP Web Services, including the structure of SOAP messages, WSDL for service description, and UDDI for service discovery. It explains the components of SOAP messages, such as Envelope, Header, Body, and Fault, as well as the role of WSDL in defining web service interfaces. Additionally, it touches on RESTful services and the concept of Contract First Design in API development.

Uploaded by

mohit
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)
10 views18 pages

CS7_SOAP

The document provides an overview of Service Oriented Computing, focusing on SOAP Web Services, including the structure of SOAP messages, WSDL for service description, and UDDI for service discovery. It explains the components of SOAP messages, such as Envelope, Header, Body, and Fault, as well as the role of WSDL in defining web service interfaces. Additionally, it touches on RESTful services and the concept of Contract First Design in API development.

Uploaded by

mohit
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/ 18

Service Oriented Computing

Akshaya Ganesan
Assistant Professor[Off-Campus]
BITS-Pilani
Precap

• REST API DESIGN


• Resource design
• Metadata Design
• Interaction Design
• Identifier Design
Agenda

• SOAP Web Services


• Structure of SOAP messages
• Service Description with Web Services Description Language (WSDL)
• UDDI
SOAP Web Services
SOAP, WSDL, and UDDI are the three foundational standards of web services.
• Web Service is “a software system designed to support interoperable machine-to-machine
interaction over a network”.
SOAP Message

• <?xml version = "1.0"?>


• <SOAP-ENV:Envelope xmlns:SOAP-ENV = "http://www.w3.org/2001/12/soap-envelope"
• SOAP-ENV:encodingStyle = "http://www.w3.org/2001/12/soap-encoding">

• <SOAP-ENV:Header>
• ...
• ...
• </SOAP-ENV:Header>

• <SOAP-ENV:Body>
• ...
• ...
• <SOAP-ENV:Fault>
• ...
• ...
• </SOAP-ENV:Fault>
• ...
• </SOAP-ENV:Body>
• </SOAP_ENV:Envelope>
SOAP Message

• A SOAP message is an ordinary XML document containing the following elements −


• Envelope − Defines the start and the end of the message. It is a mandatory element.
• Header − Contains any optional attributes of the message used in processing the message,
either at an intermediary point or at the ultimate end-point. It is an optional element.
• Body − Contains the XML data comprising the message being sent. It is a mandatory element.
• Fault − An optional Fault element that provides information about errors that occur while
processing the message.

All these elements are declared in the default namespace for the SOAP envelope
− http://www.w3.org/2001/12/soap-envelope and the default namespace for SOAP encoding and
data types is − http://www.w3.org/2001/12/soap-encoding
FAULT

<env:Fault>
<env:Code>
<env:Value>env:Sender</env:Value>
<env:Subcode>
<env:Value> m:InvalidPurchaseOrder </env:Value>
</env:Subcode>
</env:Code>
<env:Reason>
<env:Text xml:lang="en-UK"> Specified product did not exist </env:Text>
</env:Reason>
<env:Detail>
<err:myFaultDetails
xmlns:err="http://www.plastics_supply.com/
faults">
<err:message> Product number contains invalid
characters
</err:message>
<err:errorcode> 129 </err:errorcode>
</err:myFaultDetails>
</env:Detail>
</env:Fault>
SOAP Request Response Message
POST / temp HTTP / 1 . 1 HTTP / 1 . 1 2 0 0 OK
Host: www. socweather . com Content−Type: t e x t / xml ; c h a r s e t ="utf-8"
Content−Type: t e x t / xml ; c h a r s e t ="utf-8" Content−Length: xxx
Content−Length: xxx SOAPAction: "http://www.socweather.com/temp"
SOAPAction: http://www.socweather.com/temp

<!−− The above are HTTP heade r f i e l d s −−> <?xml version ="1.0"?>
<?xml version ="1.0"?> <env:Envelope
<env:Envelope xmlns:env=http://schemas.xmlsoap.org/soap/envelope/
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" e n v : e n c o d i n g S t y l e=
e n v : e n c o d i n g S t y l e= "http://schemas.xmlsoap.org/soap/encoding/"/> "http://schemas.xmlsoap.org/soap/encoding/"/>

<env:Body> <env:Body>
<m:GetTemp <m:GetTempResponse
xmlns:m="http://www.socweather.com/temp.xsd"> xmlns:m="http://www.socweather.com/temp.xsd">
<m:City>Honolulu</m:City> <DegreesCelcius>30</ DegreesCelcius>
<m:When>now</m:When> </m:GetTempResponse>
</m:GetTemp> </env:Body>
</env:Body> </ env:Envelope>
</ env:Envelope>
Document and RPC style
<env:Envelope
xmlns:SOAP="http://www.w3.org/2003/05/soap-envelope">
<env:Header>……..
</env:Header>
<env:Body>
<po:PurchaseOrder orderDate="2004-12-02"
xmlns:m="http://www.plastics_supply.com/POs">
<po:from>
<po:accountName> RightPlastics </po:accountName>
<po:accountNumber> PSC-0343-02 </po:accountNumber>
</po:from>
<po:to>
<po:supplierName> Plastic Supplies Inc.
</po:supplierName>
<po:supplierAddress> Yara Valley Melbourne
</po:supplierAddress>
</po:to>
<po:product>
<po:product-name> injection molder </po:product-name>
<po:product-model> G-100T </po:product-model>
<po:quantity> 2 </po:quantity>
</po:product>
</ po:PurchaseOrder >
</env:Body>
</env:Envelope>
WSDL
Web Service Description Language (WSDL) is a standard used to describe the interface of a web service

• The description includes definitions of data types, input, and output message formats, the
operations provided by the service, network addresses, and protocol bindings.
• WSDL provides a robust, modular, and extensible service description language.
• WSDL description enables reuse
WSDL
Structure of WSDL
http://www.dneonline.com/calculator.asmx?WSDL
• <definitions>
<types>
data type definitions........
</types>
<message>
definition of the data being communicated....
</message>
<portType>
set of operations......
</portType>
<binding>
protocol and data format specification....
</binding>
</definitions>
UDDI
Universal Description, Discovery, and Integration (UDDI)
• Directories collect and organize location and description information and make it available to
clients needing it.
• It defines an online registry
• Service providers, can describe their organization and register their Web services.
• Service requesters and users can then use the registry to locate their needed services.

• UDDI has two sections −


• A registry of all web service's metadata, including a pointer to the WSDL description of a service.
• A set of WSDL port type definitions for manipulating and searching that registry.
UDDI Data Structures
Universal Description, Discovery, and Integration (UDDI)
WADL
WADL stands for Web Application Definition Language
<application xmlns="http://wadl.dev.java.net/2009/02" • RESTful services can also
xmlns:xsd="http://www.w3.org/2001/XMLSchema" make use of a description
xmlns:service="http://localhost:8080/data/balance">
language, called WADL.
<grammer>
<include href="balance.xsd"/> • Unlike WSDL for SOAP
<include href="error.xsd"/> web services, a WADL
</grammer>
<resources base="http://localhost:8080/data/balance/">
description of a RESTful
<resource path="{date}"> service is optional,
<method name="GET">
<request>
<param name="date" type="xsd:string" style="template"/>
</request>
<response status="200">
<representation mediaType="application/xml" element="service:balance"/>
<representation mediaType="application/json" />
</response>
<response status="404">
<representation mediaType="application/xml" element="service:balance"/>
</response>
</method>
</resource>
</resources>
</application>
Contract First Design
With WSDL, Contract first design was popular
• In REST services,
• Design First: The plan is converted to a human and machine-readable contract (APIs), such as
a Swagger document, from which the code is built
• Code First: Based on the business plan, API is directly coded, from which a human or machine-
readable document, such as a Swagger document can be generated
References

1) BOOK Web Services: Principles and Technology By Michael P. Papazoglou.


2) Source of All images: Web Services: Principles and Technology By Michael P. Papazoglou.
Thank You!
In our next session:

You might also like