Mule Webservices
-
Upload
shahid-shaik -
Category
Technology
-
view
90 -
download
0
Transcript of Mule Webservices
![Page 1: Mule Webservices](https://reader036.fdocuments.in/reader036/viewer/2022083106/586fdce71a28ab18428b6697/html5/thumbnails/1.jpg)
WEBSERVICES BASIC OVERVIEW
![Page 2: Mule Webservices](https://reader036.fdocuments.in/reader036/viewer/2022083106/586fdce71a28ab18428b6697/html5/thumbnails/2.jpg)
Web Services
• A Web service is a method of communication between two electronic devices over the World Wide Web
• In other words, a web service helps to convert your application into a web-based application.
![Page 3: Mule Webservices](https://reader036.fdocuments.in/reader036/viewer/2022083106/586fdce71a28ab18428b6697/html5/thumbnails/3.jpg)
Why web services?
• Your application can publish its function or message to the rest of the world.
![Page 4: Mule Webservices](https://reader036.fdocuments.in/reader036/viewer/2022083106/586fdce71a28ab18428b6697/html5/thumbnails/4.jpg)
Department of Information Science Engg
WEB Services
REST Services SOAP and WSDL
![Page 5: Mule Webservices](https://reader036.fdocuments.in/reader036/viewer/2022083106/586fdce71a28ab18428b6697/html5/thumbnails/5.jpg)
REST Services
• Relying on URIs and HTTP verbs• Usage of 5 big HTTP verbs
POST, HEAD, GET, PUT, DELETENothing more than CRUD concept of the Web
• Ex: Delicious APIsDelicious is a leading social bookmarking serviceVisit: http://www.peej.co.uk/articles/restfully-delicious.html
• Data exchange formatXML, JASON or both
![Page 6: Mule Webservices](https://reader036.fdocuments.in/reader036/viewer/2022083106/586fdce71a28ab18428b6697/html5/thumbnails/6.jpg)
SOAP based services• Simple Object Access Protocol• Exclusively use XML as the data format to exchange info
over HTTP.• A service that needs to be used by another service needs
to specify its usage through a “Service Description”. • In this case, we use WSDL – Web Services Description
Language• Ex: Apache Axis, Apache CXF• SOAP has nothing to do with SOA – Service Oriented
Architecture
![Page 7: Mule Webservices](https://reader036.fdocuments.in/reader036/viewer/2022083106/586fdce71a28ab18428b6697/html5/thumbnails/7.jpg)
continued…...
![Page 8: Mule Webservices](https://reader036.fdocuments.in/reader036/viewer/2022083106/586fdce71a28ab18428b6697/html5/thumbnails/8.jpg)
Continued……. • A service is hosted on a “Discovery Service” in the internet.
• A client which wants to use this service will have to “discover”
this service (similar to RMI) using the ‘Discovery Service’.
• Once the service is “discovered”, the client asks the service
how it should be invoked. The service replies in WSDL format.
• The service is now invoked using SOAP. The client issues a ‘SOAP Request’.
• The service responds with a ‘SOAP Response’, which includes the result.
![Page 9: Mule Webservices](https://reader036.fdocuments.in/reader036/viewer/2022083106/586fdce71a28ab18428b6697/html5/thumbnails/9.jpg)
A SOAP message is an ordinary XML document
containing the following elements:• Envelope - identifies the XML document as a SOAP message
o Header - contains information about the request.
o Body
Message data - contains request and response information
itself.
Fault (optional) - containing errors and status information.
![Page 10: Mule Webservices](https://reader036.fdocuments.in/reader036/viewer/2022083106/586fdce71a28ab18428b6697/html5/thumbnails/10.jpg)
<?xml version="1.0"?><soap:Envelopexmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Body xmlns:m="http://www.example.org/stock"> <m:GetStockPrice> <m:StockName>IBM</m:StockName> </m:GetStockPrice></soap:Body>
</soap:Envelope>
A SOAP request:
![Page 11: Mule Webservices](https://reader036.fdocuments.in/reader036/viewer/2022083106/586fdce71a28ab18428b6697/html5/thumbnails/11.jpg)
<?xml version="1.0"?><soap:Envelopexmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Body xmlns:m="http://www.example.org/stock"> <m:GetStockPriceResponse> <m:Price>34.5</m:Price> </m:GetStockPriceResponse></soap:Body>
</soap:Envelope>
The SOAP response:
![Page 12: Mule Webservices](https://reader036.fdocuments.in/reader036/viewer/2022083106/586fdce71a28ab18428b6697/html5/thumbnails/12.jpg)
Continued……
![Page 13: Mule Webservices](https://reader036.fdocuments.in/reader036/viewer/2022083106/586fdce71a28ab18428b6697/html5/thumbnails/13.jpg)
WSDL
• WSDL stands for Web Services Description Language• It is an XML-based language that is used for
describing the functionality offered by a Web service.• WSDL file contains info about
o How the service can be calledo What parameter it expectso What data structure it returnso Which port the application useso Which protocol the web service uses (like https)
![Page 14: Mule Webservices](https://reader036.fdocuments.in/reader036/viewer/2022083106/586fdce71a28ab18428b6697/html5/thumbnails/14.jpg)
Need for stubs (similar to RMI)
![Page 15: Mule Webservices](https://reader036.fdocuments.in/reader036/viewer/2022083106/586fdce71a28ab18428b6697/html5/thumbnails/15.jpg)
What are stubs?
• A stub is a small program routine that substitutes for a longer program, possibly to be loaded later or that is located remotely.
• The stub accepts the request and then forwards it (through another program) to the remote procedure.
• When that procedure has completed its service, it returns the results or other status to the stub which passes it back to the program that made the request.
![Page 16: Mule Webservices](https://reader036.fdocuments.in/reader036/viewer/2022083106/586fdce71a28ab18428b6697/html5/thumbnails/16.jpg)
![Page 17: Mule Webservices](https://reader036.fdocuments.in/reader036/viewer/2022083106/586fdce71a28ab18428b6697/html5/thumbnails/17.jpg)
Comparision
REST services• Architectural style• Simply calls services via URL
path• Lightweight – not a lot of
extra xml markup• Easy to build – no toolkits
required
SOAP services• XML-based protocol• Invokes services by calling
RPC method• Rigid – type checking,
adheres to a contract• Development tools – WSDL
Soap analyser tool, oXygen XML
![Page 18: Mule Webservices](https://reader036.fdocuments.in/reader036/viewer/2022083106/586fdce71a28ab18428b6697/html5/thumbnails/18.jpg)
THANK YOU