我在我的智慧结束,我希望有人可以提供帮助。我正在努力生成 使用Gradle 1.6,CXF 2.7.5,Oracle JDK 1.6.0_33和的WSClient WSDLToJava
我正在使用的WSDL导致静态嵌套Java类,我不能
弄清楚如何在构建请求对象时填充,以缓解这种情况
我创建了一个自定义类,我想用它来代替
静态嵌套类。我的自定义类旨在替代
下面WSDL中的<ControlData>
元素,与“ExportVocabulary70”操作有关。
这是我在运行WSDL2Java时遇到的错误:
XPath evaluation of
"wsdl:definitions/wsdl:types/s:schema/s:element[@name='ExportVocabulary70']/s:complexType[@name='ControlData']"
results in empty target node
我已经粘贴了WSDL,绑定文件,自定义类,Gradle构建任务和 控制台输出如下。对于冗长的道歉,我已经嗤之以鼻 尽我所能。
我尝试了很多jaxb变种:binding和jaxws:绑定我 已经失去了数,我现在用自己的想法搜索自己,所以非常感激 为了这里的人的智慧。
干杯,
埃德
的 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="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="ServiceSoap12" binding="tns:ServiceSoap12">
<soap12:address location="
http://tm04syn2201-infra/webservices/service.asmx"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
绑定文件:
<?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>
自定义类:
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
}
build.gradle摘录(Gradle任务和依赖项:)
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
}
控制台输出(包含错误):
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
答案 0 :(得分:0)
尝试一个xpath:// s:schema / s:element [@ name ='ExportVocabulary70'] / s:complexType [@ name ='ControlData']“
看看是否有帮助。
答案 1 :(得分:-1)
请参阅 - &gt; http://cxf.apache.org/docs/wsdl-to-java.html。 请导航到外部绑定。可能,错误与xpath无关。