前人未踏の領域へ Androidアプリ開発編

Androidアプリ開発に関する調査メモ置き場。古い記事にはアプリ以外も含まれます。

WSDLにアクセスできない

現象

何日か前からProduct Advertising APIがエラーを返すようになった。放置していたのだが改善する様子がない。

原因

エラーログを見てみると、wsdlのリクエストが404エラーを返していた。スタックトレースの抜粋

Caused by: com.sun.xml.internal.ws.wsdl.parser.InaccessibleWSDLException: 2 counts of InaccessibleWSDLException.

java.io.FileNotFoundException: http://ecs.amazonaws.com/AWSECommerceService/2013-08-01/JP/AWSECommerceService.wsdl
java.io.FileNotFoundException: http://ecs.amazonaws.com/AWSECommerceService/2013-08-01/JP/AWSECommerceService.wsdl?wsdl

	at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:260)
	at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:231)
	at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:194)
	at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:163)
	at com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:348)
	at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:306)
	at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:215)
	at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:196)
	at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:192)
	at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:104)
	at javax.xml.ws.Service.<init>(Service.java:77)
	at com.amazon.webservices.awsecommerceservice.AWSECommerceService.<init>(AWSECommerceService.java:42)

アクセスエラーになっているのは私の場合は以下のURL
http://ecs.amazonaws.com/AWSECommerceService/2013-08-01/JP/AWSECommerceService.wsdl

フォーラムでも話題が出ていたので日本以外でも発生しているらしい。
https://forums.aws.amazon.com/thread.jspa?threadID=167469&tstart=0

ecs.amazonaws.comがダメになったような気がする。

対策

以下のURLにはアクセスできたので、こちらを使えば良さそう。
http://webservices.amazon.co.jp/AWSECommerceService/2011-08-01/AWSECommerceService.wsdl
http://webservices.amazon.co.jp/AWSECommerceService/2013-08-01/AWSECommerceService.wsdl

AWSECommerceService.javaエラーになったURLが2箇所あるのでそれを上記のどちかに変更すれば良いかと。
URL内の日付を省略した場合は2011-08-01が適用されるようだ。

おまけ

wsimportコマンドを忘れてしまっていたのでこちらもメモ。

wsimport -d ./build -s ./src -p com.amazon.webservices.awsecommerceservice http://webservices.amazon.co.jp/AWSECommerceService/2013-08-01/AWSECommerceService.wsdl .