Web Services 8

13
VIII Call a remoting method. Call a remoting method asynchronously. Use events with remote objects. 1. 2. 3. A ) B ) Use a delegate to invoke a remoting method. 1. Check the state of completion and respond. 2. C ) Wire a Client to listen for remote events. 1. Method Invocations and Event Management with .NET Remoting

Transcript of Web Services 8

Page 1: Web Services 8

VIII

Call a remoting method. Call a remoting method asynchronously.

Use events with remote objects.

1.2.3.

A )

B )Use a delegate to invoke a remoting method. 1.

Check the state of completion and respond. 2.

C )Wire a Client to listen for remote events. 1.

Method Invocations and Event Management with .NET Remoting

Page 2: Web Services 8

ASP.NET Web Services .NET Remoting

Protocol HTTP TCP, HTTP, SMTP & etc

State Management

Stateless EnvironmentStateful(Singleton), Stateless(SingleCall)

Type System Supports the data types defined in the XSD type

system.

Using binary communication, .NET Remoting can provide support for rich

type system

Interoperability

Heterogeneous environments.

Homogenous environment.

Reliability Highly reliable , since it’s always hosted on

IIS.

Can also take advantage of IIS for fault isolation. If IIS is not used, application needs to provide plumbing for ensuring the reliability of the

application.

Extensibility

Provides extensibility by allowing us to intercept the SOAP messages during the serialization and de- serialization stages.

Very extensible by allowing us to customize the different components of

the .NET remoting framework.

Ease-of-Programming

Easy-to-create and deploy.

Complex to program.

Page 3: Web Services 8

A simple 3-tier architecture

Page 4: Web Services 8

An n-tier architecture using ASP.NET

Page 5: Web Services 8

An n-tier architecture using Enterprise Services (COM+)

Page 6: Web Services 8

1)The server must be contacted each time ; when a remote method is called .

Calling Remote Methods

2) The developer cannot know at the time of invocation whether or not the method will complete

successfully.

3) Remoting methods involve network traffic.

Page 7: Web Services 8

Stateless Invocation Using One-Way Calls

• Namespace : System.Runtime.Remoting.Messaging

• Attribute :One-Way

The OneWay attribute can be

used to provide fire and forget

functionality.

Page 8: Web Services 8

Remote Methods -- SynchronousPotential Problems with

Synchronous methods

1) Might end in an ERROR.

2) Might complete successfully , but take a long time to complete.

3) Waiting for each call to complete individually is potentially wasteful.

Page 9: Web Services 8

Delegates

Objects which points towards a function which matches its signature.

Its reference type used to encapsulate a method with a specific signature.

Similar to function pointers in C++.

Page 10: Web Services 8
Page 11: Web Services 8

• By creating a delegate with a matching signature, any method can be invoked by calling the delegate’s BeginInvoke method.

• To use a delegate object to invoke a method, the delegate’s signature must match the signature of any method it will be used to invoke.

• A delegate can be used to invoke different methods, but each method must have a matching return type and a matching parameter list.

More About Delegates

Page 12: Web Services 8

Asynchronous An invocation that does not block processing from occurring (an asynchronous call does not block execution of the program while processing occurs).

SynchronousA way to call a method that happens sequentially, in the order in which the method was called. If your program calls method A and then calls method B, method B is not called until method A returns.

CallbackAn object that is sent to a method that will notify the caller when processing has completed.

One-wayMechanism that allows client-side processing to continue irrespective of anything that happens on the server.

Remote methodA method that processes on a machine different from the one that called it.

Fire and forgetInitiating a call to a method and not retrieving any results back from it, even if the method throws an exception.

Page 13: Web Services 8

Asynchronous Invocation

IAsyncResult object

IsCompleted property