You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Web サービス呼び出しの複雜性を表に出ないようにし、再利用を促すために、自身の translate コードを自己完結型の再利用可能パーツに移動させます。

GoogleTranslateWebService という名前の新しい再利用パーツを作成します。

ターゲット・プラットフォームを Windows/IBM i/Linux に設定します。

前回のセクションで作成したコードを再利用可能パーツに移動させます。

Begin_Com Role(*EXTENDS #PRIM_OBJT)
Mthroutine Name(Translate)
   Define_Map For(*RESULT) Class(#PRIM_DC.UnicodeString) Name(#TranslatedText)
   Define_Map For(*INPUT)  Class(#PRIM_DC.UnicodeString) Name(#SourceLanguage)
   Define_Map For(*INPUT)  Class(#PRIM_DC.UnicodeString) Name(#TargetLanguage)
   Define_Map For(*INPUT)  Class(#PRIM_DC.UnicodeString) Name(#SourceText)
   Define_Map For(*OUTPUT) Class(#PRIM_BOLN)             Name(#OK)
   Define_Map For(*OUTPUT) Class(#PRIM_DC.UnicodeString) Name(#ErrorCode)
   Define_Map For(*OUTPUT) Class(#PRIM_DC.UnicodeString) Name(#ErrorMessage)
 
   * 前のセクションで作成したコードをここに挿入
   * ...
   * ...
 
Endroutine


これで、Google 翻訳 Web サービス起動の詳細を理解していなくても、他の開発者が GoogleTranslateWebService を簡単に利用することができます。

次は: チュートリアル 2 - Web サービス経由で Java コードを実行

  • No labels