xsd验证中的问题

时间:2017-07-24 03:37:58

标签: xml web-services xsd wsdl

我在xsd valisdation期间遇到错误:

错误:src-resolve.4.2:解析组件&#ns; ns0:dachExceptionData'时出错。检测到&#ns; ns0:dachExceptionData'在名称空间' http://com.dachser.edi.ext.api.ping.service.PingEdiExtService'中,来自此命名空间的组件无法从架构文档&file:/ C:/ Users / anujkumar / Downloads / wsdl%20test / pingEdiExtService引用。 WSDL&#39 ;.如果这是不正确的命名空间,可能是' ns0:dachExceptionData'的前缀。需要改变。如果这是正确的命名空间,那么适当的导入'标签应添加到'文件:/ C:/Users/anujkumar/Downloads/wsdl%20test/pingEdiExtService.wsdl'。行号:2列号:96文字系统id文件:/ C:/Users/anujkumar/Downloads/wsdl%20test/pingEdiExtService.wsdl

WSDL是:

<wsdl:definitions name="PingEdiExtServiceSoapImplService" targetNamespace="http://com.dachser.edi.ext.api.ping.service.PingEdiExtService"><wsdl:types><xs:schema elementFormDefault="unqualified" targetNamespace="http://com.dachser.edi.ext.api.ping.service.PingEdiExtService" version="1.0"><xs:element name="ping" type="tns:ping"/><xs:element name="pingResponse" type="tns:pingResponse"/><xs:complexType name="ping"><xs:sequence/></xs:complexType><xs:complexType name="pingResponse"><xs:sequence><xs:element minOccurs="0" name="return" type="xs:string"/></xs:sequence></xs:complexType><xs:complexType name="dachExceptionData"><xs:sequence><xs:element minOccurs="0" name="cause" type="xs:string"/><xs:element name="expType" type="xs:int"/><xs:element minOccurs="0" name="message" type="xs:string"/></xs:sequence></xs:complexType></xs:schema><xsd:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://exception.ws.dachser.com"><xsd:element name="DachUncheckedExceptionSoap" nillable="true" type="ns0:dachExceptionData"/></xsd:schema></wsdl:types><wsdl:message name="DachUncheckedExceptionSoap"><wsdl:part element="ns1:DachUncheckedExceptionSoap" name="DachUncheckedExceptionSoap">
    </wsdl:part></wsdl:message><wsdl:message name="ping"><wsdl:part element="tns:ping" name="parameters">
    </wsdl:part></wsdl:message><wsdl:message name="pingResponse"><wsdl:part element="tns:pingResponse" name="parameters">
    </wsdl:part></wsdl:message><wsdl:portType name="PingEdiExtServiceSoapImpl"><wsdl:operation name="ping"><wsdl:input message="tns:ping" name="ping">
    </wsdl:input><wsdl:output message="tns:pingResponse" name="pingResponse">
    </wsdl:output><wsdl:fault message="tns:DachUncheckedExceptionSoap" name="DachUncheckedExceptionSoap">
    </wsdl:fault></wsdl:operation></wsdl:portType><wsdl:binding name="PingEdiExtServiceSoapImplServiceSoapBinding" type="tns:PingEdiExtServiceSoapImpl"><soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/><wsdl:operation name="ping"><soap:operation soapAction="" style="document"/><wsdl:input name="ping"><soap:body use="literal"/></wsdl:input><wsdl:output name="pingResponse"><soap:body use="literal"/></wsdl:output><wsdl:fault name="DachUncheckedExceptionSoap"><soap:fault name="DachUncheckedExceptionSoap" use="literal"/></wsdl:fault></wsdl:operation></wsdl:binding><wsdl:service name="PingEdiExtServiceSoapImplService"><wsdl:port binding="tns:PingEdiExtServiceSoapImplServiceSoapBinding" name="PingEdiExtServiceSoapImplPort"><soap:address location="https://edi.dachser.com/soap/ext/pingEdiExtService"/></wsdl:port></wsdl:service></wsdl:definitions>

虽然我可以在https://www.wsdl-analyzer.com/

验证此wsdl

wsdl有什么问题?

由于

1 个答案:

答案 0 :(得分:0)

我看到的主要问题是没有明确定义某些名称空间。我添加了它们(xmlns:tns =&#34; http://com.dachser.edi.ext.api.ping.service.PingEdiExtService" xmlns:ns0 =&#34; http://exception.ws .dachser.com&#34;                   的xmlns:WSDL =&#34; HTTP://schemas.xmlsoap.org/wsdl/"的xmlns:XS =&#34; HTTP://www.w3.org/2001/XMLSchema" xmlns:soap =&#34; http://schemas.xmlsoap.org/wsdl/soap/")到定义中。

整个wsdl具有以下定义:

<wsdl:definitions name="PingEdiExtServiceSoapImplService" targetNamespace="http://com.dachser.edi.ext.api.ping.service.PingEdiExtService"
                  xmlns:tns="http://com.dachser.edi.ext.api.ping.service.PingEdiExtService" xmlns:ns0="http://exception.ws.dachser.com"
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
  <wsdl:types>
    <xs:schema elementFormDefault="unqualified" targetNamespace="http://com.dachser.edi.ext.api.ping.service.PingEdiExtService"
               xmlns:tns="http://com.dachser.edi.ext.api.ping.service.PingEdiExtService" version="1.0">
      <xs:element name="ping" type="tns:ping"/>
      <xs:element name="pingResponse" type="tns:pingResponse"/>
      <xs:complexType name="ping">
        <xs:sequence/>
      </xs:complexType>
      <xs:complexType name="pingResponse">
        <xs:sequence>
          <xs:element minOccurs="0" name="return" type="xs:string"/>
        </xs:sequence>
      </xs:complexType>
    </xs:schema>
    <xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://exception.ws.dachser.com"
               xmlns:ns0="http://exception.ws.dachser.com">
      <xs:element name="DachUncheckedExceptionSoap" nillable="true" type="ns0:dachExceptionData"/>
      <xs:complexType name="dachExceptionData">
        <xs:sequence>
          <xs:element minOccurs="0" name="cause" type="xs:string"/>
          <xs:element name="expType" type="xs:int"/>
          <xs:element minOccurs="0" name="message" type="xs:string"/>
        </xs:sequence>
      </xs:complexType>
    </xs:schema>
  </wsdl:types>
  <wsdl:message name="DachUncheckedExceptionSoap">
    <wsdl:part name="DachUncheckedExceptionSoap" element="ns0:DachUncheckedExceptionSoap"/>
  </wsdl:message>
  <wsdl:message name="ping">
    <wsdl:part element="tns:ping" name="parameters"/>
  </wsdl:message>
  <wsdl:message name="pingResponse">
    <wsdl:part element="tns:pingResponse" name="parameters"/>
  </wsdl:message>
  <wsdl:portType name="PingEdiExtServiceSoapImpl">
    <wsdl:operation name="ping">
      <wsdl:input message="tns:ping" name="ping"/>
      <wsdl:output message="tns:pingResponse" name="pingResponse"/>
      <wsdl:fault message="tns:DachUncheckedExceptionSoap" name="DachUncheckedExceptionSoap"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="PingEdiExtServiceSoapImplServiceSoapBinding" type="tns:PingEdiExtServiceSoapImpl">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="ping">
      <soap:operation soapAction="http://com.dachser.edi.ext.api.ping.service.PingEdiExtService" style="document"/>
      <wsdl:input name="ping">
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="pingResponse">
        <soap:body use="literal"/>
      </wsdl:output>
      <wsdl:fault name="DachUncheckedExceptionSoap">
        <soap:fault name="DachUncheckedExceptionSoap" use="literal"/>
      </wsdl:fault>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="PingEdiExtServiceSoapImplService">
    <wsdl:port binding="tns:PingEdiExtServiceSoapImplServiceSoapBinding" name="PingEdiExtServiceSoapImplPort">
      <soap:address location="https://edi.dachser.com/soap/ext/pingEdiExtService"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>