2017-05-14 5 views
1

Ich habe versucht, eine Lösung für mein Problem zu suchen und ist nicht erfolgreich.Die Deklaration des Elements 'wsdl: definitions' konnte nicht gefunden werden.

Wenn ich versuche, meine XML-Datei mit dem XSD ich den nächsten Fehler bin immer zu überprüfen:

"cvc-elt.1: Cannot find the declaration of element 'wsdl:definitions'"

ich es mit http://www.xmlvalidation.com/index.php bin Validierung?

in anderen Validator Ich erhalte:

element definitions: Schemas validity error : Element '{ http://schemas.xmlsoap.org/wsdl/ }definitions': No matching global declaration available for the validation root.

Meine XML/WSDL-Datei ist

<?xml version='1.0' encoding='UTF-8'?><wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://com.my.company/IFBTCIBPSI" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="IFBTCIBPSI" targetNamespace="http://com.my.company/IFBTCIBPSI"> 
    <wsdl:types> 
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://com.my.company/IFBTCIBPSI" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:QF2="urn:http://com.my.company/RSException_ARRAY" xmlns:QF1="urn:http://com.my.company/RSErrorMessage_ARRAY" xmlns:Q5="urn:com/EXCEPTION_ARRAY" xmlns:Q4="urn:com/IMOFDA" xmlns:Q3="urn:com/IMOC" xmlns:Q2="urn:com/IMIC" targetNamespace="http://com.my.company/IFBTCIBPSI"> 
    <xsd:import namespace="urn:http://com.my.company/RSErrorMessage_ARRAY" schemaLocation="http://mycompany.com/IFBTCIBPSI?xsd=RSErrorMessage_ARRAY.xsd" /> 
    <xsd:import namespace="urn:http://com.my.company/RSException_ARRAY" schemaLocation="http://mycompany.com/IFBTCIBPSI?xsd=RSException_ARRAY.xsd" /> 
    <xsd:import namespace="urn:com/IMIC" schemaLocation="http://mycompany.com/IFBTCIBPSI?xsd=IMIC.xsd" /> 
    <xsd:import namespace="urn:com/IMOC" schemaLocation="http://mycompany.com/IFBTCIBPSI?xsd=IMOC.xsd" /> 
    <xsd:import namespace="urn:com/IMOFDA" schemaLocation="http://mycompany.com/IFBTCIBPSI?xsd=IMOFDA.xsd" /> 
    <xsd:import namespace="urn:com/EXCEPTION_ARRAY" schemaLocation="http://mycompany.com/IFBTCIBPSI?xsd=EXCEPTION_ARRAY.xsd" /> 
    <xsd:element name="IFBTCIBP"> 
    <xsd:complexType> 
     <xsd:sequence> 
     <xsd:element ref="Q2:IMIC" /> 
     <xsd:element ref="Q5:EXCEPTION_ARRAY" /> 
     </xsd:sequence> 
    </xsd:complexType> 
    </xsd:element> 
    <xsd:element name="IFBTCIBPR"> 
    <xsd:complexType> 
     <xsd:sequence> 
     <xsd:element ref="Q3:IMOC" /> 
     <xsd:element ref="Q4:IMOFDA" /> 
     </xsd:sequence> 
    </xsd:complexType> 
    </xsd:element> 
    <xsd:element name="RSError"> 
    <xsd:complexType> 
     <xsd:sequence> 
     <xsd:element ref="QF1:RSErrorMessage_ARRAY" /> 
     <xsd:element ref="QF2:RSException_ARRAY" /> 
     </xsd:sequence> 
    </xsd:complexType> 
    </xsd:element> 
</xsd:schema> 
    </wsdl:types> 
    <wsdl:message name="IFBTCIBPR"> 
    <wsdl:part element="tns:IFBTCIBPR" name="parameters"> 
    </wsdl:part> 
    </wsdl:message> 
    <wsdl:message name="RSError"> 
    <wsdl:part element="tns:RSError" name="fault"> 
    </wsdl:part> 
    </wsdl:message> 
    <wsdl:message name="IFBTCIBP"> 
    <wsdl:part element="tns:IFBTCIBP" name="parameters"> 
    </wsdl:part> 
    </wsdl:message> 
    <wsdl:portType name="IFBTCIBPSI"> 
    <wsdl:operation name="IFBTCIBP"> 
<wsdl:documentation /> 
     <wsdl:input message="tns:IFBTCIBP"> 
    </wsdl:input> 
     <wsdl:output message="tns:IFBTCIBPR"> 
    </wsdl:output> 
     <wsdl:fault message="tns:RSError" name="fault"> 
    </wsdl:fault> 
    </wsdl:operation> 
    </wsdl:portType> 
    <wsdl:binding name="IFBTCIBPSI" type="tns:IFBTCIBPSI"> 
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> 
    <wsdl:operation name="IFBTCIBP"> 
     <soap:operation soapAction="http://com.my.company/IFBTCIBPSI/IFBTCIBP" /> 
     <wsdl:input> 
     <soap:body use="literal" /> 
     </wsdl:input> 
     <wsdl:output> 
     <soap:body use="literal" /> 
     </wsdl:output> 
     <wsdl:fault name="fault"> 
     <soap:fault name="fault" use="literal" /> 
     </wsdl:fault> 
    </wsdl:operation> 
    </wsdl:binding> 
    <wsdl:service name="IFBTCIBPSI"> 
<wsdl:documentation /> 
    <wsdl:port binding="tns:IFBTCIBPSI" name="IFBTCIBPSHttpS11Ep"> 
     <soap:address location="http://mycompany.com/IFBTCIBPSI" /> 
    </wsdl:port> 
    </wsdl:service> 
</wsdl:definitions> 

meine XSD-Datei ist:

<?xml version='1.0' encoding='UTF-8'?><xsd:schema 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:com/IMIC" 
targetNamespace="urn:com/IMIC"> 
<xsd:annotation> 
    <xsd:documentation> 
    </xsd:documentation> 
</xsd:annotation> 
<xsd:element name="IMIC"> 
    <xsd:complexType> 
     <xsd:sequence> 
      <xsd:element minOccurs="1" ref="ID" /> 
      <xsd:element minOccurs="1" ref="IT" /> 
      <xsd:element minOccurs="1" ref="CT" /> 
      <xsd:element minOccurs="1" ref="MI" /> 
      <xsd:element minOccurs="1" ref="KBC" /> 
      <xsd:element minOccurs="1" ref="TT" /> 
      <xsd:element minOccurs="1" ref="TI" /> 
      <xsd:element minOccurs="1" ref="CN" /> 
      <xsd:element minOccurs="0" ref="ST" /> 
     </xsd:sequence> 
    </xsd:complexType> 
</xsd:element> 
<xsd:element name="ID" type="xsd:date" /> 
<xsd:element name="IT" type="xsd:integer" /> 
<xsd:element name="CT" type="xsd:integer" /> 
<xsd:element name="MI" type="xsd:integer" /> 
<xsd:element name="KBC" type="xsd:integer" /> 
<xsd:element name="TT" type="xsd:integer" /> 
<xsd:element name="TI" type="xsd:string" /> 
<xsd:element name="CN" type="xsd:string" /> 
<xsd:element name="ST" type="xsd:integer" /> 
</xsd:schema> 

Bitte Ihre Hilfe.

Vielen Dank !!

Antwort

0

Das XML-Dokument hat seine Elemente der obersten Ebene im Namespace http://schemas.xmlsoap.org/wsdl/ (WSDL), so dass es gegen die XML Schema for WSDL validiert werden muss.

Sie benötigen auch das "Schemaschema" (XML-Schema für XML-Schema) im Geltungsbereich, da ein XML-Schema in wsdl:types geschachtelt ist, um sicherzustellen, dass dieser Teil auch ordnungsgemäß validiert wird.

Das in der Frage referenzierte Schema (für urn:com/IMIC) ist relevant für die eigentlichen SOAP-Daten (wie es vom verschachtelten Schema importiert wird), aber nicht für das WSDL-Dokument, soweit ich es verstehe. Die scheinbare Komplexität kommt von den zwei Ebenen der Validierung:

  • zum einem SOAP-Daten gegen WSDL (einschließlich gegen das verschachtelte XML-Schema)
  • zum anderen Dokument des WSDL validiert gegen das „Meta-Schema "(das Thema dieser Frage).

Es ist wichtig, nur auf einer Ebene gleichzeitig zu argumentieren.

Um sowohl die xmlvalidation.com als auch die meisten XML Schema-Überprüfungsmodule validieren zu können, müssen Sie die Schemaplokationen mit einem xsi:schemaLocation-Attribut versehen. Dieses Attribut akzeptiert eine Liste von URLs: einen Schemanamespace, seinen Speicherort (für WSDL ist es derselbe wie der Namespace), einen anderen Schemanamespace, seinen Speicherort usw. Da Sie zwei Schemas benötigen, ergeben sich daraus vier URLs:

<wsdl:definitions 
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:tns="http://com.my.company/IFBTCIBPSI" 
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
    name="IFBTCIBPSI" 
    targetNamespace="http://com.my.company/IFBTCIBPSI" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://schemas.xmlsoap.org/wsdl/ 
         http://schemas.xmlsoap.org/wsdl/ 
         http://www.w3.org/2001/XMLSchema 
         https://www.w3.org/2001/XMLSchema.xsd" > 
    <!-- rest of document --> 
</wsdl:definitions/> 

Beachten sie, dass xmlvalidation.com scheint zu fehlen zwei Dateien (XMLSchema.dtd und datatypes.dtd), dass es für fragt. Ist dies der Fall, können Sie einfach kopieren und einfügen von diesen Orten:

Auf meiner Seite scheint die Validierung dann erfolgreich sein (keine Fehler gefunden). Auch oXygen klagen nicht.

+0

Hallo Ghislain, Vielen Dank für Ihre Antwort, können Sie mir bitte sagen/vorschlagen, wie kann ich das Problem lösen? Vielen Dank !!! – Matan

+0

Hallo Matan, ja, ich habe meine Antwort mit spezifischen Anweisungen für xmlvalidation.com abgeschlossen (das xsi: schemaLocation ist standardisiert, also sollten andere Engines es auch verstehen). Ich hoffe das hilft. –

+0

Hallo Ghislain! Zunächst möchte ich Ihnen für Ihre Hilfe danken. Es ist sehr geschätzt! Wir haben Ihre Lösung geprüft und die Gültigkeitsprüfung für [xmlvalidation.com] [1] unter Verwendung der bereitgestellten .dtd-Dateien bestanden. Das Problem, dass die Validierung den ** xmllint ** Linux Validator ohne zusätzliche externe Schemata/Dateien passieren sollte. Ist es möglich, die Dateien von Beispiel zu bearbeiten/zu ändern/zu vereinfachen, um die Verwendung von externen .dtd-Dateien zu vermeiden? Nochmals vielen Dank! [1]: http://xmlvalidation.com – Matan

Verwandte Themen