presentation: other object oriented middlewares. outline web services java rmi.net remoting wcf for...

Post on 12-Jan-2016

223 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Presentation:

Other Object Oriented Middlewares

Outline

• Web services• Java RMI• .NET Remoting• WCF

For each technologyCompare: heterogenity (platform, OS, language), feasibility (ease-of-use & access transparency), object model/IDL, encoding, communication protocol, performance, price/openness, supported services

For each technologyCompare: heterogenity (platform, OS, language), feasibility (ease-of-use & access transparency), object model/IDL, encoding, communication protocol, performance, price/openness, supported services

You may need to consult the web & litterature to gain further knowledgeStrongly consider making a table (with room for all the technologies

Web Services Defined

• W3C definition:• [Definition: A Web service is a software system

designed to support interoperable machine-to-machine interaction over a network. It has an interface described in a machine-processable format (specifically WSDL). Other systems interact with the Web service in a manner prescribed by its description using SOAP messages, typically conveyed using HTTP with an XML serialization in conjunction with other Web-related standards.]

• In reality: a very much more cloudy definition

Overview SOAP & Web services

• Simple Object Access Protocol: • A light-weight & ultra heterogenic alternative to

CORBA, DCOM & RMI• Openness in focus• Not meant in the role of large scale, transaction

heavy communication (as CORBA & J2EE)• Limited support for services for transactions,

concurrency, persistence, scalability• Does have Interface Definition Language for

heterogeneity (WSDL)• Fails on several of the dist. system

requirements!• Easy to implement yourself• And many, many frameworks

Service-Oriented Architecture

ClientClientServerServer

RegistryRegistryAbstract Architecture- Web service stackAbstract Architecture- Web service stack

Legacycode onserver

Legacycode onserver

11 22

33

Opening up for doing business (the sharing of services)

Technologies for SOA

SOAP for communicationSOAP for communication WSDL for contract & bindingWSDL for contract & binding

UDDI & WSDL for registration & discoveryUDDI & WSDL for registration & discovery

Request to HelloWorld.jws

Input parameters type stringInput parameters type string

HTTP Post CallHTTP Post Call

HTTP Host TargetHTTP Host Target

Method nameMethod name

… and the HTTP Response from Server

HTTP ResponseHTTP Response

Method ResponseMethod Response

Parameter valueParameter valueParameter nameParameter name

Apache Tomcat Server RespondingApache Tomcat Server Responding

HelloWorld.jws?wsdl

Assignment:Have wedefinedany customtypes?And how dothey look like?

Alternatives to Web servicesbased on SOAP/WSDL

• Hessian (binary Web services)• XML-RPC (more simple, SOAP Origins)• RESTFull Web services (close to HTTP)• JSON (mainly for AJAX )• Burlap (much like XML-RPC but with DTO’s)

Comparision Part 1

• 5 minutes group work (put it into a table)

Compare: heterogenity (platform, OS, language), feasibility (ease-of-use & access transparency), object model/IDL, encoding, communication protocol, performance, price/openness, supported services

Compare: heterogenity (platform, OS, language), feasibility (ease-of-use & access transparency), object model/IDL, encoding, communication protocol, performance, price/openness, supported services

Java RMI

• In Java 1.0 object communication confined VM• Remote Method Invocation (RMI) from Java 1.1• Tight OO integration with Java• Work in heterogeneous environment• Designed for inter-Java communicatioin

(UnicastRemoteObject/JRMP )• Limited support for inter-prog. (PortableObject IIOP)

Java RMI features

• Build on Java’s existing object model -> easy• No need for IDL – use Java interfaces• Arguments & return values can be all types

specializing java.io.Serilizable or java.rmi.Remote• Distributed Garbage Collection• BUT NOT IN JME!!!

Architecture

ServerClient

Stub RegistryInterfaces

Skeleton ActivationInterfaces

RMI Runtime (rmid,rmiregistry)

coded manuallycoded manually

rmic generatedrmic generated rmic generatedrmic generated

bindbindlookuplookup

package examples.hello;

import java.rmi.Remote; import java.rmi.RemoteException;

public interface Hello extends Remote {String sayHello() throws RemoteException;void someOther(String param) throws RemoteException;

}

rmic Compiler

HelloImpl_Stub.class HelloImpl_Skeleton.class

Stub Generation in Java RMI

NOTE: In fact, it is theHelloImpl that is used!NOTE: In fact, it is theHelloImpl that is used!Hello.javaHello.java

Must Extend fromInterface RemoteMust Extend fromInterface Remote

From RMI v. 1.2 no skeleton is generatedFrom RMI v. 1.2 no

skeleton is generated

C++ Compiler, Linker

Server

Client.ccClient.ccServer.ccServer.cc

C++ Compiler, LinkerC++ Compiler, Linker

Client

Team.idlTeam.idl

included ingeneratesreads

IDL-Compiler

Teamcl.hh

Teamcl.cc Teamsv.cc

Teamsv.hh

CORBA Client and Server Implementation

Java compiler - javac

Server

HelloClient.javaHelloClient.javaHelloImpl.javaHelloImpl.java

Java compiler - javacJava compiler - javac

Client

Hello.javaHello.java

included ingeneratesreads

rmic Compiler

RMI Client and Server Implementation

HelloImpl_Stub.classHelloImpl_Stub.class HelloImpl_Skeleton.classHelloImpl_Skeleton.class

Comparision Part 2

• 5 minutes group work (put it into a table)

Compare: heterogenity (platform, OS, language), feasibility (ease-of-use & access transparency), object model/IDL, encoding, communication protocol, performance, price/openness, supported services

Compare: heterogenity (platform, OS, language), feasibility (ease-of-use & access transparency), object model/IDL, encoding, communication protocol, performance, price/openness, supported services

.NET Remoting

• .NET Remoting for intra-business purposes

• Is only heterogeneous across CLS languages

• Not supported by the .NET compact framework

• Relies on either HTTP/SOAP or TCP/Binary protocols,

• May be adapted for any type of protocol

• Is fast when used with TCP/Binary

• Only heterogeneity within .NET runtime

• In many ways very similar to Java RMI in Java 5

Simplified .NET Remoting Architecture

Using the classic Proxy patternUsing the classic Proxy pattern

The Remoting System wraps most of the marshalling/unmarshalling work for you – like CORBAThe Remoting System wraps most of the marshalling/unmarshalling work for you – like CORBA

Channel:

Takes a stream of data and transports it to another computer or process:

Default: TcpChannel & HttpChannel

Channel:

Takes a stream of data and transports it to another computer or process:

Default: TcpChannel & HttpChannel

The Remoting Architecture

Proxy created dynamically by the CLR. Creates a message to the server

Proxy created dynamically by the CLR. Creates a message to the server

Serializes the message into a stream (SOAP or binary)

Serializes the message into a stream (SOAP or binary)Optional extra handlingOptional extra handling

Writes the stream to the wire, e.g. TCP or HTTP

Writes the stream to the wire, e.g. TCP or HTTP

Deserializes the messageDeserializes the message

Developers are free to implement new channels or replace sink elementsDevelopers are free to implement new channels or replace sink elements

All server objects must be of type MarshalByRefObject or an descendant hereof

All server objects must be of type MarshalByRefObject or an descendant hereof

Dispatch to server objectDispatch to server object

Remotable Objects in .NET Remoting

• Marshal-by-reference objects• By-reference – no state is transferred• MarshalByRefObject • Corresponds to CORBA Interface IDL and Java RMI Remote

objects (UnicastRemote objects)• Proxy created

• Marshal-by-value objects• By-value – complete object is serialized and transferred• Implements ISerializable or decorated with Serializable

Attribute [Serializable]• Very similar to Java RMI Serializable objects• Some similarity with CORBA valuetypes (Objects by Value)

The IHelloWorld Interface

using System;

namespace RemotingHelloServer{

// IHelloWorld is the interface for the HelloWorld server class.// It is the interface that is shared across the Internetpublic interface IHelloWorld{

string sayHello(string name); }

}

using System;

namespace RemotingHelloServer{

// IHelloWorld is the interface for the HelloWorld server class.// It is the interface that is shared across the Internetpublic interface IHelloWorld{

string sayHello(string name); }

}

The “IDL” of .NET Remoting – similar to Java RMI The “IDL” of .NET Remoting – similar to Java RMI

Comparision Part 2

• 5 minutes group work (put it into a table)

Compare: heterogenity (platform, OS, language), feasibility (ease-of-use & access transparency), object model/IDL, encoding, communication protocol, performance, price/openness, supported services

Compare: heterogenity (platform, OS, language), feasibility (ease-of-use & access transparency), object model/IDL, encoding, communication protocol, performance, price/openness, supported services

Introducing WCF

• Windows Vista => .NET Framework 3.0• Also for Windows XP and 2003 Server

• Unified Service-Oriented Programming Model

• Replaces / Suplements • .NET Remoting• DCOM• ASP.NET Web services• MSMQ (Queued Messaging) • .NET Enterprise Services

• Protocol Neutrality and Flexibility

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnlong/html/wcfroadmap.asp http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnlong/html/wcfarch.asp http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnlong/html/wcfroadmap.asp http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnlong/html/wcfarch.asp

WCF Basic Concepts

• Remote system (like .NET Remoting) is:• Exchanging Messages

• Using Channels, consisting of

• Encodeders• Transports

• Also called the Channel layer

• On top of this is the Service Model Layer

WCF Architecture

Bindings

• Many Bindings:

• Interopable• basicHttpBinding• webHttpBinding• wsHttpBinding, wsFederationHttpBinding

• WCF Specific• netTCPBinding• netPeerTcpBinding• netNamedPipeBinding• netMsmqBinding

• MSMQ interop• MsmqlIntegrationBinding

• Extensible (write your own)

Choose your Binding

• Before – you had to choose different middlewares• Now – just choose different bindings

Bindings in WCF

Contracts

• Like in ASP.NET – only expose explict annotated operations

Meta Data

• Two ways of sharing contracts• WSDL or Shared Contract DLL

Hosting Services

• Two models supported• Self-hosting: own process (console, winform)

• WAS hosting

• Windows Activation Service• IIS (Supported by IIS7, emulated for IIS6 for

HTTP/S)

Configuration File

<!-- configuration file used by above code --><configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"> <system.serviceModel> <services> <!-- service element references the service type --> <service type="MathService"> <!-- endpoint element defines the ABC's of the endpoint --> <endpoint address="http://localhost/MathService/Ep1" binding="wsHttpBinding" contract="IMath"/> </service> </services> </system.serviceModel></configuration>

<!-- configuration file used by above code --><configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"> <system.serviceModel> <services> <!-- service element references the service type --> <service type="MathService"> <!-- endpoint element defines the ABC's of the endpoint --> <endpoint address="http://localhost/MathService/Ep1" binding="wsHttpBinding" contract="IMath"/> </service> </services> </system.serviceModel></configuration>

Comparision Part 3

• 5 minutes group work (put it into a table)

Compare: heterogenity (platform, OS, language), feasibility (ease-of-use & access transparency), object model/IDL, encoding, communication protocol, performance, price/openness, supported services

Compare: heterogenity (platform, OS, language), feasibility (ease-of-use & access transparency), object model/IDL, encoding, communication protocol, performance, price/openness, supported services

top related