Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For...

35
Presentation: Other Object Oriented Middlewares

Transcript of Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For...

Page 1: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

Presentation:

Other Object Oriented Middlewares

Page 2: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

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

Page 3: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

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

Page 4: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

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

Page 5: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

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)

Page 6: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

Technologies for SOA

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

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

Page 7: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

Request to HelloWorld.jws

Input parameters type stringInput parameters type string

HTTP Post CallHTTP Post Call

HTTP Host TargetHTTP Host Target

Method nameMethod name

Page 8: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

… and the HTTP Response from Server

HTTP ResponseHTTP Response

Method ResponseMethod Response

Parameter valueParameter valueParameter nameParameter name

Apache Tomcat Server RespondingApache Tomcat Server Responding

Page 9: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

HelloWorld.jws?wsdl

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

Page 10: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

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)

Page 11: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

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

Page 12: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

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)

Page 13: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

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!!!

Page 14: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

Architecture

ServerClient

Stub RegistryInterfaces

Skeleton ActivationInterfaces

RMI Runtime (rmid,rmiregistry)

coded manuallycoded manually

rmic generatedrmic generated rmic generatedrmic generated

bindbindlookuplookup

Page 15: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

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

Page 16: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

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

Page 17: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

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

Page 18: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

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

Page 19: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

.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

Page 20: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

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

Page 21: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

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

Page 22: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

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)

Page 23: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

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

Page 24: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

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

Page 25: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

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

Page 26: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

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

Page 27: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

WCF Architecture

Page 28: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

Bindings

• Many Bindings:

• Interopable• basicHttpBinding• webHttpBinding• wsHttpBinding, wsFederationHttpBinding

• WCF Specific• netTCPBinding• netPeerTcpBinding• netNamedPipeBinding• netMsmqBinding

• MSMQ interop• MsmqlIntegrationBinding

• Extensible (write your own)

Page 29: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

Choose your Binding

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

Page 30: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

Bindings in WCF

Page 31: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

Contracts

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

Page 32: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

Meta Data

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

Page 33: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

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)

Page 34: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

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>

Page 35: Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,

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