Question

I use CXF(2.2.3) to compile the Amazon Web Service WSDL (http://s3.amazonaws.com/ec2-downloads/2009-07-15.ec2.wsdl)

But got error as below.

Parameter: snapshotSet already exists for method describeSnapshots but of type com.amazonaws.ec2.doc._2009_07_15.DescribeSnapshotsSetType instead of com.amazonaws.ec2.doc._2009_07_15.DescribeSnapshotsSetResponseType. Use a JAXWS/JAXB binding customization to rename the parameter.

The conflict was due to the data type show below:

<xs:complexType name="DescribeSnapshotsType">
                <xs:sequence>
                    <xs:element name="snapshotSet" type="tns:DescribeSnapshotsSetType"/>
                </xs:sequence>
            </xs:complexType>

<xs:complexType name="DescribeSnapshotsResponseType">
                <xs:sequence>
                    <xs:element name="requestId" type="xs:string"/>
                    <xs:element name="snapshotSet" type="tns:DescribeSnapshotsSetResponseType"/>
                </xs:sequence>
            </xs:complexType>

I create a binding file try to address the issue...but it didn`t do the job

   <jaxws:bindings
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    wsdlLocation="EC2_2009-07-15.wsdl"
    xmlns="http://java.sun.com/xml/ns/jaxws"
    xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
    xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">

    <enableWrapperStyle>false</enableWrapperStyle>
    <jaxws:bindings node="wsdl:definitions/wsdl:types/xs:schema[@targetNamespace='http://ec2.amazonaws.com/doc/2009-07-15/']">
     <jxb:bindings node="xs:complexType[@name='tns:DescribeSnapshotsType']//xs:element[@name='snapshotSet']">
         <jxb:property name="snapshotRequestSet"/>
     </jxb:bindings>
     <jxb:bindings node="xs:complexType[@name='DescribeSnapshotsResponseType']//xs:element[@name='snapshotSet']">
         <jxb:property name="snapshotResponseSet"/>
     </jxb:bindings>     
    </jaxws:bindings>
</jaxws:bindings>

And the command i used, was like below

<wsdlOptions>
     <wsdlOption>
          <wsdl>${basedir}/src/main/resources/wsdl/EC2_2009-07-15.wsdl</wsdl>
          <extraargs>
            <extraarg>-b</extraarg>
            <extraarg>${basedir}/src/main/resources/wsdl/Bindings_EC2_2009-07-15.xml</extraarg>
          </extraargs>
    </wsdlOption>
</wsdlOptions>

What is wrong with my code????

And you can check out my project by using svn.... svn co http://shrimpysprojects.googlecode.com/svn/trunk/smartcrc/AWSAgent/

Was it helpful?

Solution

This part

<enableWrapperStyle>false</enableWrapperStyle>

should be

<jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle>

OTHER TIPS

In your binding file, you use xs:..... but the reference of namespace http://www.w3.org/2001/XMLSchema is xds so if it is not working try to rename the reference xsd to xs (by the way thanks for the solution, it works)

As @PascalThivent mentioned, CXF has a parameter, -autoNameResolution, that you should try using. The message given by CXF when it encounters this, unfortunately does not mention it.

For anyone trying this: I summarize all the corrections:

<jaxws:bindings
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
wsdlLocation="EC2_2009-07-15.wsdl"
xmlns="http://java.sun.com/xml/ns/jaxws"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">

<jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle>
<jaxws:bindings node="wsdl:definitions/wsdl:types/xs:schema[@targetNamespace='http://ec2.amazonaws.com/doc/2009-07-15/']">
 <jxb:bindings node="xs:complexType[@name='tns:DescribeSnapshotsType']//xs:element[@name='snapshotSet']">
     <jxb:property name="snapshotRequestSet"/>
 </jxb:bindings>
 <jxb:bindings node="xs:complexType[@name='DescribeSnapshotsResponseType']//xs:element[@name='snapshotSet']">
     <jxb:property name="snapshotResponseSet"/>
 </jxb:bindings>     
</jaxws:bindings>

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top