||
Skip to end of metadata
Go to start of metadata

WCF message publisher is used to publish Windows Communication Foundation (WCF) messages to WSO2 BAM through the BAM Rest API. Follow the below guide to set up WCF Message Publisher for WSO2 BAM.

Prerequisites

Install the following prerequisite software in your machine, before following this guide.

  • Microsoft Visual Studio 
  • Microsoft .NET Framework 4.5 

Configuring WCF Message Publisher 

Follow the steps below to bind WCF Message Publisher to the WCF service application, which will be monitored using WSO2 BAM.

  1. Download the following files from WSO2 BAM Data Publishers.

    • WCFMessageInterceptor.dll
    • WCFMessagePublisher.dll
    • WSO2BamRestApi.dll
  2. Copy the downloaded .dll files to <APPLICATION_HOME>/bin/ directory of the WCF-Service Application.

  3. Add the IISMessageInterceptor.config file with the below configuration to the parent directory of the server, on which you hosted the WCF-Service application. For example, if you hosted the service  in IIS Express, create it in the home directory of IIS Express. (In Windows, by default it is the C:\Program Files (x86)\IIS Express\ directory.

    The IISMessageInterceptor.config file is a normal XML file with the <RestApi> parent element, which contains mandatory sub elements such as host (IP address), port, username and password as shown in the below example.

    <RestApi>
        <host>localhost</host>
        <port>9443</port>
        <username>admin</username>
        <password>admin</password>
    </RestApi>

Binding WCF Message Publisher 

Follow the steps below to bind the WCF Message Publisher to the application using a .NET configuration.

  1. Add the following configuration to the XPath location configuration/system.serviceModel of the App.config/Web.config .NET configuration file, to bind the WCF Message Publisher to the application.

    <protocolMapping>
      <add scheme="http" binding="customBinding"/>
    </protocolMapping>
    <bindings>
      <customBinding>
        <binding>
          <BAMPublisher/>
          <httpTransport/>
        </binding>
      </customBinding>
    </bindings>
    <extensions>
      <bindingElementExtensions>
        <add name="BAMPublisher" type="WCFMessagePublisher.BAMPublisherElement, WCFMessagePublisher"/>
      </bindingElementExtensions>
    </extensions>

    In the above configuration,

    • BAMPublisherElement is the class, which binds the WCF message publisher to the application.
    • WCFMessagePublisher is the name of the assembly (.dll) file.
  2. Call the service by executing the WCF service application.
  3. Start WSO2 BAM server and log in to BAM management console, to check whether data is being published to BAM. 
  4. Use the Cassandra Explorer of WSO2 BAM, to view the data published to Cassandra. Enter the default values as localhost:9160, admin and admin respectively for Connection URL, Username and Password and click Connect.
  5. In Keyspaces, check for the published contents in the BAM_WCF_MESSAGE_TRACE column family, which is located under the EVENT_KS keyspace as follows.
    Keyspace where WCF messages are published
  • No labels