WSDL and UML WSDL www.eu-egee.org

advertisement
www.eu-egee.org
WSDL
WSDL and UML
EGEE is a project funded by the European Union under contract IST-2003-508833
UML to WSDL process
user
Client application
Servelet
Use case
interface
Class diagram
WSDL
(interface
Definition)
implementation
Talk title
date
2
Starting with UML
Create a description of requirements
in a use case diagram
Create a description of interactions in
a sequence diagram
Create a description of the application
(methods and attributes/variables) in
a class diagram
Talk title
date
3
Barnes & Noble price client use
case diagram
This is an extremely simple use
case
Talk title
date
4
bnclient class diagram
This is the simplest web service client
Talk title
date
5
Mapping UML - WSDL
Attributes/variables become types
Methods become operations
Classes become portType
Talk title
date
6
bnquote WSDL
<?xml version="1.0"?>
<definitions name="BNQuoteService" targetNamespace="BNQuoteService.wsdl"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="BNQuoteService.wsdl" >
<message name="getPriceRequest">
<part name="isbn" type="xsd:string"/>
</message>
<message name="getPriceResponse">
<part name="return" type="xsd:float"/>
</message>
<portType name="BNQuotePortType">
<operation name="getPrice">
<input message="tns:getPriceRequest" name="getPrice"/>
<output message="tns:getPriceResponse" name="getPriceResponse"/>
</operation>
</portType>
Talk title
date
7
WSDL continued
<binding name="BNQuoteBinding" type="tns:BNQuotePortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="getPrice">
<soap:operation soapAction=""/>
<input name="getPrice">
<soap:body use="encoded" namespace="urn:xmethods-BNPriceCheck"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output name="getPriceResponse">
<soap:body use="encoded" namespace="urn:xmethods-BNPriceCheck"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="BNQuoteService">
<documentation>Returns price of a book at BN.com given an ISBN number</documentation>
<port name="BNQuotePort" binding="tns:BNQuoteBinding">
<soap:address location="http://services.xmethods.net:80/soap/servlet/rpcrouter"/>
</port>
</service>
</definitions>
Talk title
date
8
Mapping WSDL to client
<message name="getPriceResponse">
<part name="return" type="xsd:float"/>
</message>
<message name="getPriceRequest">
<part name="isbn” type="xsd:string"/>
</message>
Talk title
date
<portType name="BNQuotePortType">
<operation name="getPrice">
<input message="tns:getPriceRequest"
name="getPrice"/>
<output message="tns:getPriceResponse"
name="getPriceResponse"/>
</operation>
</portType>
9
Barnes & Noble price example
sequence diagram
This simple example is a prototype for all
web services
Talk title
date
10
Web services and state
Web services are generally described as
stateless.
In practice this means that you cannot
guarantee between interactions that you are
interacting with the same instance of the
servlet.
While web services are, in themselves,
inherently stateless they can be made to
behave in a state-full manner
By using a database back end
Using cookies
………etc
Talk title
date
11
Web services and state 2
One of the reasons that you may be
interacting with different instances of a
servlet lies in the use of web services
factories.
In order to deal with many connections it is
often useful to have a web services factory
create instances for each connection rather
than have a single listening service.
Talk title
date
12
Design considerations with
Web Services
Granularity
Traffic
Talk title
date
13
Granularity
At what level in the design do we
introduce services?
Too low and users are swamped in
irrelevant detail
Too high and they can’t access the details
they need
Talk title
date
14
Example
Inappropriate
Appropriate
Travel agent
Aircraft
Airport flight slots
Maintenance cycle
Aircraft
Airport flight slots
Maintenance cycle
A consideration for both services and operations
Talk title
date
15
Traffic
Business
Yellow pages service
User
Address
Talk title
date
16
Traffic 2: Messaging systems
Depends on the available (dedicated)
bandwidth
Don’t want services where very frequent
calls are required (poss > 1 per sec)
Don’t want services to carry very large
amounts of data regularly
Process locally
Pass encapsulated groups of data
Talk title
date
17
Serialisation
Classes passed over web services are
translated to XML in transport
This means that the object at the
server is not necessarily identical to
the object at the client.
Talk title
date
18
Summary
Attributes/variables become types
Methods become operations
Classes become portType
Appropriate granularity
Awareness of network traffic
Web services objects are serialised as XML
Talk title
date
19
Download