You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Edd Grant <ed...@eddgrant.com> on 2013/07/25 18:05:38 UTC

Help getting an external binding file to work: XPath evaluation of results in empty target node

Hi all,

I'm at my wits' end and am hoping someone can help. I'm trying to generate
a WSClient using Gradle 1.6, CXF 2.7.5, Oracle JDK 1.6.0_33 and and
WSDLToJava

The WSDL I am consuming results in static nested Java classes which I can't
figure out how to populate when building request objects, to alleviate this
I have created a custom class which I want to have bound in place of the
static nested classes. My custom class is designed to be a replacement to
the <ControlData> element in the WSDL below.

This is the error I'm seeing when I run WSDL2Java:

XPath evaluation of
"wsdl:definitions/wsdl:types/s:schema/s:element[@name='ExportVocabulary70']/s:complexType[@name='ControlData']"
results in empty target node

I have pasted the WSDL, Binding File, Custom Class, Gradle build task and
console output below. Apologies for the verbosity, I have snipped away as
much as I can.

I have tried so many variations of jaxb:binding and jaxws:binding that I
have lost count, I have now googled myself out of ideas so am most grateful
for any wisdom from people here.

Cheers,

Edd

*WSDL:*

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
                  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="http://synaptica.factiva.com/"
                  xmlns:s="http://www.w3.org/2001/XMLSchema"
                  xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
                  xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
                  targetNamespace="http://synaptica.factiva.com/"
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:types>
    <s:schema elementFormDefault="qualified" targetNamespace="
http://synaptica.factiva.com/">
      <s:element name="ExportVocabulary70">
        <s:complexType name="ControlData">
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="ControlData">
              <s:complexType mixed="true">
                <s:sequence>
                  <s:any/>
                </s:sequence>
              </s:complexType>
            </s:element>
            <s:element minOccurs="0" maxOccurs="1" name="ReportParameters">
              <s:complexType mixed="true">
                <s:sequence>
                  <s:any/>
                </s:sequence>
              </s:complexType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="ExportVocabulary70Response">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1"
name="ExportVocabulary70Result">
              <s:complexType mixed="true">
                <s:sequence>
                  <s:any/>
                </s:sequence>
              </s:complexType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>
    </s:schema>
  </wsdl:types>

  <wsdl:message name="ExportVocabulary70SoapIn">
    <wsdl:part name="parameters" element="tns:ExportVocabulary70"/>
  </wsdl:message>
  <wsdl:message name="ExportVocabulary70SoapOut">
    <wsdl:part name="parameters" element="tns:ExportVocabulary70Response"/>
  </wsdl:message>

  <wsdl:portType name="ServiceSoap">
    <wsdl:operation name="ExportVocabulary70">
      <wsdl:input message="tns:ExportVocabulary70SoapIn"/>
      <wsdl:output message="tns:ExportVocabulary70SoapOut"/>
    </wsdl:operation>
  </wsdl:portType>

  <wsdl:binding name="ServiceSoap" type="tns:ServiceSoap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="ExportVocabulary70">
      <soap:operation soapAction="
http://synaptica.factiva.com/ExportVocabulary70" style="document"/>
      <wsdl:input>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>

  <wsdl:binding name="ServiceSoap12" type="tns:ServiceSoap">
    <soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="ExportVocabulary70">
      <soap12:operation soapAction="
http://synaptica.factiva.com/ExportVocabulary70" style="document"/>
      <wsdl:input>
        <soap12:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>

  <wsdl:service name="Service">
    <wsdl:port name="ServiceSoap" binding="tns:ServiceSoap">
      <soap:address location="
http://tm04syn2201-infra/webservices/service.asmx"/>
    </wsdl:port>
    <wsdl:port name="ServiceSoap12" binding="tns:ServiceSoap12">
      <soap12:address location="
http://tm04syn2201-infra/webservices/service.asmx"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

*Binding File:*

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<bindings
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    wsdlLocation="Synaptica.wsdl"
    xmlns:s="http://www.w3.org/2001/XMLSchema"
    xmlns="http://java.sun.com/xml/ns/jaxb"
    version="2.1">
    <bindings
node="wsdl:definitions/wsdl:types/s:schema/s:element[@name='ExportVocabulary70']/s:complexType[@name='ControlData']">
      <class name="ControlBobData"/>
    </bindings>
</bindings>

*Custom Class:*

package com.eddgrant.synaptica.api

import javax.xml.bind.annotation.XmlAccessType
import javax.xml.bind.annotation.XmlAccessorType
import javax.xml.bind.annotation.XmlElement
import javax.xml.bind.annotation.XmlRootElement

//
http://stackoverflow.com/questions/1161147/how-do-i-get-groovy-and-jaxb-to-play-nice-together
@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement
class ControlData {
  @XmlElement
  Auth auth
}

@XmlRootElement
class Auth {

  @XmlElement
  String userId

  @XmlElement
  String password
}

*Gradle task and dependencies:*

configurations {
  cxf
}

dependencies {
  cxf 'org.apache.cxf:apache-cxf:2.7.5'
  compile "org.codehaus.groovy:groovy-all:1.8.6"
}

task(genClientSource, type: JavaExec) {
  dependsOn(compileGroovy)
  description "Generates Java source files from the Synaptica WSDL"

  main = 'org.apache.cxf.tools.wsdlto.WSDLToJava'
  classpath = configurations.cxf
  args     '-p', "com.eddgrant.synaptica.api",
        '-wsdlLocation', "/Synaptica.wsdl",
        '-d', project.generatedSourcePath,
        '-b', 'src/main/resources/ControlData.xjb',
        '-verbose',
        //'-sn', 'MyNewServiceLaLaLa',
        project.synapticaWsdlPath
}

*Console output (containing the error):*

25-Jul-2013 16:48:58 org.apache.cxf.tools.wsdlto.core.PluginLoader
loadPlugin
INFO: Replaced default databinding source
25-Jul-2013 16:48:58 org.apache.cxf.tools.wsdlto.core.PluginLoader
loadPlugin
INFO: Replaced default databinding domsource
25-Jul-2013 16:48:58 org.apache.cxf.tools.wsdlto.core.PluginLoader
loadPlugin
INFO: Replaced default databinding staxsource
25-Jul-2013 16:48:58 org.apache.cxf.tools.wsdlto.core.PluginLoader
loadPlugin
INFO: Replaced default databinding saxsource
25-Jul-2013 16:48:58 org.apache.cxf.tools.wsdlto.core.PluginLoader
loadPlugin
INFO: Replaced default frontend jaxws
25-Jul-2013 16:48:58 org.apache.cxf.tools.wsdlto.core.PluginLoader
loadPlugin
INFO: Replaced default frontend jaxws21
25-Jul-2013 16:48:58 org.apache.cxf.tools.wsdlto.core.PluginLoader
loadPlugin
INFO: Replaced default databinding jaxb
25-Jul-2013 16:48:58 org.apache.cxf.tools.wsdlto.core.PluginLoader
loadPlugin
INFO: Replaced default databinding xmlbeans
Loading FrontEnd jaxws ...
Loading DataBinding jaxb ...
wsdl2java -p uk.co.bbc.fabric.synaptica.api -wsdlLocation /Synaptica.wsdl
-d build/generated/src/main/java -b src/main/resources/ControlData.xjb
-verbose src/main/resources/Synaptica.wsdl
wsdl2java - Apache CXF 2.7.5


WSDLToJava Error:
file:/Data/Programming/bbc-dmi-sts-workspace/em3-parent-trunk/Synaptica/SynapticaWSClient/src/main/resources/ControlData.xjb
[12,132]: XPath evaluation of
"wsdl:definitions/wsdl:types/s:schema/s:element[@name='ExportVocabulary70']/s:complexType[@name='ControlData']"
results in empty target node


org.apache.cxf.tools.common.ToolException:
file:/Data/Programming/bbc-dmi-sts-workspace/em3-parent-trunk/Synaptica/SynapticaWSClient/src/main/resources/ControlData.xjb
[12,132]: XPath evaluation of
"wsdl:definitions/wsdl:types/s:schema/s:element[@name='ExportVocabulary70']/s:complexType[@name='ControlData']"
results in empty target node


-- 
Web: http://www.eddgrant.com
Email: edd@eddgrant.com
Mobile: +44 (0) 7861 394 543