Came across this thread when sorting through my backlog. Just for the sake of anyone trying this, Axis is unable to work with the Amazon web service interface. The problem is that Axis always sends elements with xsi:nil="true" for values you set to null, even when the schema does not mark those elements as nillable. This causes problems with Amazon, where one element in particular is only supposed to have a particular value if present (though that information is not included in the schema). Here's an example schema fragment from the WSDL:

<xs:element name="ItemSearch">
<xs:complexType>
<xs:sequence>
<xs:element name="SubscriptionId" type="xs:string" minOccurs="0"/>
<xs:element name="AssociateTag" type="xs:string" minOccurs="0"/>
<xs:element name="XMLEscaping" type="xs:string" minOccurs="0"/>
<xs:element name="Validate" type="xs:string" minOccurs="0"/>
<xs:element name="Shared" type="tns:ItemSearchRequest" minOccurs="0"/>
<xs:element name="Request" type="tns:ItemSearchRequest" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>


Here's what Axis generates:

POST /onca/soap?Service=AWSECommerceService HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.2RC3
...

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
<soapenv:Body>
<ItemSearch xmlns="http://webservices.amazon.com/AWSECommerceService/2005-01-19";>
<SubscriptionId>XXXXXXXXXXXXXXXX</SubscriptionId>
<AssociateTag xsi:nil="true"/>
<XMLEscaping xsi:nil="true"/>
<Validate xsi:nil="true"/>
<Shared>
<Count lowestSetBit="2">12</Count>
<ResponseGroup>Medium</ResponseGroup>
<SearchIndex>Books</SearchIndex>
<Title>Java XML</Title>
</Shared>
<Request xsi:nil="true"/>
</ItemSearch>
</soapenv:Body>
</soapenv:Envelope>


Note the AssociateTag, XMLEscaping, and Validate elements in this request.

The problem was supposed to have been fixed some time ago: http://issues.apache.org/jira/browse/AXIS-530 :-) Unfortunately the fix doesn't work, as can be seen by the above results from RC3. :-( From this and other experiences with Axis releases (including the >1 year cycle for a point release) I'm starting to wonder if Axis has just gotten to be such a mess of spaghetti code that it's no longer usable in production. I've been training developers on Axis for some time. It's embarrassing to have to spend much of the training time discussing known issues and ways to work around them, but there doesn't appear to be any alternative at present.

 - Dennis

Dennis M. Sosnoski
Enterprise Java, XML, and Web Services
Training and Consulting
http://www.sosnoski.com
Redmond, WA  425.885.7197

BTW, the work-around for this case is to edit the Amazon WSDL and strip out the optional elements you're not going to be using from the request schema definitions.

[EMAIL PROTECTED] wrote:

-----Original Message-----
From: Johan Meyer [mailto:[EMAIL PROTECTED]


Sorry Johan,

I can not give you an url where you will find a finished service but I can
tell you some information you would need.

First of all you must register by amazon, so you will get an subscription
Id which you need.
Then you need for each request you send some filled standard informations.
Therefore I can send you this link
http://www.amazon.com/gp/aws/landing.html/ref=gw1_mm_4/104-3068958-8487102
or look under the amaozon website>male money>web service

On this pages you will find some api's how to use the amazon wsdl.

Hope this might help you a bit.

Greetings Olaf



Sent: Thursday, January 27, 2005 11:25 AM
To: axis-user@ws.apache.org
Subject: Amazon and Axis
Importance: High

Hello
I am a new Java Axis user and would like to know if anybody
knows where I can find a demo on how to use Amazon's web
services with Axis.

Any help will be appreciated.

Johan

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.7.4 - Release Date: 1/25/2005









Reply via email to