proxy,uri,url

uriとは

 インターネット上に存在する情報資源の場所を指し示す記述方式。インターネットにおける情報の「住所」にあたる。URIは包括的な概念であり、現在インターネットで広く用いられているURLはURIの機能の一部を具体的に仕様化したものである。

URIとは 【 Uniform Resource Identifier 】 - 意味/解説/説明/定義 : IT用語辞典
(SOAP::Liteにおける)proxyとは

XML-PRCの場合と同様に、proxy引数にはサーバのURLを指定します。例えば、SOAPサーバがCGIスクリプトといて実装されている場合、proxyの呼び出しは、次のように書きます。

$server->proxy("http://server.example.com/path/to/server.cgi") ;

PerlクックブックVolume2

URLとは

インターネット上に存在する情報資源(文書や画像など)の場所を指し示す記述方式。インターネットにおける情報の「住所」にあたる。情報の種類やサーバ名、ポート番号、フォルダ名、ファイル名などで構成される。

URLとは 【 Uniform Resource Locator 】 - 意味/解説/説明/定義 : IT用語辞典

ということは、proxyはサーバのURLである。
URLとはURIという概念の実装のひとつである。
URIとはネット上の資源を指し示す記述方法である。
proxyで何を指定して、uriで何を指定するのか、この定義ではわからないじゃないか。「何の」URI、URLなのか、どっかに書いてないのか?

わかった。この場合、uriってのはWSDL上、definition要素のtargetNamespace属性として定義されている値だ。Yahooオークションの場合は次の記述が該当する。

<definitions name="yahooAuctionService" targetNamespace="urn:yahoo:jp:auction:soap">

でもってproxyはSOAP:address要素のlocation属性の値を使えばいい模様。

<service name="yahooAuctionService">
	<port name="yahooAuctionService" binding="tns:yahooAuctionService">
		<SOAP:address location="http://soap.auctions.yahoo.co.jp/AuctionSOAP/V1"/>
	</port>
</service>

これとその他の情報を総合して作り直したのが下のコード。

#use SOAP::Lite ;
use SOAP::Lite +trace => 'debug';   # for debugging
use Data::Dumper;
use strict;

my $soap = SOAP::Lite->new
			(uri	=> "urn:yahoo:jp:auction:soap",
			 proxy	=> "http://soap.auctions.yahoo.co.jp/AuctionSOAP/V1",
			) ;
my $result = $soap->call('getCategory',0);
if($result->fault){
	print "YahooAuctionSoap: Fault ".$result->faultcode." has occurred ".
	$result->faultstring;
}

print Dumper($result);

得られた出力はこんな感じ。

SOAP::Transport::HTTP::Client::send_receive: POST http://soap.auctions.yahoo.co.jp/AuctionSOAP/V1
Accept: text/xml
Accept: multipart/*
Content-Length: 520
Content-Type: text/xml; charset=utf-8
SOAPAction: "urn:yahoo:jp:auction:soap#getCategory"

<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><namesp1:getCategory xmlns:namesp1="urn:yahoo:jp:auction:soap"><c-gensym3 xsi:type="xsd:int">0</c-gensym3></namesp1:getCategory></SOAP-ENV:Body></SOAP-ENV:Envelope>
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK
Connection: close
Date: Tue, 31 Jul 2007 04:24:07 GMT
Content-Length: 4546
Content-Type: text/xml; charset=utf-8
Last-Modified: Tue, 31 Jul 2007 04:24:07 GMT
Client-Date: Tue, 31 Jul 2007 04:24:09 GMT
Client-Peer: 202.93.87.253:80
Client-Response-Num: 1
P3P: policyref="http://privacy.yahoo.co.jp/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV"

<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:auction="urn:yahoo:jp:auction:soap"><SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><auction:getCategoryResponse><categoryID>0</categoryID><categoryName>繧ェ繝シ繧ッ繧キ繝ァ繝ウ</categoryName><categoryPath>繧ェ繝シ繧ッ繧キ繝ァ繝ウ</categoryPath><parentCategoryPath></parentCategoryPath><isLeaf>false</isLeaf><childCategoryNum>0</childCategoryNum><item><categoryID>23632</categoryID><categoryName>螳カ髮サ縲、V縲√き繝。繝ゥ</categoryName><numOfAuctions>395951</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>24698</categoryID><categoryName>繧ケ繝昴&#65533;繝&#65533;&#65533;繝ャ繧ク繝」繝シ</categoryName><numOfAuctions>753195</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>23336</categoryID><categoryName>繧ウ繝ウ繝斐Η繝シ繧ソ</categoryName><numOfAuctions>300980</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>26318</categoryID><categoryName>閾ェ蜍戊サ翫&#65533;繧ェ繝シ繝医ヰ繧、</categoryName><numOfAuctions>2537470</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>26084</categoryID><categoryName>縺昴&#65533;莉&#65533;/categoryName><numOfAuctions>513852</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>26086</categoryID><categoryName>闃ア縲∝恍闃ク</categoryName><numOfAuctions>65012</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>25464</categoryID><categoryName>縺翫b縺。繧&#65533;&#65533;繧イ繝シ繝&#65533;/categoryName><numOfAuctions>857848</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>24242</categoryID><categoryName>繝帙ン繝シ縲√き繝ォ繝√Ε繝シ</categoryName><numOfAuctions>662701</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>24198</categoryID><categoryName>菴上∪縺&#65533;&#65533;繧、繝ウ繝&#65533;Μ繧「</categoryName><numOfAuctions>961160</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>24202</categoryID><categoryName>繝吶ン繝シ逕ィ蜩&#65533;/categoryName><numOfAuctions>28979</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>23976</categoryID><categoryName>鬟溷刀縲&#65533;」イ譁&#65533;/categoryName><numOfAuctions>179664</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>42177</categoryID><categoryName>繝薙Η繝シ繝&#65533;ぅ繝シ縲√&#65533;繝ォ繧ケ繧ア繧「</categoryName><numOfAuctions>303151</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>21600</categoryID><categoryName>譛ャ縲&#65533;尅隱&#65533;/categoryName><numOfAuctions>1155292</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>23140</categoryID><categoryName>繧「繧ッ繧サ繧オ繝ェ繝シ縲∵凾險&#65533;/categoryName><numOfAuctions>684774</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>23000</categoryID><categoryName>繝輔ぃ繝&#65533;す繝ァ繝ウ</categoryName><numOfAuctions>3248863</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>20060</categoryID><categoryName>繧ウ繝溘ャ繧ッ縲√い繝九Γ繧ー繝&#65533;ぜ</categoryName><numOfAuctions>133376</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>20000</categoryID><categoryName>繧「繝ウ繝&#65533;ぅ繝シ繧ッ縲√さ繝ャ繧ッ繧キ繝ァ繝ウ</categoryName><numOfAuctions>667177</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>22896</categoryID><categoryName>莠句漁縲∝コ苓&#65533;逕ィ蜩&#65533;/categoryName><numOfAuctions>155890</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>22152</categoryID><categoryName>髻ウ讌ス</categoryName><numOfAuctions>1006544</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>21964</categoryID><categoryName>譏&#65533;判縲√ン繝&#65533;が</categoryName><numOfAuctions>395608</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>2084032594</categoryID><categoryName>繧ソ繝ャ繝ウ繝医げ繝&#65533;ぜ</categoryName><numOfAuctions>102136</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>2084043920</categoryID><categoryName>繝√こ繝&#65533;ヨ縲&#65533;≡蛻ク縲∝ョソ豕贋コ育エ&#65533;/categoryName><numOfAuctions>159742</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>2084055844</categoryID><categoryName>繝壹ャ繝医&#65533;逕溘″迚ゥ</categoryName><numOfAuctions>7393</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>2084060731</categoryID><categoryName>荳榊虚逕」</categoryName><numOfAuctions>148</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>2084217893</categoryID><categoryName>繝√Ε繝ェ繝&#65533;ぅ繝シ</categoryName><numOfAuctions>88</numOfAuctions><isLeaf>false</isLeaf></item></auction:getCategoryResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
$VAR1 = bless( {
                 '_content' => [
                                 'SOAP-ENV:Envelope',
                                 {
                                   'xmlns:xsi' => 'http://www.w3.org/1999/XMLSchema-instance',
                                   'xmlns:auction' => 'urn:yahoo:jp:auction:soap',
                                   'xmlns:SOAP-ENC' => 'http://schemas.xmlsoap.org/soap/encoding/',
                                   'xmlns:SOAP-ENV' => 'http://schemas.xmlsoap.org/soap/envelope/',
                                   'xmlns:xsd' => 'http://www.w3.org/1999/XMLSchema'
                                 },
                                 [
                                   [
                                     'SOAP-ENV:Body',
                                     {
                                       'SOAP-ENV:encodingStyle' => 'http://schemas.xmlsoap.org/soap/encoding/'
                                     },
                                     [
                                       [
                                         'auction:getCategoryResponse',
                                         {},
                                         [
                                           [
                                             'categoryID',
                                             {},
                                             '0',
                                             undef,
                                             '0',
                                             'categoryID',
                                             {}
                                           ],
                                           [
                                             'categoryName',
                                             {},
                                             "\x{30aa}\x{30fc}\x{30af}\x{30b7}\x{30e7}\x{30f3}",
                                             undef,
                                             "\x{30aa}\x{30fc}\x{30af}\x{30b7}\x{30e7}\x{30f3}",
                                             'categoryName',
                                             {}
                                           ],
                                           [
                                             'categoryPath',
                                             {},
                                             "\x{30aa}\x{30fc}\x{30af}\x{30b7}\x{30e7}\x{30f3}",
                                             undef,
                                             "\x{30aa}\x{30fc}\x{30af}\x{30b7}\x{30e7}\x{30f3}",
                                             'categoryPath',
                                             {}
                                           ],
                                           [
                                             'parentCategoryPath',
                                             {},
                                             '',
                                             undef,
                                             '',
                                             'parentCategoryPath',
                                             {}
                                           ],
                                           [
                                             'isLeaf',
                                             {},
                                             'false',
                                             undef,
                                             'false',
                                             'isLeaf',
                                             {}
                                           ],
以下延々と続く

分からない事は山ほどあるが、ひとまず動くものができた。謎は追々わかっていく事を期待。