Skip to content

REST-to-REST Service Routing

Overview

REST stands for Representational State Transfer and is an architectural style for designing networked applications. It is commonly used in conjunction with the HTTP protocol to provide RESTful services. Neuron provides a means to route messages to and from RESTful services allowing communication between them and many other services and applications.

This sample demonstrates how to route RESTful services through Neuron. The sample first demonstrates a Windows Communication Foundation (WCF) client directly calling a WCF service utilizing the WebHttp binding. The second part of the sample demonstrates routing the service call through Neuron.

Running the Sample

Open the Sample

To open this sample, see the topic Using the Neuron Samples and select the REST Client to REST Service sample.

Setup Instructions

Before running this sample, follow these instructions:

  1. In the Visual Studio project that opens, build the entire solution.
Note: This sample does not use the MessageData database. Any errors that occur in the Neuron Event Log relating to the MessageData database should not affect the running of the sample.

Run Instructions

Direct Service Call

  1. In Visual Studio, press F5 to start both the CustomerRESTClient and CustomerRESTService projects.
  2. In the CustomerRESTClient console window, press Enter to start sending messages to Neuron.
  1. As the sample runs, the client sends a message to the service and displays the response.
  1. When the client completes, press <ENTER> in both the client and service consoles to close the applications.

Routed Service Call

  1. In the RESTtoREST Visual Studio project, open the file Program.cs from the CustomerRESTClient project.
  2. Modify the code to comment the URL for a direct service call and uncomment the URL for the routed service call. The final code should look like this:
// Use this URL for a direct service call
       //string baseurl = "http://localhost:8011/Customer";
 
       // Use this URL for a routed service call
       string baseurl = "http://localhost:8001/Customer";
  1. Build the solution.
  2. In Visual Studio, press F5 to start both the CustomerRESTClient and CustomerRESTService projects.
  3. In the CustomerRESTClient console window, press Enter to start sending messages to Neuron.
  4. As the sample runs, the client sends a message to Neuron and displays the response.
  5. When the client completes, press <ENTER> in both the client and service consoles to close the applications.
Was this article helpful?
Dislike 0
Previous: REST-to-SOAP Service Mediation