WSDL客户端生成不完整不是简单的类型错误?

时间:2013-07-24 08:49:03

标签: wsdl

<?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>

1 个答案:

答案 0 :(得分: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"/>

如果Schema位置引用了正确的位置,则需要检查它们。要检查它,最好通过像JDeveloper这样的IDE进行检查。如果发现问题,它会发出警告。尝试将这些模式放在与所有WSDL和XSD相同的位置,同样也可以更改路径。

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

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

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

我的建议主要是2:

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

希望这有帮助