Upload
rafiq-ahmed
View
760
Download
1
Tags:
Embed Size (px)
DESCRIPTION
Web services for developer
Citation preview
Web Services For Web Services For DeveloperDeveloper
-Rafiq Ahmed
Web Services
Web Service is piece of business logic that Accessible through standard protocol, such as HTTP,SMTP. Platform and language independent.
Core technologies used for Web services XML (Extensible Markup Language) is the markup language
that underlies most of the specifications used for Web services. It's a generic language that can be used to describe any kind of content in a structured way, separated from its presentation to a specific device.
SOAP (Simple Object Access Protocol) is a network, transport, and programming language and platform-neutral protocol that allows a client to call a remote service. The message format is XML.
Core technologies used for Web services WSDL (Web Services Description Language) is an XML-based
interface and implementation description language. It is in order to specify the operations a Web service provides and the parameters and data types of these operations
WSIL (Web Services Inspection Language) is an XML-based specification about how to locate Web services without the necessity of using UDDI. However, WSIL can be also used together with UDDI, that is, it is orthogonal to UDDI and does not replace it.
UDDI (Universal Description, Discovery, and Integration) is both a client-side API and a SOAP-based server implementation that can be used to store and retrieve information on service providers and Web services.
WSDLWSDL
The WSDL document contains the following main elements Types Message Port type Operation Binding Service Port
WSDL Structure
WSDL
The WSDL document contains the following main elements: Types
The types element describes all the data types used between the client and server
<definitions .... >
<types><xsd:schema .... />(0 or more)
</types></definitions>
It’s provide an XML container element to define additional type information in case the XSD type system does not provide sufficient modeling capabilities.
MessagesA message represents one interaction between a servicerequestor and service provider. <definitions .... >
<message name="nmtoken"> (0 or more)<part name="nmtoken" element="qname"(0 or 1) type="qname" (0 or 1)/>(0 or more)
</message></definitions>
The message element describes a one-way message, whether it is a single message request or a single message response.
Port types The portType element combines multiple message elements
to form a complete one-way or round-trip operation.
WSDL supports four basic patterns of operation: One-Way Request-Response Solicit-Response Notification
Bindings The binding element describes the concrete specifics of
how the service will be implemented on the wire. WSDL includes built-in extensions for defining SOAP services, and SOAP-specific information therefore goes here.
SOAP-specific details: soap:binding
Transport- Which Protocol to be use? Style – Data representation style ?
soap:operation soap:body
Use – How to do interpretation of data?
Service definition The service element specifies the location of the services via
port.
Port A port definition describes an individual endpoint by specifying a single address for a binding
WSDL 1.1 and WSDL 2.2
SOAPSOAP
SOAP is a protocol specification for exchanging structured information in the implementation of Web Services in computer networks
Three pillars of SOAPSOAP is an XML-based protocol that consists of three parts
1. Envelope with header and body2. Encoding rules3. Communication styles
SOAP Envelope
An envelope containing zero or more headers and exactly one body
It might contain exceptions to report failures or unexpected conditions
Header tells who and how to deal with the message.
Body tells what has do be done.
SOAP: Encoding rules
•Encodings rules define how data values defined in the application can be translated to and from a protocol format.
• The literal encoding is a simple XML message that does not carry encoding information. Usually, an XML Schema describes the format and data types of the XML message
• The SOAP encoding enables marshalling/unmarshalling of values of data types from the SOAP data model. It contain information in EncodingStyle attribute of SOAP.
Encoding to be used by the SOAP can be specified at deploy time or at runtime.
SOAP: Communication styles
RPC (remote procedure call) messaging is a synchronous invocation of operation returning a result, conceptually similar to other RPCs.
Document messaging Also known as message-oriented style: is a asynchronous invocation of operation returning a result, . The input parameter is any XML document; the response can be anything (or nothing).
RESTful Web ServiceRESTful Web Service
A Brief Introduction to RESTful WS
Representational State Transfer (REST) is a style of software architecture for distributed hypermedia systems such as the World Wide Web.
Also called as “RESTful HTTP” Five key principles are:
Give every “resource” an ID Link things together Use standard methods Resources with multiple representations Communicate statelessly
Give every “resource” an ID ID here is URI - unique global ID. Make URI - Resource-Oriented. Do proper URI design around resource.Bad:http://company1.com/jsp/foo/report.htm?type=sales&date=2009-3Good:http://company1.com/report/sales/2009/month/3
Link things together “Hypermedia as the engine of application state” -
HATEOAS. Concept of hypermedia, or in other words: links. URIs in sufficient context and info.
Use standard methods set of operations supported by the web service using
HTTP methods (e.g., POST, GET, PUT or DELETE). RESTful HTTP approach - HTTP application protocol
Action Verb
Create POST
Retrieve GET
Update PUT
Delete DELETE
For clients to be able to interact with your resources, they should implement the default application protocol (HTTP) correctly, i.e. make use of the standard methods GET, PUT, POST, DELETE. And should return HTTP status code like 200, 404, 500 etc.
Resources with multiple representations. How does a server and client know that , how to deal
with the data it retrieves? Http header : Content-Type and Accept
Communicate statelessly.
Summary ( What I can recall??)
WS-*WSDL < - -> Interface
SOAP < -- > Object
RESTFul WS
Resource < -- > URI
Use Me :: GET – PUT – POST - DELETE
Binding ; Litrel/Encoding
HTTP ;SMTP
THE END