I want to be able to accept an input of country code, and based on that input, route to one of the three services
I want to be able to add additional endpoints without having to change the code.
For example, if I submit this payload with an input of “EU”, I expect it to route to the second web service on the list above:
Create an XML file called HelloWorldMap.xml with the following contents (using the endpoint, not WSDL). This is essentially an XML Resource which maps the country code to the endpoint.
Create Resource of type XQuery, and browse for and import the XML file (e.g., HelloWorldMap.xml)
This file is the mapping between country code and endpoint.
Create Resource of type Resources from URL and enter one of the WSDLs up top and enter a Resource Name
Create Resource of type Proxy Service, give it a name (e.g., HelloWorldPS), and browse for and import the WSDL Web Service that was just imported in the step above
Create Resource of type Business Service, give it a name (e.g., HelloWorldBS), and browse for and import theWSDL Web Service in the project
In the Request Pipeline, Add Stage then Edit Stage
Add an Assign action
Click on Expression
Click on XQuery Resources
Browse for and select the XML Resource (e.g., HelloWorldMap)
Add 2 more actions, with the expression and variable as follows:
Your stage should now look like this:
Click on your pipeline pair and Add Route > Edit Route > Add an Action > Communication > Routing
Click on Service and choose the business service (e.g., HelloWorldBS) and operation
Under Request Actions, Add an Action > Communication > Routing Options and enter a URI expression as$MyMapResult
Now you are ready to test your service.