title: CXF: wsdl2java errors - WSDL contains duplicate names
body: <p>I am trying to consume a SOAP web service from a 3rd party. I have a maven project and I'm attempting to use cxf-codegen-plugin to run code generation using wsdl2java on a provided WSDL.</p>
  
  <p>The problem with the WSDL is that there is an element and an attribute with the same name within the same complex type. So, I get the following error when trying to run mvn clean install:</p>
  
  <pre><code>Property "SomeId" is already defined. Use &amp;lt;jaxb:property&gt; to resolve this conflict.
  </code></pre>
  
  <p>After looking around the approach to resolve this seems to be to add a binding file to rename the property name that's giving the error. </p>
  
  <p>My binding file looks like this:</p>
  
  <pre><code>&lt;jxb:bindings version="1.0" xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
  xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"&gt;
  
      &lt;jxb:bindings node=".//s:attribute[@name='SomeId']"&gt;
          &lt;jxb:property name="anotherId" /&gt;
      &lt;/jxb:bindings&gt;
  &lt;/jxb:bindings&gt;
  </code></pre>
  
  <p>WSDL snippet:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;wsdl:definitions xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
    xmlns:tns=“namespace” xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    targetNamespace=“namespace”&gt;
    &lt;wsdl:types&gt;
      &lt;s:schema elementFormDefault="qualified" targetNamespace=“namespace”&gt;
        &lt;s:element name="GetData"&gt;
          &lt;s:complexType&gt;
            &lt;s:sequence&gt;
              &lt;s:element minOccurs="0" maxOccurs="1" name="request"&gt;
                &lt;s:complexType&gt;
                  &lt;s:sequence&gt;
                    &lt;s:element minOccurs="0" maxOccurs="1" name="Nbr" type="s:string" /&gt;
                  &lt;/s:sequence&gt;
                &lt;/s:complexType&gt;
              &lt;/s:element&gt;
            &lt;/s:sequence&gt;
          &lt;/s:complexType&gt;
        &lt;/s:element&gt;
        &lt;s:element name="GetDataResponse"&gt;
          &lt;s:complexType&gt;
            &lt;s:sequence&gt;
              &lt;s:element minOccurs="0" maxOccurs="1" name="GetDataResult"&gt;
                &lt;s:complexType&gt;
                  &lt;s:sequence&gt;
                    &lt;s:element minOccurs="0" maxOccurs="1" name="ITEM"&gt;
                      &lt;s:complexType&gt;
                        &lt;s:sequence&gt;
                          &lt;s:element minOccurs="0" maxOccurs="1" name="Pty"&gt;
                            &lt;s:complexType&gt;
                              &lt;s:sequence&gt;
                             &lt;s:element minOccurs="0" maxOccurs="1" name=“SomeId” type="s:string"/&gt; 
                              &lt;/s:sequence&gt;
                              &lt;s:attribute name="SomeId" type="s:string" /&gt;
                            &lt;/s:complexType&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>(Note: 'namespace' hides company name.)</p>
  
  <p>And I've pointed my POM to the binding file:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;plugin&gt;
    &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
    &lt;artifactId&gt;cxf-codegen-plugin&lt;/artifactId&gt;
    &lt;executions&gt;
      &lt;execution&gt;
        &lt;id&gt;generate-sources&lt;/id&gt;
        &lt;phase&gt;generate-sources&lt;/phase&gt;
        &lt;configuration&gt;
          &lt;wsdlOptions&gt;
            &lt;wsdlOption&gt;
              &lt;wsdl&gt;${basedir}/src/main/resources/META-INF/wsdl/a.wsdl&lt;/wsdl&gt;
              &lt;wsdlLocation&gt;classpath:META-INF/wsdl/a.wsdl&lt;/wsdlLocation&gt;
              &lt;packagenames&gt;
                REMOVED
              &lt;/packagenames&gt;
              &lt;extraargs&gt;
                &lt;extraarg&gt;-fe&lt;/extraarg&gt;
                &lt;extraarg&gt;jaxws21&lt;/extraarg&gt;
                &lt;extraarg&gt;-autoNameResolution&lt;/extraarg&gt;
                &lt;extraarg&gt;-exsh&lt;/extraarg&gt;
                &lt;extraarg&gt;true&lt;/extraarg&gt;
              &lt;/extraargs&gt;
              &lt;bindingFiles&gt;
                &lt;bindingFile&gt;${basedir}/src/main/resources/META-INF/wsdl/binding.xsd&lt;/bindingFile&gt;
              &lt;/bindingFiles&gt;
            &lt;/wsdlOption&gt;
          &lt;/wsdlOptions&gt;
        &lt;/configuration&gt;
        &lt;goals&gt;
          &lt;goal&gt;wsdl2java&lt;/goal&gt;
        &lt;/goals&gt;
      &lt;/execution&gt;
    &lt;/executions&gt;
  &lt;/plugin&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>Problem:</strong></p>
  
  <p>When I run 'mvn clean install' with this set-up I get the following error:</p>
  
  <pre><code>XPath evaluation of ".//s:attribute[@name='SomeId']" results in empty target node
  </code></pre>
  
  <p>I've changed the node path to point at the element and also used a full node path structure e.g. node="wsdl:definitions/wsdl:types...." but I keep getting the same error. Feel like I'm going around in circles here.</p>
  
  <p>I'd be very grateful if someone could see where I'm going wrong and point it out to me, as this is my first time trying to implement something like this.</p>
  
  <p>Thanks in advance.</p>