Now that we have a broad understanding of how OExchange works and what its uses are, let’s revisit the steps that we looked at in the section How Does OExchange Work? and see how we can programmatically implement them.
We’ll be looking at both the service provider and publisher implementations. While both sides provide a full overview of the steps, they may not both be required for every implementation—for example, if you’re just consuming OExchange data from a service provider, or if you’re the service provider yourself, providing the information to other publishers.
Let’s start by looking at the service provider implementation.
1. Service provider (target) integrates discovery and publishing tools
If you are using an existing service provider rather than implementing your own, there is no need to build your own OExchange service provider logic.
The service provider’s first step in the OExchange process is to open up an endpoint on its service to which the publisher will forward the user’s browser session via an HTTP GET request, passing through a number of different query string parameters.
This endpoint may look something similar to the following:
The service provider can define its endpoint in any fashion it chooses (depending on factors such as whether the web stack uses file extensions), so it does not need to change its service architecture. This means that the endpoints may look like: