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

Compare with Current View Page History

« Previous Version 3 Next »

Copy メソッドに InvocationStatus という名前のパラメータを追加します。このパラメータは、前回定義したタイプ ExternalServiceInvocationStatus のオブジェクトを受け取ります。

Define_Map For(*INPUT) Class(#ExternalServiceInvocationStatus) Name(#InvocationStatus) Pass(*BY_REFERENCE) Mandatory(*NULL)


応答オブジェクトからステータスを読み込む次のコードを #Request.DoPost の後に追加します。

 * 要求ステータス取得
If (#InvocationStatus *IsNot *Null)
   #InvocationStatus.FromHttpResponse( #Request.Response )
Endif


(黄色でハイライトされた新規の行の) 調整を加えて、Copy メソッドのソースコードを完成させます。
Mthroutine Name(Copy)


   * パラメータ
   Define_Map For(*INPUT) Class(#PRIM_DC.UnicodeString) Name(#SourcePath)
   Define_Map For(*INPUT) Class(#PRIM_DC.UnicodeString) Name(#TargetPath)
   Define_Map For(*INPUT) Class(#ExternalServiceInvocationStatus) Name(#InvocationStatus) Pass(*BY_REFERENCE) Mandatory(*NULL)


   * 変数
   Define_Com Class(#XPRIM_UriBuilder) Name(#Url)
   Define_Com Class(#XPRIM_HttpRequest) Name(#Request)


   * URL のベース・プロパティ設定
   #COM_SELF.SetupUrlBuilder Urlbuilder(#Url)


   * 'copy' パス・コンポーネント追加
   #Url.AddPathComponent Pathcomponent('copy')


   * フォームのパラメータ追加
   #Request.Content.AddUrlEncodedFormValue Name('sourcePath') Value(#SourcePath)
   #Request.Content.AddUrlEncodedFormValue Name('targetPath') Value(#TargetPath)


   * HTTP 要求の実行
   #Request.DoPost Url(#Url)


   * 要求ステータス取得
   If (#InvocationStatus *IsNot *Null)
      #InvocationStatus.FromHttpResponse( #Request.Response )
   Endif
Endroutine


次は: コピー・サービスのテスト

  • No labels