2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

IBM (i) Bob RPGⅢプログラムをモダナイズ ④RPGをコールするREST APIクライアントを作る

2
Last updated at Posted at 2026-03-04

前々回②で変換したバッチ型RPGをREST API経由で呼び出すクライアントアプリをBobで作ろうと思います。

クライアントのアプリは色々作れる

今回はトラディショナルにAPサーバー上で実行するJavaアプリケーションにしてみました。
前提環境はWAS Liberty Java17ベースです。(テスト用のIBM i と環境を一致させるため)

image.png

Bobプロンプト例
英語で依頼しました

Create a web application program that uses the REST API to call a program that makes a request to the server under the following conditions:
1. Run on WebSphere Liberty running Java 17.
2. Use port 5600 for requests to the server.
3. The URL and query parameters used to call the REST API are as follows:
URL: http://ron.ibm.co.jp:5610/web/services/IPH110BCHp
Path parameters and values
PS1TOKB=01020
PS2NAKJ=27
PS2ADR1=27
PS2ADR2=27
PS2TIKU=01
PS2POST=27
PS2GEND=0
PS2UZAN=0
PS2GAKU=0
PNOTFOND=2

日本語だと

REST APIを使用して以下の条件でサーバーにリクエストするプログラムを呼び出すWebアプリケーションプログラムを作成してください。
1. Java17ベースで稼働するWebSphere Liberty上で実行する
2. サーバーへのリクエストはポート5600を使用
3. REST APIで呼び出すURL、クエリーパラメーターは以下の通り
 URL:http://ron.ibm.co.jp:5610/web/services/IPH110BCHp
 パスパラメーターと値
 PS1TOKB=01020
  PS2NAKJ=27
  PS2ADR1=27
  PS2ADR2=27
  PS2TIKU=01
  PS2POST=27
  PS2GEND=0
  PS2UZAN=0
  PS2GAKU=0
  PNOTFOND=2

本当は得意先番号 PS1TKOBを画面から入力させるアプリケーションにしようかと思ったのですが、MVP(Minimum Viable Product)?じゃないですが最小限の機能確認をしたくて固定パラメーターで呼出しとしました。

Bobが生成したコードを掲載するのは割愛しますが問題無く生成は完了し、下記のようなガイドも作成されました。
image.png

上記のjavaアプリをPC上のLibertyにデプロイして実行した結果例がこちら。
image.png

ちょっとエラーが出ていますが、正しい結果を返したのでいったんはokとします。

5250RPGアプリからAPIアプリへのマイグレ全体概要

①~④でこのような形ができます。
image.png

2
1
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?