title: Write a WSDL binding
body: <p>I'm using a WSDL to generate Java classes, to access Zuora SOAP API.</p>
  
  <p>Unfortunatly, this WSDL has conflicts : Maven CXF plugin throw an error with "Two declarations cause a collision in the ObjectFactory class" message.</p>
  
  <p>The collision is between Invoice.PaymentAmount and Payment.Amount</p>
  
  <pre><code>&lt;definitions xmlns="http://schemas.xmlsoap.org/wsdl/" 
      xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
      xmlns:xs="http://www.w3.org/2001/XMLSchema" 
      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
      xmlns:zns="http://api.zuora.com/" 
      xmlns:ons="http://object.api.zuora.com/"
      xmlns:fns="http://fault.api.zuora.com/"
      targetNamespace="http://api.zuora.com/"&gt;
      &lt;types&gt;
          &lt;schema attributeFormDefault="qualified" elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://object.api.zuora.com/"&gt;
              &lt;import namespace="http://api.zuora.com/" /&gt;
              &lt;complexType name="zObject"&gt;
                  &lt;sequence&gt;
                      &lt;element minOccurs="0" maxOccurs="unbounded" name="fieldsToNull" nillable="true" type="string" /&gt;
                      &lt;element minOccurs="0" maxOccurs="1" name="Id" nillable="true" type="zns:ID" /&gt;
                  &lt;/sequence&gt;
              &lt;/complexType&gt;
  
              &lt;complexType name="Invoice" &gt;
                  &lt;complexContent&gt;
                      &lt;extension base="ons:zObject"&gt;
                          &lt;sequence&gt;
                              &lt;element minOccurs="0" name="AccountId" nillable="true" type="zns:ID" /&gt;
                              &lt;element minOccurs="0" name="AdjustmentAmount" nillable="true" type="decimal" /&gt;
                              &lt;element minOccurs="0" name="PaymentAmount" nillable="true" type="decimal" /&gt;
                              &lt;!--more elements--&gt;
                          &lt;/sequence&gt;
                      &lt;/extension&gt;
                  &lt;/complexContent&gt;
              &lt;/complexType&gt;
  
              &lt;complexType name="Payment" &gt;
                  &lt;complexContent&gt;
                      &lt;extension base="ons:zObject"&gt;
                          &lt;sequence&gt;
                              &lt;element minOccurs="0" name="AccountId" nillable="true" type="zns:ID" /&gt;
                              &lt;element minOccurs="0" name="AccountingCode" nillable="true" type="string"  /&gt;
                              &lt;element minOccurs="0" name="Amount" nillable="true" type="decimal" /&gt;
                              &lt;!--more elements--&gt;
                          &lt;/sequence&gt;
                      &lt;/extension&gt;
                  &lt;/complexContent&gt;
              &lt;/complexType&gt;
  
              &lt;!--more types--&gt;
  </code></pre>
  
  <p>The trick seems to be an external binding file as suggested by this post..
  <a href="https://community.zuora.com/t5/API/quot-Two-declarations-cause-a-collision-in-the-ObjectFactory/td-p/11265" rel="nofollow noreferrer">https://community.zuora.com/t5/API/quot-Two-declarations-cause-a-collision-in-the-ObjectFactory/td-p/11265</a></p>
  
  <p>But there's no code sample ; and I can't figure how to write such a binding file.</p>
  
  <p>I've tried :</p>
  
  <pre><code>&lt;jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
             xmlns:xs="http://www.w3.org/2001/XMLSchema"
             version="1.0"&gt;
      &lt;jaxb:bindings schemaLocation="zuora.a.77.0.wsdl"&gt;
          &lt;jaxb:bindings node="//xs:element[@name='PaymentAmount']/xs:complexType"&gt;
              &lt;jaxb:factoryMethod name="PaymentAmout2"/&gt;
          &lt;/jaxb:bindings&gt;
      &lt;/jaxb:bindings&gt;
  &lt;/jaxb:bindings&gt;
  </code></pre>
  
  <p>But it seems to be too simplistic and throws a </p>
  
  <pre><code>"file:/home/kemkem/Work/repo/asap/tooling-zuora/src/main/resources
  /wsdl/zuora.a.77.0.wsdl" is not a part of this compilation. 
  Is this a mistake for "file:/home/kemkem/Work/repo/asap/tooling-zuora/
  src/main/resources/wsdl/zuora.a.77.0.wsdl#types1"
  </code></pre>
  
  <p>Does anyone has a better approach to this ?</p>