Directing API calls to specific servers

The application provides the ability to route custom API calls to a particular server or group of servers when these APIs are invoked either remotely or locally.

About this task

To enable this, the server(s) and the protocol must be specified in the yifclient.properties file and in the required APIs. The endpoint is the configured server(s) or a protocol which is used for routing the API calls.

If the XAPI client is configured for multiple URLs, an attempt to connect is made to each server in the group in turn. If the connection works but something else fails, no other server is tried and an exception is thrown.

To direct API calls to a specific server or group of servers, perform the following steps:

Procedure

  1. Specify the endpoint attribute in the yifclient.properties file under the directory INSTALL_DIR/resources/. Modify the yifclient.properties file to include the declaration and usage of endpoint in the following format:
    endpoint.Server_Name.apifactory.protocol=HTTP 
    endpoint.Server_Name.httpapi.url=http://server:port/context_root/
    interop/InteropHttpServlet
    To configure the XAPI client for multiple URLs, define the group as a comma-separated list:
    endpoint.Server_Name.httpapi.url=http://server1:port1/context_root1/
    interop/InteropHttpServlet,http://server2:port2/context_root2/
    interop/InteropHttpServlet... 

    The expression endpoint.Server_Name specifies a server with the name Server_Name. For example, endpoint.INBOXSERVER creates an endpoint with the name INBOXSERVER. You can assign properties to the endpoint name, which takes precedence over any other assigned property.

    The protocol configured for the endpoint is HTTP as specified in the line: endpoint.Server_Name.apifactory.protocol=HTTP

    The settings specified in the second line, endpoint.Server_Name.httpapi.url, are used to connect to the server specified in the endpoint.

  2. Configure a protocol to be used for connecting to the specified server. The protocols such as HTTP, HTTPS, EJB, LOCAL, AUTO are reserved endpoint names. If any of these are configured for the endpoint, the system uses the default connection settings (as applicable) for routing the API calls.
  3. For each API, specify the endpoint to be used:
    yfs.api.apiname.endpoint=ENDPOINT

    The API then calls the server(s) specified in the endpoint attribute.

    Note: If an endpoint is not configured for an API, then it uses the default (local) server or a general one configured for all APIs. The property set at the API level takes precedence over other common properties.