Tuesday, April 13, 2010

WCF 4.0 Routing Service –Multicasting

What is Multicasting?

Multicasting is a communication process that takes place in a network environment. Essentially, a multicast is a message that originates with a single user and is received by multiple end points around the network.

In this blog post I am going to show WCF Routing Service Multicasting.  Here a WCF Client sends a message to routing service that will Route the same message to one or more  WCF Services which is hosted in different bindings and Addresses .For the demo purpose I am going to create Two WCF services( namely one ,two) and self hosting as windows Console application.

image

When we creating Multicast Service the WCF Operation Contract should be defined as One-way. Here is the definition of WCF Service contract which I am going to use here. 

   WCF Service Contract:

image

      Here are the WCF services ,Routing Service and their endpoints definitions.

image

 

WCF Service Implementation:

image
    

          This WCF service listen on port 6001 and binding netTcpBidning.

WCF Service Configuration definitions:

    image

        Create Second WCF service and implementation the same  service contract  with port 6002 and binding as  wsHttpBinding.

        Now we need to create WCF Routing Service and define the configuration.

Routing Service & Configuration:

image

Here I am using the “ISimplexDatagramRouter” as the contract’s interface and it is a simple message router, with a datagram, one-way, semantics and no session support (you can use “ISimplexSessionRouter” for session support, and use “IRequestReplyRouter” for a request/replay routing scenario).

 

image

By default this Routing Service routes the message to all the destination services is recognizes via the routing configuration (see below). This is done because I am using the “MatchAll  message filter.  Here is the list of  message filters that come OOTB with WCF.

image

image

WCF Client:

  image

     To test   First Start WCF service 1 & 2 then Routing service  finally run the client.

image

The Routing service also has the options to define and use a Failover  or backup service. In the case of failure to deliver the message to any of the destination service endpoints. In the next blog we will see how to configure failover options. 

Nandri(Thanks)

SreenivasaRagavan

WCF 4.0 Routing Service – Protocol Bridging

Today Microsoft Released VS.NET 2010 and .NET 4.0 this release also includes WCF 4.0 .  In this release WCF 4.0 has many new features like

  • Simple Configuration
  • Router Service
  • Serialization Enhancements
  • Web Programming
  • Service Discovery
  • Workflow Service.

In this blog post We are going to look at  WCF 4.o Routing Service- Protocol bridging. 

Protocol Bridging is basically transport conversion. for example the below picture shows that the client sends a message to  Routing Service via HTTP protocol once message reaches to Routing Service now routing service will route the same message to backend WCF Service via  TCP/IP protocol. Here we are bridging the protocols between  HTTP and TCP/IP.

image  

For the demo purpose I am going to Create WCF service  and self hosting in Console application.

Now We need to create and host the following Services and client.

  1. WCF Service
  2. Routing Service
  3. WCF Client
  4. Test it

 

1) Creating WCF Service

Fire up VS.NET 2010 make sure that you have selected .NET Framework 4.0 and then select Console application project template  to create a new project name the project as SystemWCFService.

image

Now we need to add the imageAssembly References to the project. 

ServiceContract and operation contract definition

Here I am define three operations contracts .  GetProcess operations will select all process currently running on the server and returns to client.

image

  Service Implementation
image

Service Hosting

image

Service Configuration
image

 

[Note : In WCF 4.0 we can create a service with Simple configuration and we can use protocol mapping to override default endpoints]

 

2) Creating Routing Service

To create Routing service we need to add new console project[.NET Framework 4.0]  and add the following Assembly References to it.

image

Now we need to host our routing service for that we need  ABC  A- Address , B-Binding , C-Contract .   WCF 4.0 comes with the following Routing services Contracts . ISimplexDatagramRouter, ISimplexSessionRouter, IRequestReplyRouter, IDuplexSessionRouter our WCF service message  pattern is Request-Reply so we are going to host our Routing service with IRequestReplyRouter contract.

image

image

Define  FilterTable and Filters .

Now we need to Add the routing table and message filters. These are the settings used by the router service to do the actual routing of the messages

image

 

Now we need to define actual Service Endpoint inside Routing Service configuration file .

image

Here we need to specify  actual WCF service Endpoint and binding. actually routing service do not care about service contract that is why we put  *.

Hosting Routing Service


image

Routing Service listens an Endpoint which client expects.  [i.e http://localhost:9000/SystemRoutingService]

3) Creating WCF client & calling WCF Service

Here we are going to use ChannelFactroy class to create WCF proxy and invoke the Operations. for that we need  WCF Service binding , Endpoint & Contract.

Here Endpoint Address same as Routing Service EP.

image

Testing:

First execute the  WCF service and then Routing Service now run the client . Now  client calls GetProcess  method and receives  result from Actual WCF service via Routing service .

image

Next Blog post I will show how Routing service  Multicasting works.

Nandri(Thanks)

SreenivasaRagavan

Saturday, April 10, 2010

VS.NET 2010 Generating Sequence Diagram

Let us see how we can generate that. To do that I am going to create simple Windows Form Application project.

image

Now add a person class to the project and  using person class create a contact class as shown below.

image

      Now add a Button to the Form and add button Click event handler in that call GetName method of Contact class with Person class Id .
image

Now to generate the sequence diagram for this method just right click inside button_click event  as shown below.

image

     Now VS.NET IDE will generate the following Sequence diagram for the above Button_Click event method. 

image

Nandri(Thanks)

SreenivasaRagavan.

WCF (Windows Communication Foundation) Services Ecosystem

 

image

WCF (Core/SOAP)Services.

Is best for Operation based Services ,building Interoperable services to work with such as Java, channel and host plug-ability,flow transactions, Security (Message, Transport), Support multiple binding such as  HTTP, TCP, MSMQ, PIPE.

image

WCF Data Services :

This is formerly known as  ADO.NET Data Services this is good example for implantation of OData (Open Data protocol ). This kind of services mainly used to expose data model as RESTful services.

image 

WCF WEBHTTP Services :

 Is best when you are exposing operation-centric HTTP services to be deployed at web scale or are building a RESTful service and want full control over the URI/format/protocol.

This is new to .NET 4.0 Framework to build project on this you need to download Project templates from online

First of up VS.NET 2010 go to Tools->Extension Manager->Online Gallery –>WCF and download .

image

WCF RIA Services:

WCF RIA Services is mainly used for building RIA Application example Silverlight.

imageimage

WCF Workflow Services: 

 Is best for long running, durable operations or where the specification and enforcement of operation sequencing is important.

image

Nandri(Thanks)

SreenivasaRagavan.

Friday, April 9, 2010

Open Data Protocol Visualizer

Microsoft Open Data Protocol Visualizer (CTP1) provides a read-only graphical view of the types and relationships provided by a WCF Data Service . WCF Data service uses OData protocol to expose the Data as Restful Service .

Here is the Link where you can download the OData Visualizer.

http://visualstudiogallery.msdn.microsoft.com/en-us/f4ac856a-796e-4d78-9a3d-0120d8137722.

After installing. some time you may need to enable the OData Visualzier. To do go to Tools ( VS.NET 2010 IDE) and select Extension Manger then select OData Visualizer

and Click Enable and restart your VS.NET IDE.

image

In order to use OData Visualizer we need to have WCF Data Service Reference in your project. so let us create our own  WCF Data Service.

First Create ASP.NET Web Application and Add WCF Data Service Template.

image 

Next we need to add or select the Data Source which we are going to Expose as  WCF Data Service. Here I am going to use one of the Free Database from CodePlex site the DB called Chinook.  Next we are going to use ADO.NET Entity Data Model to create our Data model. 

image

    Now Just follow the Wizard and create your Data Model .

image

     Now open .SVC Service file and edit Data entity and set Entity Access Rule as shown below . Here I am exposing all Entity with All Access Rights.

     Here is the list of Access Rights we can set  

 image

image

      Now compile the project and Browse the Service in IE .

image

Now our WCF Data service ready now we need client project to consume. Let us add another Project, here I am going to use console application as client for WCF Data Service for the demo purpose to  show how to use OData Visualzier.

image 

Now we need to add  WCF Data Service Reference to console application client  project.

image 

After adding Service Reference. Now right click on added Service reference and select View in Diagram. 

image

Now click Open Data Protocol Model Browser link on Design surface and drag and drop the Entity to the Design surface or you can right click and select Show in Diagram as well.

image

image[78]

  In OData Model Browser shows all the aspects of the WCF Data service.

image

 

Here is the another view  where you can see only Entity Names and it relations.

image

 

image

Netflix has partnered with Microsoft to create an OData API for the Netflix catalog information. here is the Here is the link for NetFlix OData protocol   http://odata.netflix.com/Catalog/.

Let us add Netflix service to our client project and view with OData Visualizer.

image

 

image

This OData Visualizer help us to understand Entity relations and their different aspects. There is option to export this Diagram as XPS file format as well.

Nandri(Thanks)

SreenivasaRagavan.

Thursday, April 8, 2010

What is IFilters?

IFilters is a plug-in that can be used by Microsoft Index server or Desktop search to search third-party file types. In SharePoint IFilters Plug-in are used to Crawl and Index the third-party Files such as pdf, sas etc.

SharePoint 2010 comes with IFilters preconfigured to allow it to crawl through Microsoft Office file types from all versions of Microsoft Office (.doc, .docx, .xls, .xlsx, .pptx, et cetera.) and several other file types out of the box. A common file type used in many organizations is the Portable Document Format (PDF) file type, which cannot be indexed fully by SharePoint 2010 out of the box. In order to be able to perform search queries on text within a PDF document, a PDF IFilter would need to be installed on the SharePoint server before the search crawlers can crawl through the text of the document.

Here are the list of steps we need to perform .

  1. Add pdf document icon to the 14 hives folder C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\IMAGES
  2. Add file type entry to DOCICON.XML file which is located  @C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\XML
  3. Add the following line to  DOCICON.XML file <Mapping Key="pdf" Value="pdf16.gif"/>
  4. Install the IFilter plug-in for PDF
  5. Reset the IIS.
  6. Now go to

    Central Administration->Manage service applications>Search Service Application: Manage File Types  add pdf file type and Start Full Crawl.

     

    image

    Nandri(Thanks)

    SreenivasaRagavan.