Web Services Slides

fizzlargeSecurity

Nov 3, 2013 (3 years and 9 months ago)

67 views

Web services

1

Web services

Implementing a service
-
oriented
architecture

Web services

2

SOA


Service
-
Oriented Architecture


Nodes in a network make resources available to
other participants in the network as services


Accessed in a standardized way


Loosely coupled services


Platform independent


Programming language independent



Web services makes SOA happen!

Web services

3

SOA terms


Service


Business function


Accepts requests, produces responses


Provider


Function which performs a service in response to a request from
a consumer


Consumer


Function which consumes the result of a service supplied by a
provider


Discovery


Ability to identify services


Using a repository / registry


Binding


Relationship between provider and consumer is dynamic


Established at runtime

Web services

4

Web services

The idea


Technology that
allows applications to
communicate


Platform independent


Programming
language independent


Send XML messages


Can use many
transport protocols


Uses open standards


Web services are


Developed by
technical people


Aggregated into
solving business
problems by business
people


Web services

5

Web services standards

Open standards defined by


W3C
http://www.w3.org



OASIS
http://www.oasis
-
open.org



Supported by any major company


Microsoft


Sun Microsystems


IBM


Oracle


and many others

Web services

6

Web services, technologies


SOAP


Simple Object Access Protocol


WSDL


Web Service Description Language


UDDI


Universal Description, Discovery, and Integration


XML


eXtensible Markup Language


Used by all web service technologies

Web services

7

XML


Language to describe data to be
exchanged on the web


And many other things


Programs exchange XML
documents


XML documents are processed by
programs


Mark up language


XML tags structures information


Element


<tag>…</tag>


An element may have many sub
-
elements


Nested elements


An element has exactly 1 super
-
element


Except the root element, which
has 0 super
-
elements

Example XML document

<persons>


<person>


<name>Anders</name>


<city>Roskilde</city>


</person>


<person>


<name>Peter</name>


<city>Sorø</city>


</person>

</persons>

Web services

8

Structure in XML documents


Well
-
formed


All start
-
tags must have
a matching end
-
tag


<person>…</persons>


Tags must be properly
nested


<persons>



<person>…</person>


</persons>


Only 1 outer tag


Called the root element


Valid


Well
-
formed


Conforms to an XML
schema


A set of “grammar
rules”


Specifies which tags
are allowed, etc.

Web services

9

SOAP


XML is fine for data exchange, but it’s not enough


We need distinction between the header and the body of the
message


Like in HTTP


A SOAP message in an XML document consisting of


Envelope (mandatory)


Headers (optional)


Body (mandatory)


Example


http://java.sun.com/developer/technicalArticles/WebServices/soa2/
WSProtocols.html



Attachments (images and other binary content)

Web services

10

SOAP

Simple Object Access Protocol


SOAP messages can be transported using any
transport protocol


HTTP


SMTP


Others


SOAP messages are tunneled through firewalls


SOAP messages can be produced and
consumed using any programming language


Sender and receiver can be written in different
programming language


Sender and receiver need not know what
programming language the other part was written in

Web services

11

WSDL

Web Services Description Language


Clients use a WSDL file to learn how to call a
web service


WSDL file is an XML document describing the
public interface to a web service


Message formats


Operations


Methods which can be called on the web service


Parameters and return types to the methods


Protocol bindings


Protocol used for transportation


Examples


http://java.sun.com/developer/technicalArticles/WebServices/
soa2/WSProtocols.html

Web services

12

UDDI

Universal Description, Discovery, and Integration


An UDDI registry is like a phone book (yellow pages)


Web service producers register


Details of the business providing the service


Informal description of the functionality of the service


Location of the WSDL file


Information allowing users to register for information about updates to
the service


Web service consumers search the registry for useful services


UDDI uses XML for registration


Several organizations run public UDDI registries


IBM


Microsoft


Others


Private UDDI registries


Most UDDI registries are found
inside

companies

Web services

13

Legacy system services


Legacy / existing systems can be re
-
used
by wrapping them as web services.


Existing system can be used inside and
outside the company.



Web services

14

Web service security


Integrity


SOAP messages are not tampered with


Confidentiality


SOAP message can only be seen by intended
recipients


Authentication


Web service can only be called by authenticated
clients


Underlying technologies


Secure Socket Layer (SSL)


And many others

Web services

15

WS
-
BPEL

Web Services Business Process Execution Language


Business processes means calling more
web services in a specific sequence.


BPEL coordinates web services


Web services are components


BPEL defines a sequence (work flow) of calls
to web services

Web services

16

JAX
-
RPC / JAX
-
WS

Java API for XML
-
based RPC


RPC


Remote Procedure Call


Calling a method on a remote object


JAX
-
RPC


Using web services to call remote methods from a Java
program


How it works

1.
Java program invokes a method on a stub

2.
Stub invokes routines in the JAX
-
RPC runtime system (RS)

3.
RS converts the remote method invocation into a SOAP
message

4.
RS transmits the message as an HTTP request


JAX
-
RPC is part of Java Enterprise Edition (J2EE)


JAX
-
WS is the new version of JAX
-
RPC

Web services

17

JAX
-
RPC data types


Primitive types


Works well


As primitive types or wrapper classes


Integer ~ int


Collections


Arrays [ ] work


List, etc. work.


Custom types (your own classes)


Must be XML serializable


No
-
arg constructor


Get and set methods on all properties


Exceptions


Send as SOAP Faults (wrapped)


Can be quite hard to understand on the client side

Web services

18

References

and further reading

Web services in general


Ed Ort

Service
-
Oriented Architecture and Web
Services: Concepts, Technologies, and Tools
,
Sun 2005


http://java.sun.com/developer/technicalArticles/W
ebServices/soa2/WSProtocols.html



Misc. references


http://en.wikipedia.org/wiki/SOAP_(protocol)



http://en.wikipedia.org/wiki/Webservices



http://www.w3.org/2002/ws/



http://www.w3schools.com/webservices/

(ASP.NET)


Martin Kalin

Java Web Services
, O’Reilly
2009


Bill Burke
RESTful Java with JAX
-
RS,
O’Reilly
2009


John Flanders

RESTful .NET
, O’Reilly 2008


Singh et al.

Designing Web Services with the
J2EE 1.4 Platform
, Addison Wesley 2004


Companies


http://www
-
01.ibm.com/software/solutions/soa/


http://www.oracle.com/technologies/soa/index.ht
ml



http://java.sun.com/webservices/


Web services

19

References, technologies


XML


http://en.wikipedia.org/wiki/XML


http://www.w3schools.com/xml/


http://www.w3.org/XML/


SOAP


http://en.wikipedia.org/wiki/SOAP
_(protocol)



http://www.w3.org/2000/xp/Group
/



Englander

Java and SOAP
,
O’Reilly 2002


WSDL


http://en.wikipedia.org/wiki/Web_
Services_Description_Language



http://www.w3.org/2002/ws/desc/


UDDI


http://en.wikipedia.org/wiki/UDDI



http://www.uddi.org/


http://uddi.microsoft.com/



JAX
-
RPC / JAX
-
WS


http://en.wikipedia.org/wiki/JAX
-
RPC



http://en.wikipedia.org/wiki/JAX
-
WS



Web service catalogs


http://www.remotemethods.com/



http://www.webservicex.net/WS/