Testing Duplex WCF Services

Steps to test Duplex WCF Services

  1. Add the service (Step #1 Getting started)
  2. Save the generated proxy assembly
    save proxy assembly

    Important : Do not rename the saved dll file!
     
  3. Create a C# class library project
    1. Add a reference to WcfStorm.Plugin.dll (found in the same folder as wcfstorm.exe)
    2. Add a reference to System.Runtime.Serialization
    3. Add a reference to the DLL saved in step 2.

      Callback plugin project references
       
      Important : Always set Copy Local to true for any dll references.
       
    4. Implement the callback interface exposed by the service
    5. Add the [DuplexCallback] attribute to the class in step "d" above.  Compile.

      Sample callback plugin code:   (You can find the Duplex WCF Service in the download link at the bottom)
       
      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Text;
      using WcfStorm.Plugin.Callback;
      using System.Windows.Forms;
       
      namespace TestWcfCallBack_ClientImplementation
      {
          [
      DuplexCallBack(Description = "Implementation of ICallBack")]
          
      public class Class1 : IService1Callback
          {
              #region IService1Callback Members
              
      //This callback will triggered by invoking the SignupForAlert method on the service
              public void AlertClient(string alertMessage)
              {
                  
      MessageBox.Show(alertMessage);
              }
              #endregion
          }
      }

     

  4. Load the compiled DLL (output of step 3) by following these steps.  WCFStorm will then re-load the service from on the proxy assembly (saved in step #2) and load the callback plugin (created in step #3).  If all went well, the dll icon will show up under the Custom folder (see screnshot below)

    Load callback plugin


    Download source code


     

 


Site Map | Printable View | © 2008 - 2024 WCFStorm Solutions

Powered by mojoPortal | XHTML 1.0 | CSS | Design by styleshout