top of page

Digital transformation starts with API and SOAP transformation with Apigee

Introduction

“Digital Transformation” has become one of the most trending buzz words in any business sector these days. It doesn’t matter which sector they are in, how small or large the business is everybody is trying to digitally transform their business these days.

The first dimension is the investment in digital infrastructure in the company to improve customer engagement and internal operations.

The second dimension is the conversion, transformation, of the existing assets into more appropriate ones. In this second dimension we’re going to work today, in the transformation of SOA existing assets into REST APIs.

Use cases

Usage of Apigee Edge policies to manipulate the messages flowing through your API proxies, exposed as REST APIs. Typical use cases are

  • Message conversion: convert messages between formats, such as from XML to JSON.

  • Message generation: set variable values from message content, and create messages from variable values.

  • Reusable routines: use procedural code, such as JavaScript, Java, and Python, to handle messages and data in more complex ways.

Today we will enter into the first use case, the message conversion by the usage of existing Apigee Edge policies.

Converting JSON to XML

You can use “JSON to XML” policy, as it takes your JSON input and converts it into XML.

In the following policy example, the policy takes a JSON-formatted message from the request variable, then replaces the variable value with an XML-formatted message. The input is specified in the <Source> element, while the output is specified in the <OutputVariable> element.

<JSONToXML name="jsontoxml">

<Source>request</Source>

<OutputVariable>request</OutputVariable>

</JSONToXML>

Converting XML to JSON

You can use “XML to JSON” policy, as it takes your XML input message into JSON.

In the following policy example, the policy takes an XML-formatted message from the response variable, then replaces the variable value with a JSON-formatted message. The input is specified in the <Source> element, while the putput is specified in the <OutputVariable> element.

<XMLToJSON name="ConvertToJSON">

<OutputVariable>response</OutputVariable>

<Source>response</Source>

</XMLToJSON>

bottom of page