好吧,我有这样的外部(和旧)WSDL 结构:
<wsdl:definitions 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:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:tns="...custom namespace..."
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
targetNamespace="...custom namespace..."
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="...custom namespace...">
<s:element name="...">
</s:element>
<s:element name="...">
</s:element>
<s:complexType name="CustomClassName">
...
我正在使用 xjc 从这个 WSDL 创建 Java 类。
我在这个 WSDL 中使用的请求以以CustomClassName开头的纯 XML 响应,但这个类没有用XMLRootElement注释。
当我手动将此注释添加到此类时,我的代码工作得很好。
但是我想在调用xjc时使用自定义绑定文件来添加注释,而atm我无法让它工作。我当前的自定义绑定文件如下所示:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jaxb:bindings
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:annox="http://annox.dev.java.net"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd"
jaxb:extensionBindingPrefixes="xjc annox" version="2.1">
<jaxb:bindings schemaLocation="...wsdl filename..." node="//s:schema">
<jaxb:bindings node="s:complexType[@name='CustomClassName']">
<annox:annotate>
<annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement" />
</annox:annotate>
</jaxb:bindings>
</jaxb:bindings>
</jaxb:bindings>
(我尝试了我发现的不同语法,但该类仍然没有注释。)
我的错在哪里?