Skip to content

Service Lookup


The Service Lookup samples demonstrate using Client<T> to lookup services by either Name, Interface or Criteria. The Client<T> tab in Neuron Explorer is only used by those who are using the Neuron Client<T> API in a client program. This allows developers to locate the service dynamically to create a service proxy based on the Service Endpoint settings instead of creating a traditional Web Service proxy.


Service Lookup by Name

In the Service Lookup by Name sample, the sender looks up the service details by passing the name of the service endpoint to Neuron:

Client<ICalculator> proxy = new Client<ICalculator>("Calculator");

In this sample, the Service Endpoint is named Calculator and is set in the General tab of the endpoint:

Service Lookup by Interface

In the Service Lookup by Interface sample, the sender looks up the service details by setting the Client<T> type in the client program to the interfaces name:

Client<ICalculator> proxy = new Client<ICalculator>();

Service Lookup by Criteria

In the Service Lookup by Criteria sample, the sender looks up the service details by passing service criteria details when creating the Client<T> proxy. The criterion are set in the Client<T> tab of the Service Endpoint in Neuron Explorer in the Client<T> Search Metadata grid:

They are searched for in the client program using name value pairs stored in a Dictionary object:

Dictionary<string, string> criteria = new Dictionary<string, string>();
criteria.Add("Version", "2");
Client<ICalculator> proxy = new Client<ICalculator>(criteria); 

Running the Sample

Open the Sample

To open this sample, see the topic Using the Neuron Samples and select one of the samples under Service Lookup.

Setup Instructions

Each of these three samples follow the same pattern. Before running any of them, follow these instructions:

  1. In the Visual Studio project that opens, add a reference to Neuron.Esb.dll in the client project.
  2. Build the entire solution.

Run Instructions

  1. Use Visual Studio to start up all projects.
  2. Once the client has found the service on the ESB, press Enter on the client to initiate communication.
  3. As the sample runs, the client sends several messages to the ESB and displays the responses.
Was this article helpful?
Dislike 0
Next: Subscriptions