WebServiceConnectorコンポーネントって使ったことないんですがちょっとよくわからないです…
WSDL通りにパラメータ渡してるんですがSOAPのRequestのXMLを見ると予期しない形になってる…(T_T)
[ActionScript側]
import mx.data.components.WebServiceConnector;
var res:Function = function (evt:Object) {
trace(evt.target.results);
};
var wsConn:WebServiceConnector = new WebServiceConnector();
var req = new Object();
req.SubscriptionId = '########';
req.AWSAccessKeyId = '########';
req.Request = new Array();
var ResponseGroup = new Object();
ResponseGroup.Keywords = 'iPod';
ResponseGroup.SearchIndex = 'Electronics';
ResponseGroup.ResponseGroup = ['Small', 'Images', 'ItemAttributes'];
req.Request.push(ResponseGroup);
wsConn.addEventListener("result", res);
wsConn.WSDLURL = "http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl";
wsConn.operation = "ItemSearch";
wsConn.params = req;
wsConn.suppressInvalidCalls = false;
wsConn.trigger();
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<ItemSearch xmlns="http://webservices.amazon.com/AWSECommerceService/2005-10-05">
<SubscriptionId>[object Object]</SubscriptionId>
<AWSAccessKeyId>10B4NDTY1XGR8PFK1K82</AWSAccessKeyId>
<AssociateTag>10B4NDTY1XGR8PFK1K82</AssociateTag>
<XMLEscaping />
<Validate />
<Shared>
<Actor />
<Artist />
・
・
・
<TextStream />
<Title />
</Shared>
<Request xmlns="" />
</ItemSearch>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
なんかオブジェクトに突っ込んだ逆順に上から入れられてる??
Request要素とか空だし...
ボク根本的に間違えてる気がする.
ご指摘ありましたらお願いします.m(_ _)m
追記)
XMLを直接指定して投げる分には取得できた…
んー,こうじゃないきがするなぁ…
var xml = '<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">' + "\n";
xml += '<SOAP-ENV:Body>' + "\n";
xml += ' <ItemSearch xmlns="http://webservices.amazon.com/AWSECommerceService/2005-10-05">' + "\n";
xml += ' <SubscriptionId>########</SubscriptionId>' + "\n";
xml += ' <AWSAccessKeyId>########</AWSAccessKeyId>' + "\n";
xml += ' <Request>' + "\n";
xml += ' <Keywords>iPod</Keywords>' + "\n";
xml += ' <ResponseGroup>Small</ResponseGroup>' + "\n";
xml += ' <ResponseGroup>Images</ResponseGroup>' + "\n";
xml += ' <SearchIndex>Electronics</SearchIndex>' + "\n";
xml += ' </Request>' + "\n";
xml += ' </ItemSearch>' + "\n";
xml += ' </SOAP-ENV:Body>' + "\n";
xml += '</SOAP-ENV:Envelope>' + "\n";
var reqXML = new XML(xml);
reqXML.ignoreWhite = true;
var resXML = new XML();
resXML.onLoad = function() {
trace(this);
};
reqXML.sendAndLoad('http://soap.amazon.co.jp/onca/soap?Service=AWSECommerceService', resXML, 'POST');
追記)
んー,RESTの方がいいかなぁ...
http://webservices.amazon.co.jp/onca/xml?Service=AWSECommerceService&SubscriptionId=10B4NDTY1XGR8PFK1K82&Version=2005-10-05&Operation=SimilarityLookup&ResponseGroup=Small&ItemId=4797327030
参考)
・ITmediaエンタープライズ | 特集 | WebサービスをAmazonで知るECS 4.0でアフィリエイト
・最新WebサービスAPIエクスプロ-ラ ~Amazon、はてな、Google、Yahoo! 4大Webサービス完全攻略
trackback for this entry URL:
http://blog.graffiti-web.org/mt/mt-tb.cgi/337