24
Web Services For Web Services For Developer Developer -Rafiq Ahmed

Web services for developer

Embed Size (px)

DESCRIPTION

Web services for developer

Citation preview

Page 1: Web services for developer

Web Services For Web Services For DeveloperDeveloper

-Rafiq Ahmed

Page 2: Web services for developer

Web Services

Web Service is piece of business logic that Accessible through standard protocol, such as HTTP,SMTP. Platform and language independent.

Page 3: Web services for developer

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.

Page 4: Web services for developer

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.

Page 5: Web services for developer

WSDLWSDL

The WSDL document contains the following main elements Types Message Port type Operation Binding Service Port

Page 6: Web services for developer

WSDL Structure

Page 7: Web services for developer

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.

Page 8: Web services for developer

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.

Page 9: Web services for developer

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

Page 10: Web services for developer

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?

Page 11: Web services for developer

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

Page 12: Web services for developer

WSDL 1.1 and WSDL 2.2

Page 13: Web services for developer

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

Page 14: Web services for developer

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.

Page 15: Web services for developer

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.

Page 16: Web services for developer

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).

Page 17: Web services for developer

RESTful Web ServiceRESTful Web Service

Page 18: Web services for developer

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

Page 19: Web services for developer

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.

Page 20: Web services for developer

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

Page 21: Web services for developer

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.

Page 22: Web services for developer

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.

Page 23: Web services for developer

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

Page 24: Web services for developer

THE END