संपादित करें

Import SAP OData metadata as an API

APPLIES TO: All API Management tiers

This article describes how to import an OData (Open Data Protocol) service into Azure API Management by using OData metadata. The following example uses SAP Gateway Foundation.

In this article, you learn how to:

  • Retrieve OData metadata from your SAP service
  • Import OData metadata to Azure API Management, either directly or after converting it to an OpenAPI specification
  • Complete API configuration
  • Test the API in the Azure portal

Prerequisites

  • Create an API Management instance.

  • An SAP system and service that's exposed as OData v2 or v4.

  • If your SAP backend uses a self-signed certificate (for testing), you might need to disable the verification of the trust chain for SSL. To do so, configure a backend in your API Management instance:

    1. In the Azure portal, under APIs, select Backends > + Create new backend.
    2. Add a Custom URL that points to the SAP backend service.
    3. Expand the Advanced section, then clear the Validate certificate chain and Validate certificate name checkboxes.

    Note

    In production scenarios, use proper certificates for end-to-end SSL verification.

    Tip

    For the full feature scope of API Management, convert the SAP OData API to OpenAPI specification before registering.

Retrieve OData metadata from your SAP service

Use one of the following methods to retrieve metadata XML from your SAP service. If you plan to convert the metadata XML to an OpenAPI specification, save the file locally.

  • Use the SAP Gateway Client (transaction /IWFND/GW_CLIENT).
  • Make a direct HTTP call to retrieve the XML: http://<OData server URL>:<port>/<path>/$metadata.
  • Use the SAP Business Accelerator Hub if applicable.

Go to your API Management instance

  1. In the Azure portal, search for and select API Management services:

    Screenshot that shows API Management services in the search results.

  2. On the API Management services page, select your API Management instance:

    Screenshot that shows an API Management instance on the API Management services page.

Import an API to API Management

Choose one of the following methods to import your API to API Management:

  • Convert the metadata XML to an OpenAPI specification (recommended).
  • Import the metadata XML as an OData API directly.

Convert OData metadata to OpenAPI JSON

  1. Use the Microsoft converter built on-top of the OASIS open-source tool.

    The following example converts OData v2 XML for the test service epm_ref_apps_prod_man_srv:

    oasis-converter convert epm_ref_apps_prod_man_srv.xml api.json
    

    Note

    For testing with a single XML file, you can use the web-based experience.

  2. Save the openapi-spec.json file locally for import to API Management.

Import OpenAPI specification

  1. In the sidebar menu, in the APIs section, select APIs.

  2. Under Create from definition, select the OpenAPI tile:

    Screenshot that shows the OpenAPI tile.

  3. Choose Select a file, and then select the openapi-spec.json file that you saved locally in a previous step.

  4. Enter API settings. You can set these values when you import the API or configure them later by going to the Settings tab.

    • For the API URL suffix, we recommend using the same URL path as that of the original SAP service.

    • For more information about API settings, see Import and publish your first API tutorial.

  5. Select Create.

You also need to configure authentication to your backend by using an appropriate method for your environment. For examples, see Authentication and authorization.

Note

For information about API import limitations, see API import restrictions and known issues.

Test your API

  1. Navigate to your API Management instance.

  2. In the sidebar menu, select APIs > APIs.

  3. Under All APIs, select your imported API.

  4. Select the Test tab to access the test console.

  5. Select an operation, enter any required values, and then select Send.

    For example, test the GET /$metadata call to verify connectivity to the SAP backend.

  6. View the response. To troubleshoot, trace the call.

  7. When you're done testing, exit the test console.

Production considerations