我嘗試連接到Amazon AWSECommerceService。我使用CXF生成了客戶端類並提供了WSDL,但出現錯誤「操作itemLookup對此端點無效」。連接Amazon AWSECommerceService時無效的SOAP消息
一些調查把我帶到了這一點: 生成的SOAP消息是這樣的:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns1:itemLookup
xmlns:ns1="http://_2011_08_01.awsecommerceservice.webservices.amazon.com/">
<ItemLookup
xmlns="http://webservices.amazon.com/AWSECommerceService/2011-08-01">
<AssociateTag>pkd</AssociateTag>
<Request>
<IdType>ISBN</IdType>
<ItemId>0321534468</ItemId>
<SearchIndex>Books</SearchIndex>
</Request>
</ItemLookup>
</ns1:itemLookup>
</soap:Body>
</soap:Envelope>
,但它應該是:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ItemLookup
xmlns="http://webservices.amazon.com/AWSECommerceService/2011-08-01">
<AssociateTag>pkd</AssociateTag>
<Request>
<IdType>ISBN</IdType>
<ItemId>0321534468</ItemId>
<SearchIndex>Books</SearchIndex>
</Request>
</ItemLookup>
</soap:Body>
</soap:Envelope>
它看起來有一個意外的變量
<ns1:itemLookup
xmlns:ns1="http://_2011_08_01.awsecommerceservice.webservices.amazon.com/">
第二個示例在使用SoapUI時效果很好。 出了什麼問題?我缺少什麼運行wsdl2java maven插件?
請原諒我,如果問題是愚蠢的。我對web服務和SOAP真的很陌生。
當我加入註解:
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
我得到的消息:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns1:itemLookup
xmlns:ns1="http://_2011_08_01.awsecommerceservice.webservices.amazon.com/">
<ns2:ItemLookup
xmlns:ns2="http://_2011_08_01.awsecommerceservice.webservices.amazon.com/"
xmlns:ns3="http://webservices.amazon.com/AWSECommerceService/2011-08-01">
<AssociateTag>pkd</AssociateTag>
<Shared>
<IdType>ISBN</IdType>
<ItemId>0321534468</ItemId>
<SearchIndex>Books</SearchIndex>
</Shared>
</ns2:ItemLookup>
</ns1:itemLookup>
</soap:Body>
</soap:Envelope>
這些名稱怪異我。
哪一個?服務本身或ServicePortType類?我會在晚上在家檢查解決方案,謝謝你的回答。 –
服務本身 –
它沒有工作:(。信息改變了,但不是預期的方式。 –