我有这个wsdl。关键是与 的线<xs:element ref="xs:schema"/>
。这是一个指向http://www.w3.org/2001/XMLSchema的元素。JAXB 似乎不喜欢它,所以我不得不导入http://www.w3.org/2001/XMLSchema命名空间,但我得到了错误(底部)。
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="GetSomethingWS" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:getsome="urn://schema.com/services/GetSomething" xmlns:ws="urn://schema.com/services/GetSomething" targetNamespace="urn://schema.com/services/GetSomething">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:getsome="urn://schema.com/services/GetSomething" targetNamespace="urn://schema.com/services/GetSomething" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:import namespace="http://www.w3.org/2001/XMLSchema" schemaLocation="http://www.w3.org/2001/XMLSchema"/>
<xs:element name="getSomething" type="getsome:GeneticType"/>
<xs:complexType name="GeneticType">
<xs:sequence>
<xs:element ref="xs:schema"/>
<xs:any/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="getSomething">
<wsdl:part name="parameters" element="getsome:getSomething"/>
</wsdl:message>
<wsdl:portType name="GetSomethingWS">
<wsdl:operation name="getSomething">
<wsdl:input message="ws:getSomething"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="GetSomethingWSPortBinding" type="ws:GetSomethingWS">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getSomething">
<soap:operation soapAction="urn:getSomething" style="document"/>
<wsdl:input>
<soap:body parts="parameters" use="literal"/>
</wsdl:input>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="GetSomethingWSService">
<wsdl:port name="GetSomethingWSPort" binding="ws:GetSomethingWSPortBinding">
<soap:address location="http://host:port/my.getSomethingWS"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
我尝试使用 JAXB 和 ant 构建脚本生成 Java 代码:
<project default="wsimport">
<target name="wsimport">
<echo>java home=${java.home}</echo>
<property name="wsdl.path" value="./"/>
<property name="wsdl.name" value="GetSomethingWS.wsdl"/>
<exec executable="${java.home}/../bin/wsimport">
<arg line="-keep -s ./src -p ./ -d ./bin -wsdllocation classpath:${wsdl.path}/${wsdl.name} src/${wsdl.path}/${wsdl.name}" />
</exec>
<copy file = "src/${wsdl.path}/${wsdl.name}" todir="./bin/${wsdl.path}" overwrite="true"/>
</target>
</project>
我收到这些警告和错误:
wsimport:
[echo] java home=C:\SoftwareAG32\jvm\jvm160_32\jre
[exec] parsing WSDL...
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'XML Schema'.
[exec] line 5 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'XML Schema'.
[exec] line 8 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw '12 September 2005'.
[exec] line 10 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'Table of contents'.
[exec] line 13 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'Introduction'.
[exec] line 15 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'Resources'.
[exec] line 16 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'Introduction'.
[exec] line 20 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'This document describes the '.
[exec] line 21 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'XML Schema'.
[exec] line 21 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'namespace.
[exec] It also contains a directory of links to these related resources, using '.
[exec] line 22 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'Resource Directory Description Language'.
[exec] line 23 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw '.'.
[exec] line 23 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'Related Resources for XML Schema'.
[exec] line 26 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'Schemas for XML Schema'.
[exec] line 28 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'DTD'.
[exec] line 31 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'A (non-normative) DTD '.
[exec] line 32 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'XMLSchema.dtd'.
[exec] line 32 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'for XML Schema. It
[exec] incorporates an auxiliary DTD, '.
[exec] line 33 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'datatypes.dtd'.
[exec] line 33 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw '.'.
[exec] line 33 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'XML Schema'.
[exec] line 38 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'An '.
[exec] line 39 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'XML Schema schema document'.
[exec] line 39 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'for XML Schema
[exec] schema documents. Last updated with release of XML Schema 2nd edition'.
[exec] line 40 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'in July 2004.'.
[exec] line 41 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'Normative References'.
[exec] line 48 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'XML Schema Part 1:
[exec] Structures'.
[exec] line 53 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw '(2nd Edition)'.
[exec] line 53 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'XML Schema Part 2:
[exec] Datatypes'.
[exec] line 56 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw '(2nd Edition)'.
[exec] line 56 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'XML Schema Part 0:
[exec] Primer'.
[exec] line 59 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw '(2nd Edition)'.
[exec] line 59 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-schema-ns: The namespace of element 'html' must be from the schema namespace, 'http://www.w3.org/2001/XMLSchema'.
[exec] line 3 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] s4s-elt-invalid: Element 'html' is not a valid element in a schema document.
[exec] line 3 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] src-import.2: The root element of document 'http://www.w3.org/2001/XMLSchema' has to have the namespace name 'http://www.w3.org/2001/XMLSchema' and the local name 'schema'.
[exec] line 3 of http://www.w3.org/2001/XMLSchema
[exec] [WARNING] src-resolve: Cannot resolve the name 'xs:schema' to a(n) 'element declaration' component.
[exec] line 9 of file:/C:/Users/yanja001/Documents/tools/workspace/WsdlValidation/src/GetSomethingWS.wsdl#types?schema1
[exec] [ERROR] Unexpected <html> appears at line 3 column 135
[exec] line 3 of http://www.w3.org/2001/XMLSchema
JAXB 或我的 WSDL 有问题吗?