WCF client questions (recovering after exceptions, async calls, etc)

Topics: CAB & Smart Client Software Factory
Oct 3, 2007 at 10:26 AM
What is best practice to Close or Abort a WCF client that has suffered a CommunicationsException or disconnected or faulted in some other way?

What is best practice to recreate a WCF client for such services and make it available again through DI?

What is best practice for making async calls on WCF clients and marshal back to the UI thread?

What is the best way to "cancel" a call to a client or mark it superseded by a subsequent call so that the results are ignored on return?
Oct 3, 2007 at 4:28 PM
Hi

In the Smart Client Software Factory you have the Disconnected Service Agent Application Block (DSA) which provides management features for running Web services from occasionally connected smart client applications.

With a disconnected service agent, the application can maintain a queue of Web service requests when offline (disconnected) and then replay them when a connection to the server application becomes available. This means that applications can work in a disconnected environment.

There are two distinct features in the Disconnected Service Agent Application Block:

  • It includes a subsystem that allows developers to invoke disconnected Web services using patterns similar to those they are familiar with from using Visual Studio Web Services proxies. However, the disconnected service agent queues requests and keeps track of the asynchronous callbacks that the application expects to receive when the Web service responds. It provides Communicating with Web services (asynchronously with timeout or synchronously), queuing messages, working offline.
  • It includes a dispatcher that determines exactly when to dispatch each call to a Web service, depending on connectivity conditions and pricing policies. When the correct conditions occur, the dispatcher makes the request, using the appropriate credentials and addresses for the endpoint.
I recommend you to read the following topics in the SCSF's documentation
  • Smart Client Software Factory -> Inspecting the Software Factory Assets -> Application Blocks -> The Disconnected Service Agent Application Block
  • Smart Client Software Factory -> Development Activities -> How to: Create a Disconnected Service Agent
  • Smart Client Software Factory -> Development Activities -> How to: Consume a Disconnected Service Agent
  • Smart Client Software Factory -> Development Activities -> How to: Update a Disconnected Service Agent
and also to rewiew the Quickstart Disconnected Service Agent (with CAB) QuickStart. This QuickStart uses a Windows Communication Foundation (WCF) service to retrieve a list of restaurants and menu items.

Please let me know if this helps.

Mariano Converti
http://staff.southworks.net/blogs/mconverti/
Oct 4, 2007 at 6:24 PM
Thanks Mariano. I'll dive into this and see if it meets my needs.