Call the Connected Services Framework Components from a Windows Form Application

Connected Services Framework
The steps for calling the CSF components from a Windows Forms application - using the CSF consumer SDK are:

Step1:  Create a client of the SDK class and then register for events of interest.

Step2: Create a message context which contains addressing information, security context, and optional reference property.

Step 3: Create a request payload.

Step 4; Invoke the request via the client.

The following sample code illustrates how to create and consumer an SDK client for the Service Catalog connector:

using Microsoft.Csf.Sdk;
using Microsoft.Csf.Sdk.ServiceCatalog;
using Microsoft.Csf.ServiceCatalog;
using Microsoft.Csf.ServiceCatalog.Messages;

private void CallingMethod()
    // create the client and register for events of interest
    string fromUrl = string.Format("soap.tcp://{0}:9100/clientService", System.Net.Dns.GetHostName());
    string toUrl = string.Format("http://{0}/ServiceCatalog/ServiceCatalogConnector.ashx", System.Net.Dns.GetHostName());
    ServiceCatalogClient serviceCatalogclient = new ServiceCatalogClient();

    // register for Service Catalog's response events
    serviceCatalogclient.RegisterActionEvent(ServiceCatalogClient.Action.ReadServiceResponse,new CsfMessageEventHandler(ServiceCatalogReadServiceEvent));
    serviceCatalogclient.RegisterActionEvent(ServiceCatalogClient.Action.GetServiceUrisResponse ,new CsfMessageEventHandler(ServiceCatalogGetUrisEvent));
    serviceCatalogclient.RegisterEndpoint(new Uri(fromUrl));

    // create message context
    MessageContext context = new MessageContext();
    context.CreateSecurityToken("", "passw0rd!");
    context.From = new AddressInformation(fromUrl);
    context.To = new AddressInformation(toUrl);

    // construct and send the payload
    GetUrisRequest theRequest = new GetUrisRequest();
    theRequest.ServiceUuids = new string [1];
    theRequest.ServiceUuids[0] = "c9fabc6b-0971-4c20-b042-bddda0abf0ef";
    serviceCatalogclient.GetServiceUris(theRequest, context);


 // Sample event handler method
public void ServiceCatalogGetUrisEvent(object sender, CsfMessageEventArgs e)
   MessageBox.Show("Get service uris returned");
    ClientMessage msg = (ClientMessage) e.Message;

    /// process the message....