arc:script

Version 22.0.8473


arc:script

Version 22.0.8473


arc:script キーワードは、REST メソッドに応答するスクリプトブロックを作成します。

パラメータ

  • method:HTTP メソッド(GET、POST、PUT/PATCH/MERGE、やDELETE)はスクリプトを呼び出すために使われます。複数のメソッドをカンマ区切りリストで指定します。これによりArcScript でREST のようなサービスを作成できます。
  • language:スクリプトをプログラムするために使われたプログラミング言語。例えば、python または js。

アトリビュートの制御

None

以下はGetTransmissionDetails サービスを定義するスクリプトです。このスクリプトはGetTransmissionDetails がPOST メソッドを使ってアクセスされた場合のみ実行されます。インプットパラメータは、HTTP リクエストのボディで定義されます。

<arc:script xmlns:arc="http://arc.cdata.com/ns/ArcScript/2">
  
  <arc:restrict user="admin" role="Administrators"/>
  
  <arc:info title="GetTransmissionDetails" description="アプリケーションのトランスミッションの詳細を取得します。">
    <input name="ConnectorId"          desc="コネクタのid。" required="true"/>
    <input name="MessageId"       desc="メッセージid。" required="true"/>
    <input name="Direction"       desc="トランスミッションの方向。" values="Incoming,Outgoing" required="true"/>
    <output name="LogTimeCreated" desc="ログファルが作成された時刻。"/>
    <output name="LogType"        desc="ログファイルの種類。" />
    <output name="LogFile"        desc="ログファイルの名前。" />
    <output name="LogPath"        desc="ログファイルのパス。" />
  </arc:info>

  <arc:script method="POST">
    <arc:push op="portGetTransmissionDetails" />
  </arc:script>
</arc:script>

次の例は、元々ArcScript で書かれたスクリプトを他の言語(この例ではPython)に変換する言語パラメータの使い方を説明します。こちらが、*.rst ファイルをリストする短いスクリプトです。

<arc:set attr="mask" value="*.rst"/>
<arc:call op="fileListDir">
    <arc:push/>
</arc:call>

こちらが、Python で書かれた同じスクリプトで、言語は言語パラメータで作成されています:

<arc:script language="python">
  input = {"mask":"*.rst"}
  rsb.call("fileListDir",input)
</arc:script>