Using JSON (three) in WebSphere Cast Iron to design a JSON-based rest API

Source: Internet
Author: User
Tags json

Brief introduction

The WebSphere cast Iron (later referred to as Cast Iron) is widely used for integration and migration across internal and external applications. In the past, JSON was widely used as a transport type for the REST API because its format was lightweight compared to XML.

In Cast Iron, you can create and expose a JSON based API, an integration process that accepts requests and sends responses in JSON format. The Cast Iron uses XML and XML schemas. Cast Iron introduces two new activities for processing JSON data: Read JSON and Write JSON. These activities are useful in the process of creating a consolidation process that represents the JSON-based API in Cast Iron. This article describes how to create a consolidation process that is exposed as an API that can receive and emit JSON data.

Building a JSON-based API adds two digits to the Cast Iron

In this scenario, you will learn how to expose a REST API that receives a two-digit request by using the Read JSON and Write JSON activity, and sends the sum of the input numbers in the JSON message as a response. The sample request and response JSON message is shown in table 1.

You must build the consolidation process to complete the scenario described above. The consolidation process acts as a JSON-based REST API to add two numbers to the external world, as shown in Figure 1.

Figure 1. Add two digital-API integration process Design

The Receive Input Numbers (receive request) receives a JSON request containing two digits that need to be added. Table 2 shows the steps to complete the check list for the Receive Input Numbers activity.

Convert to XML activity (Read JSON) converts JSON-formatted data to XML:

Configure the Read JSON by completing the following steps. You must use a JSON message to configure the JSON activity. Select the use JSON or XML messages option from the Configure window as the message type, as shown in Figure 2.

Figure 2. Configure Convert to XML activity

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/webkf/script/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.