API Management 10.4 | Using CentraSite | Runtime Governance | Virtual Service Asset Management | Important Considerations when Configuring Virtual Services | Workaround Option 2
 
Workaround Option 2
With this option, you expose the Native Service as one Virtual Service. The Web Service client accesses the service through one address to the Virtual Service for all the possible operations (ping and getXXX ). The Virtual Service then takes care of routing to the correct endpoint for the different operations. This is accomplished by using Content-based routing (instead of Straight Through routing) to determine the operation being called (based on the SOAP request content) and then forwarding the request to the correct endpoint.
* To create a Virtual Service with Content-based routing
1. Create a Virtual Service for the Native Service CustomerRefService and name it VS_CustomerRefService, for example.
2. Configure VS_CustomerRefService and configure its routing protocol as Content-based.
3. On the Routing Protocols tab, construct the routing rule as follows:
a. Click Endpoint (next to the Route To column).
b. In the Search for Endpoint dialog that appears, click Search to search for the Web service endpoint to route the requests to.
c. Select http://... /v4/SystemPort (the Accessing URI that goes to ping operation).
d. To create an XPath expression for the routing rule, click Edit (next to the If True column).
e. In the XPath Editor that appears, click the All Nodes tab, expand the namespace's node, click to highlight the tns:ping element, and click OK
f. Double check that you have something like this in the rule and it is routed to SystemPort:
/soapenv:Envelope/soapenv:Body/tns:pingRequest
4. Set the Default To routing field to the routing address http://... /v4/CustomerRefPort (for CustomerBinding, where getXXX operations are supported).
5. On the Virtual Service's Summary profile, click on the URL for the WSDL (this a copy of the Virtual Service template WSDL, very similar to the original Native Service WSDL), and download or save it to your local file system.
(Make an additional copy of this downloaded WSDL in case you make a mistake in your editing.)
6. Modify the WSDL as follows and then save it:
a. Copy the ping operation from SystemPortType and add into CustomerPortType.
b. Delete the SystemPortType. The objective here is to make one port type only.
c. Update the SystemBinding to also refer to CustomerPortType, since SystemPortType has been deleted.
Note: The soapAction attribute must be specified for the soap:operation element to ensure that Mediator can resolve the operation being invoked for this service.
d. Save the WSDL.
Note: Ensure that your browser or XML tool can read this modified WSDL without any syntax error.
7. Attach the modified WSDL file to the Virtual Service by selecting the Attach WSDL command in the Virtual Service's Actions menu.
8. Deploy the Virtual Service to Mediator.

Copyright © 2015- 2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Innovation Release