Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
jp:popfilemodules:xmlrpc [2007/11/27 08:19] amatubujp:popfilemodules:xmlrpc [2009/09/06 15:38] – Fixed sample codes amatubu
Line 39: Line 39:
 ==== 簡単な例 ==== ==== 簡単な例 ====
 === Perl の例 1 === === Perl の例 1 ===
-<code>+<code perl>
 use strict; use strict;
 use XMLRPC::Lite; use XMLRPC::Lite;
Line 61: Line 61:
  
 === Python の例 1 === === Python の例 1 ===
-<code>+<code python>
 from xmlrpclib import ServerProxy from xmlrpclib import ServerProxy
 POPFile = ServerProxy("http://localhost:8081") POPFile = ServerProxy("http://localhost:8081")
Line 76: Line 76:
  
 === Delphi の例 === === Delphi の例 ===
-<code>+<code delphi>
 program popdelphi; program popdelphi;
 {$APPTYPE CONSOLE} {$APPTYPE CONSOLE}
Line 129: Line 129:
  
 === NSBasic/CE for Windows CE Example === === NSBasic/CE for Windows CE Example ===
-<code>+<code nsbasic>
  AddObject "PocketXMLRPC.Factory","xmlrpc"  AddObject "PocketXMLRPC.Factory","xmlrpc"
  Set popfile = xmlrpc.proxy("http://192.168.200.1:8081/RPC2","POPFile/API.")  Set popfile = xmlrpc.proxy("http://192.168.200.1:8081/RPC2","POPFile/API.")
Line 146: Line 146:
 ==== 応用例  ==== ==== 応用例  ====
 === Perl の応用例 1 (もっと複雑なエラーチェック) === === Perl の応用例 1 (もっと複雑なエラーチェック) ===
-<code>+<code perl>
 use strict; use strict;
 use XMLRPC::Lite; use XMLRPC::Lite;
Line 221: Line 221:
 === 応用例 2 ==== === 応用例 2 ====
 pipe.pl を XMLRPC のクライアントとして実装します。 pipe.pl を XMLRPC のクライアントとして実装します。
-<code> +<code perl
-  -!/usr/bin/perl+#!/usr/bin/perl
 use strict; use strict;
 use XMLRPC::Lite; use XMLRPC::Lite;
  
-  - 安全な一時ファイルを使用したいのですが、このスクリプトはふつうひとりのユーザとして動くでしょう+安全な一時ファイルを使用したいのですが、このスクリプトはふつうひとりのユーザとして動くでしょう
 use File::Temp qw/tempfile tempdir/; use File::Temp qw/tempfile tempdir/;
  
-  - アクセスすることができるフォルダはスクリプトが終了したときに削除されるでしょう+アクセスすることができるフォルダはスクリプトが終了したときに削除されるでしょう
 my $temp_dir = tempdir( CLEANUP => 1); my $temp_dir = tempdir( CLEANUP => 1);
  
-  - フルパスが指定された一時ファイル+フルパスが指定された一時ファイル
 my ($fh_in, $filename_in) = tempfile('popfileinXXXXXXX', SUFFIX => ".msg", UNLINK => 1 , DIR => $temp_dir); my ($fh_in, $filename_in) = tempfile('popfileinXXXXXXX', SUFFIX => ".msg", UNLINK => 1 , DIR => $temp_dir);
  
-  - パイプとして動くため、標準入力 (STDIN) から読み込みます+パイプとして動くため、標準入力 (STDIN) から読み込みます
 while (<STDIN>) { while (<STDIN>) {
  print $fh_in $_;  print $fh_in $_;
 } }
  
-  - POPFile は、ファイルが閉じられていることを前提とします+POPFile は、ファイルが閉じられていることを前提とします
 close $fh_in; close $fh_in;
  
-  - 安全な出力ファイルを作成します+安全な出力ファイルを作成します
 my ($fh_out, $filename_out) = tempfile('popfileoutXXXXXXX', SUFFIX => ".msg", UNLINK => 1, DIR => $temp_dir); my ($fh_out, $filename_out) = tempfile('popfileoutXXXXXXX', SUFFIX => ".msg", UNLINK => 1, DIR => $temp_dir);
  
-  - XMLRPC のプロキシ+XMLRPC のプロキシ
 my $xmlrpc = XMLRPC::Lite ->proxy('http://localhost:8086/RPC2'); my $xmlrpc = XMLRPC::Lite ->proxy('http://localhost:8086/RPC2');
  
-  - POPFile に挨拶して、セッションキーを取得します+POPFile に挨拶して、セッションキーを取得します
 my $sk = $xmlrpc-> call('POPFile/API.get_session_key','admin',//) my $sk = $xmlrpc-> call('POPFile/API.get_session_key','admin',//)
  -> result;  -> result;
  
-  - ここで仕事をします+ここで仕事をします
 $xmlrpc-> call('POPFile/API.handle_message',$sk,$filename_in,$filename_out) $xmlrpc-> call('POPFile/API.handle_message',$sk,$filename_in,$filename_out)
  -> result;  -> result;
  
-  - POPFile にお別れをします+POPFile にお別れをします
 $xmlrpc-> call('POPFile/API.release_session_key',$sk); $xmlrpc-> call('POPFile/API.release_session_key',$sk);
  
-  - パイプとして動くために、標準出力 (STDOUT) に書き込みます+パイプとして動くために、標準出力 (STDOUT) に書き込みます
 while (<$fh_out>) { while (<$fh_out>) {
  print $_;  print $_;
 } }
  
-  - 終了します。File::Temp が(一時ファイルを)片付けてくれます+終了します。File::Temp が(一時ファイルを)片付けてくれます
 exit(0); exit(0);
  
 
jp/popfilemodules/xmlrpc.txt · Last modified: 2009/09/25 18:11 by 127.0.0.1
Old revisions

Should you find anything in the documentation that is incomplete, unclear, outdated or just plain wrong, please let us know and leave a note in the Documentation Forum.

Recent changes RSS feed Donate Driven by DokuWiki
The content of this wiki is protected by the GNU Fee Documentation License