動くサンプルはないのかよ!

YahooオークションのgetCategoryメソッドで、getCategoryResponse output messageが取れない。getCatetoryメソッドに渡すgetCategory input messageの組み立て方がまずいのか、それとも取り出し方がなにか特殊な方法なのかがわからない。getCategory input messageの組み立て方がイマイチ理解できていない。というか、WSDLの記述のどこと対応させて組み立てればいいのか、説明してくれるドキュメントがネット上で見つけられない。今試しているのはこんなコード。

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

my $wsdl	= 'http://soap.auctions.yahoo.co.jp/AuctionWSDL/V1/yahooAuctionService.wsdl';
my $s		= SOAP::Lite->service($wsdl);
my $param ;
$param	=	(SOAP::Data->name('getCategory')->value
				(SOAP::Data->name('categoryID')->type('xsd:int')->value('0')
				)
		) ;
print Dumper($param) ;
my $res = $s -> getCategory($param) ;
print Dumper($res);

組み立てた入力パラメータはこんな風になっている。

$VAR1 = bless( {
                 '_name' => 'getCategory',
                 '_signature' => ,
                 '_value' => [
                               bless( {
                                        '_name' => 'categoryID',
                                        '_type' => 'xsd:int',
                                        '_signature' => ,
                                        '_value' => [
                                                      '0'
                                                    ],
                                        '_attr' => {}
                                      }, 'SOAP::Data' )
                             ],
                 '_attr' => {}
               }, 'SOAP::Data' );

昨日みつけたAWSのお手本をみて、パラメータの組み立て方が同じようになるように調整した結果がコレ。パラメータはどうやら一番外側にあるのはWSDLのmessage要素で定義するgetCategoryメソッドWSDLのoperation要素で定義されているのが多分メソッド)の入力引数(WSDlの該当operation要素のinput要素で指定しているmessage)であるgetCategory message。中に含まれる項目categoryIDは基底の型と思われるxsd:int型。RESTのお手本によると、ここには値0セットが初期値っぽいのでソレを入れている。
対応するWSDLは下の通り。

<portType name="yahooAuctionServicePortType">
	<operation name="getCategory">
		<input message="tns:getCategory"/>
		<output message="tns:getCategoryResponse"/>
	</operation>

ここまでがメソッドを定義しているportType要素。operation要素でメソッド名が定義されていて、input要素が入力引数、output要素が出力引数のメッセージ名をそれぞれ表現している。input要素で定義されている入力引数getCategory messageの定義はこうなっている。


	

これを入れ子にして表現したのが上のコードと出力結果。で、得られる結果は

$VAR1 = '0';

・・・あーもー! と、ここでデバッグ用のオプションをコメントアウトしている事に気づく。これ復活させたら何かわかるのかな?

$VAR1 = bless( {
                 '_name' => 'getCategory',
                 '_signature' => [],
                 '_value' => [
                               bless( {
                                        '_name' => 'categoryID',
                                        '_type' => 'xsd:int',
                                        '_signature' => [],
                                        '_value' => [
                                                      '0'
                                                    ],
                                        '_attr' => {}
                                      }, 'SOAP::Data' )
                             ],
                 '_attr' => {}
               }, 'SOAP::Data' );
SOAP::Transport::HTTP::Client::send_receive: POST http://soap.auctions.yahoo.co.jp/AuctionSOAP/V1
Accept: text/xml
Accept: multipart/*
Content-Length: 522
Content-Type: text/xml; charset=utf-8
SOAPAction: ""

<?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"><categoryID xsi:type="xsd:int">0</categoryID></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 02:10:14 GMT
Content-Length: 4546
Content-Type: text/xml; charset=utf-8
Last-Modified: Tue, 31 Jul 2007 02:10:14 GMT
Client-Date: Tue, 31 Jul 2007 02:10:16 GMT
Client-Peer: ひみちゅ: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>392289</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>24698</categoryID><categoryName>繧ケ繝昴&#65533;繝&#65533;&#65533;繝ャ繧ク繝」繝シ</categoryName><numOfAuctions>744876</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>23336</categoryID><categoryName>繧ウ繝ウ繝斐Η繝シ繧ソ</categoryName><numOfAuctions>298843</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>26318</categoryID><categoryName>閾ェ蜍戊サ翫&#65533;繧ェ繝シ繝医ヰ繧、</categoryName><numOfAuctions>2511587</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>26084</categoryID><categoryName>縺昴&#65533;莉&#65533;/categoryName><numOfAuctions>511216</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>26086</categoryID><categoryName>闃ア縲∝恍闃ク</categoryName><numOfAuctions>64278</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>25464</categoryID><categoryName>縺翫b縺。繧&#65533;&#65533;繧イ繝シ繝&#65533;/categoryName><numOfAuctions>852181</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>24242</categoryID><categoryName>繝帙ン繝シ縲√き繝ォ繝√Ε繝シ</categoryName><numOfAuctions>659851</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>24198</categoryID><categoryName>菴上∪縺&#65533;&#65533;繧、繝ウ繝&#65533;Μ繧「</categoryName><numOfAuctions>953350</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>24202</categoryID><categoryName>繝吶ン繝シ逕ィ蜩&#65533;/categoryName><numOfAuctions>28757</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>23976</categoryID><categoryName>鬟溷刀縲&#65533;」イ譁&#65533;/categoryName><numOfAuctions>175588</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>42177</categoryID><categoryName>繝薙Η繝シ繝&#65533;ぅ繝シ縲√&#65533;繝ォ繧ケ繧ア繧「</categoryName><numOfAuctions>301854</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>21600</categoryID><categoryName>譛ャ縲&#65533;尅隱&#65533;/categoryName><numOfAuctions>1152504</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>23140</categoryID><categoryName>繧「繧ッ繧サ繧オ繝ェ繝シ縲∵凾險&#65533;/categoryName><numOfAuctions>676345</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>23000</categoryID><categoryName>繝輔ぃ繝&#65533;す繝ァ繝ウ</categoryName><numOfAuctions>3213615</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>20060</categoryID><categoryName>繧ウ繝溘ャ繧ッ縲√い繝九Γ繧ー繝&#65533;ぜ</categoryName><numOfAuctions>132711</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>20000</categoryID><categoryName>繧「繝ウ繝&#65533;ぅ繝シ繧ッ縲√さ繝ャ繧ッ繧キ繝ァ繝ウ</categoryName><numOfAuctions>664341</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>22896</categoryID><categoryName>莠句漁縲∝コ苓&#65533;逕ィ蜩&#65533;/categoryName><numOfAuctions>154502</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>22152</categoryID><categoryName>髻ウ讌ス</categoryName><numOfAuctions>1003275</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>21964</categoryID><categoryName>譏&#65533;判縲√ン繝&#65533;が</categoryName><numOfAuctions>392980</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>2084032594</categoryID><categoryName>繧ソ繝ャ繝ウ繝医げ繝&#65533;ぜ</categoryName><numOfAuctions>101436</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>2084043920</categoryID><categoryName>繝√こ繝&#65533;ヨ縲&#65533;≡蛻ク縲∝ョソ豕贋コ育エ&#65533;/categoryName><numOfAuctions>158946</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>2084055844</categoryID><categoryName>繝壹ャ繝医&#65533;逕溘″迚ゥ</categoryName><numOfAuctions>7364</numOfAuctions><isLeaf>false</isLeaf></item><item><categoryID>2084060731</categoryID><categoryName>荳榊虚逕」</categoryName><numOfAuctions>146</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 = '0';

とれてるじゃん! ちゃんとgetCategoryResponseが入っている。じゃあ、入力引数はあれで合ってるんだ。問題はこのデータの取り出し方か!