0
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:tns="http://schemas.ocbc.com/soa/WSDL/service/CBS-CustAddress-I" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns="http://schemas.ocbc.com/soa/emf/common/envelope/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://schemas.ocbc.com/soa/WSDL/service/CBS-CustAddress-I">
    <import namespace="http://schemas.ocbc.com/soa/emf/common/envelope/" location="../Schemas/XML/CBS-CustAddress-I-ServiceEnvelope.xsd"/>
    <message name="InputMessage">
        <part name="InputMessage" element="ns:ServiceEnvelope"/>
    </message>
    <message name="OutMessage">
        <part name="OutMessage" element="ns:ServiceEnvelope"/>
    </message>
    <message name="FaultMessage">
        <part name="FaultMessage" element="ns:ServiceEnvelope"/>
    </message>
    <portType name="PortType">
        <operation name="Operation">
            <input message="tns:InputMessage"/>
            <output message="tns:OutMessage"/>
            <fault name="fault1" message="tns:FaultMessage"/>
        </operation>
    </portType>
</definitions>

我正在尝试在 Eclipse 中为上述 WSDL 生成客户端,但出现以下错误。Java 1.7 eclipse kepler 为 wsdl 生成客户端代码

IWAB0399E Error in generating Java from WSDL:  java.io.IOException: Error: attribute is of type {http://schemas.ocbc.com/soa/emf/common/envelope/}encodingStyle, which is not a simple type
    java.io.IOException: Error: attribute is of type {http://schemas.ocbc.com/soa/emf/common/envelope/}encodingStyle, which is not a simple type
    at org.apache.axis.wsdl.symbolTable.SymbolTable.addTypes(SymbolTable.java:1043)
    at org.apache.axis.wsdl.symbolTable.SymbolTable.addTypes(SymbolTable.java:1119)
    at org.apache.axis.wsdl.symbolTable.SymbolTable.addTypes(SymbolTable.java:1119)
    at org.apache.axis.wsdl.symbolTable.SymbolTable.populateTypes(SymbolTable.java:909)
    at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:705)
    at org.apache.axis.wsdl.symbolTable.SymbolTable.addTypes(SymbolTable.java:1092)
    at org.apache.axis.wsdl.symbolTable.SymbolTable.addTypes(SymbolTable.java:1119)
    at org.apache.axis.wsdl.symbolTable.SymbolTable.addTypes(SymbolTable.java:1119)
    at org.apache.axis.wsdl.symbolTable.SymbolTable.addTypes(SymbolTable.java:1119)
    at org.apache.axis.wsdl.symbolTable.SymbolTable.addTypes(SymbolTable.java:1119)
    at org.apache.axis.wsdl.symbolTable.SymbolTable.populateTypes(SymbolTable.java:909)
    at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:705)
    at org.apache.axis.wsdl.symbolTable.SymbolTable.add(SymbolTable.java:543)
    at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:518)
    at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:495)
    at org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:361)
    at java.lang.Thread.run(Unknown Source)

CBS-CustAddress-I-ServiceEnvelope.XSD:

 <?xml version="1.0" encoding="UTF-8"?>

<schema xmlns="http://www.w3.org/2001/XMLSchema"
 xmlns:emf-envelope="http://schemas.ocbc.com/soa/emf/common/envelope/"
 xmlns:xs="http://www.w3.org/2001/XMLSchema"
 xmlns:emf-header="http://schemas.ocbc.com/soa/emf/common/header"
 xmlns:emf-body="http://schemas.ocbc.com/soa/emf/common/body"
 xmlns:CBS-CustAddress-I="http://schemas.ocbc.com/soa/emf/service/CBS-CustAddress-I"
 targetNamespace="http://schemas.ocbc.com/soa/emf/common/envelope/"
 elementFormDefault="unqualified"
 attributeFormDefault="unqualified">
<import namespace="http://schemas.ocbc.com/soa/emf/common/header" schemaLocation="../../../../Schemas/XML/CommonHeader.xsd"/>
<import namespace="http://schemas.ocbc.com/soa/emf/common/body" schemaLocation="../../../../Schemas/XML/CommonBody.xsd"/>
<import namespace="http://schemas.ocbc.com/soa/emf/service/CBS-CustAddress-I" schemaLocation="CBS-CustAddress-I.xsd"/>
<attributeGroup name="encodingStyle">
    <attribute ref="emf-envelope:encodingStyle"/>
</attributeGroup>

<!-- Envelope, header and body -->
<element name="ServiceEnvelope" type="emf-envelope:ServiceEnvelope"/>
<complexType name="ServiceEnvelope">
    <sequence>
        <element ref="emf-envelope:ServiceHeader" minOccurs="0"/>
        <element ref="emf-envelope:ServiceBody"/>
        <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    </sequence>
    <anyAttribute namespace="##other" processContents="lax"/>
</complexType>
<element name="ServiceHeader" type="emf-envelope:ServiceHeader"/>
<complexType name="ServiceHeader">
    <sequence>
        <element ref="emf-header:CommonDetail"/>
        <choice>
            <element ref="emf-header:ClientDetail"/>
            <element ref="emf-header:ProviderDetail"/>
        </choice>
        <element ref="emf-header:SecurityDetail" minOccurs="0"/>
    </sequence>
</complexType>
<element name="ServiceBody" type="emf-envelope:ServiceBody"/>
<complexType name="ServiceBody">
    <choice>
        <element ref="CBS-CustAddress-I:RqDetail"/>
        <element ref="CBS-CustAddress-I:RsDetail"/>
        <element ref="emf-body:Error"/>
    </choice>
    <anyAttribute namespace="##any" processContents="lax"/>
</complexType>
<element name="CommonDetail" type="emf-envelope:CommonDetail"/>
<complexType name="CommonDetail">
    <sequence>
        <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    </sequence>
    <anyAttribute namespace="##any" processContents="lax"/>
</complexType>

<!-- Global Attributes.  The following attributes are intended to be usable via qualified attribute names on any complex type referencing them.  -->
<attribute name="mustUnderstand">
    <simpleType>
        <restriction base="xs:boolean">
            <pattern value="0|1"/>
        </restriction>
    </simpleType>
</attribute>
<attribute name="actor" type="xs:anyURI"/>
<simpleType name="encodingStyle">
    <annotation>
        <documentation>'encodingStyle' indicates any canonicalization conventions followed in the contents of the containing element.  For example, the value 'http://schemas.xmlsoap.org/soap/encoding/' indicates the pattern described in SOAP specification</documentation>
    </annotation>
    <list itemType="xs:anyURI"/>
</simpleType>
<attribute name="encodingStyle" type="emf-envelope:encodingStyle"/>

@vineeth:按要求附加 XSD

如果您也想参考的话,我还包括了我的 CBS-CustAddress-I.XSD 以防万一。

<?xml version = "1.0" encoding = "UTF-8"?>

   <xsd:schema xmlns = "http://schemas.ocbc.com/soa/emf/service/CBS-CustAddress-I"
 targetNamespace = "http://schemas.ocbc.com/soa/emf/service/CBS-CustAddress-I"
 xmlns:emf-aggregates = "http://schemas.ocbc.com/soa/emf/common/aggregates"
 xmlns:xsd = "http://www.w3.org/2001/XMLSchema"
 xmlns:emf-elements = "http://schemas.ocbc.com/soa/emf/common/elements"
 version = "1.0.01"
 elementFormDefault = "qualified">
<xsd:import namespace = "http://schemas.ocbc.com/soa/emf/common/aggregates" schemaLocation = "../../../../Schemas/XML/CommonAggregates.xsd"/>
<xsd:import namespace = "http://schemas.ocbc.com/soa/emf/common/elements" schemaLocation = "../../../../Schemas/XML/CommonElements.xsd"/>
<xsd:element name = "RqDetail">
    <xsd:complexType>
        <xsd:sequence>
            <xsd:sequence>
                <xsd:element ref = "emf-elements:PostalCode"/>
            </xsd:sequence>
            <xsd:element ref = "CountryCode" minOccurs = "0"/>
            <xsd:element ref = "emf-aggregates:SelectionDetail" minOccurs = "0"/>
        </xsd:sequence>
    </xsd:complexType>
</xsd:element>
<xsd:element name = "RsDetail">
    <xsd:complexType>
        <xsd:sequence>
            <xsd:element ref = "emf-aggregates:AddressDetail"/>
        </xsd:sequence>
    </xsd:complexType>
</xsd:element>
<xsd:element name = "CountryCode" type = "xsd:string"/>
   </xsd:schema>
4

1 回答 1

0

首先,我对 xsd 进口感到担忧:

 <import namespace="http://schemas.ocbc.com/soa/emf/common/header"
            schemaLocation="../../../../Schemas/XML/CommonHeader.xsd"/>
    <import namespace="http://schemas.ocbc.com/soa/emf/common/body"
            schemaLocation="../../../../Schemas/XML/CommonBody.xsd"/>
    <import namespace="http://schemas.ocbc.com/soa/emf/service/CBS-CustAddress-I"
            schemaLocation="CBS-CustAddress-I.xsd"/>

需要检查模式位置是否引用正确的位置。要检查这一点,最好通过 JDeveloper 之类的 IDE 进行检查。如果发现问题,它会给你警告。尝试将这些模式放置在与所有 WSDL 和 XSD 相同的位置,并同样更改路径。

您看到的错误可能是由于以下代码:

<attributeGroup name="encodingStyle">
    <attribute ref="emf-envelope:encodingStyle"/>
</attributeGroup>

它指的是找到定义但失败的位置。

我的建议主要是2:

1) 尽可能简化 XSD。2) 尝试使用与 eclipse 不同的 IDE。我更喜欢 Oracle Jdeveloper,因为它有简单的向导。

希望这可以帮助

于 2013-07-27T17:28:44.667 回答