2017-06-20 287 views
1

我有以下WSDL代碼爲我的萬維網應用程序:WSDL複雜CVC錯誤

<?xml version="1.0" encoding="UTF-8"?> 
<definitions xmlns:tns="http://www.ebi.ac.uk/webservices/whatizit/ws" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
    xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns="http://schemas.xmlsoap.org/wsdl/" 
    targetNamespace="http://www.ebi.ac.uk/webservices/whatizit/ws" name="whatizit"> 

    <types> 
     <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
      targetNamespace="http://www.ebi.ac.uk/webservices/whatizit/ws" 
      version="1.0"> 

      <xs:element xmlns:ns1="http://www.ebi.ac.uk/webservices/whatizit/ws" 
       type="ns1:search" name="search" /> 
      <xs:complexType name="search"> 
       <xs:sequence> 
        <xs:element type="xs:string" minOccurs="0" name="pipelineName" /> 
        <xs:element type="xs:string" minOccurs="0" name="query" /> 
        <xs:element name="limit"> 
         <xs:simpleType> 
          <xs:restriction base="xs:int"> 
           <xs:minInclusive value="0" /> 
           <xs:maxExclusive value="10000" /> 
          </xs:restriction> 
         </xs:simpleType> 
        </xs:element> 
       </xs:sequence> 
      </xs:complexType> 

      <xs:element xmlns:ns2="http://www.ebi.ac.uk/webservices/whatizit/ws" 
       type="ns2:searchResponse" name="searchResponse" /> 
      <xs:complexType name="searchResponse"> 
       <xs:sequence> 
        <xs:element type="xs:string" minOccurs="0" name="return" /> 
       </xs:sequence> 
      </xs:complexType> 

      <xs:element xmlns:ns3="http://www.ebi.ac.uk/webservices/whatizit/ws" 
       type="ns3:WhatizitException" name="WhatizitException" /> 
      <xs:complexType name="WhatizitException"> 
       <xs:sequence> 
        <xs:element type="xs:string" minOccurs="0" name="message" /> 
       </xs:sequence> 
      </xs:complexType> 

      <xs:element xmlns:ns4="http://www.ebi.ac.uk/webservices/whatizit/ws" 
       type="ns4:contact" name="contact" /> 
      <xs:complexType name="contact"> 
       <xs:sequence> 
        <xs:element type="xs:string" minOccurs="0" name="pipelineName" /> 
        <xs:element type="xs:string" minOccurs="0" name="text" /> 
        <xs:element type="xs:boolean" name="convertToHtml" /> 
       </xs:sequence> 
      </xs:complexType> 

      <xs:element xmlns:ns5="http://www.ebi.ac.uk/webservices/whatizit/ws" 
       type="ns5:contactResponse" name="contactResponse" /> 
      <xs:complexType name="contactResponse"> 
       <xs:sequence> 
        <xs:element type="xs:string" minOccurs="0" name="return" /> 
       </xs:sequence> 
      </xs:complexType> 

      <xs:element xmlns:ns6="http://www.ebi.ac.uk/webservices/whatizit/ws" 
       type="ns6:queryPmid" name="queryPmid" /> 
      <xs:complexType name="queryPmid"> 
       <xs:sequence> 
        <xs:element type="xs:string" minOccurs="0" name="pipelineName" /> 
        <xs:element type="xs:string" minOccurs="0" name="pmid" /> 
       </xs:sequence> 
      </xs:complexType> 

      <xs:element xmlns:ns7="http://www.ebi.ac.uk/webservices/whatizit/ws" 
       type="ns7:queryPmidResponse" name="queryPmidResponse" /> 
      <xs:complexType name="queryPmidResponse"> 
       <xs:sequence> 
        <xs:element type="xs:string" minOccurs="0" name="return" /> 
       </xs:sequence> 
      </xs:complexType> 

      <xs:element xmlns:ns8="http://www.ebi.ac.uk/webservices/whatizit/ws" 
       type="ns8:getPipelinesStatus" name="getPipelinesStatus" /> 
      <xs:complexType name="getPipelinesStatus" /> 

      <xs:element xmlns:ns9="http://www.ebi.ac.uk/webservices/whatizit/ws" 
       type="ns9:getPipelinesStatusResponse" name="getPipelinesStatusResponse" /> 
      <xs:complexType name="getPipelinesStatusResponse"> 
       <xs:sequence> 
        <xs:element xmlns:ns10="http://www.ebi.ac.uk/webservices/whatizit/ws" 
         type="ns10:selectItem" minOccurs="0" name="return" maxOccurs="unbounded" /> 
       </xs:sequence> 
      </xs:complexType> 

      <xs:complexType name="selectItem"> 
       <xs:sequence> 
        <xs:element type="xs:string" minOccurs="0" name="description" /> 
        <xs:element type="xs:boolean" name="disabled" /> 
        <xs:element type="xs:string" minOccurs="0" name="label" /> 
        <xs:element type="xs:anyType" minOccurs="0" name="value" /> 
       </xs:sequence> 
      </xs:complexType> 
     </xs:schema> 
    </types> 


    <message name="contact"> 
     <part element="tns:contact" name="parameters" /> 
    </message> 

    <message name="contactResponse"> 
     <part element="tns:contactResponse" name="parameters" /> 
    </message> 

    <message name="WhatizitException"> 
     <part element="tns:WhatizitException" name="fault" /> 
    </message> 

    <message name="getPipelinesStatus"> 
     <part element="tns:getPipelinesStatus" name="parameters" /> 
    </message> 

    <message name="getPipelinesStatusResponse"> 
     <part element="tns:getPipelinesStatusResponse" name="parameters" /> 
    </message> 

    <message name="queryPmid"> 
     <part element="tns:queryPmid" name="parameters" /> 
    </message> 

    <message name="queryPmidResponse"> 
     <part element="tns:queryPmidResponse" name="parameters" /> 
    </message> 

    <message name="search"> 
     <part element="tns:search" name="parameters" /> 
    </message> 

    <message name="searchResponse"> 
     <part element="tns:searchResponse" name="parameters" /> 
    </message> 


    <portType name="whatizit"> 
     <operation name="contact"> 
      <input message="tns:contact" /> 
      <output message="tns:contactResponse" /> 
      <fault message="tns:WhatizitException" name="WhatizitException" /> 
     </operation> 
     <operation name="getPipelinesStatus"> 
      <input message="tns:getPipelinesStatus" /> 
      <output message="tns:getPipelinesStatusResponse" /> 
      <fault message="tns:WhatizitException" name="WhatizitException" /> 
     </operation> 
     <operation name="queryPmid"> 
      <input message="tns:queryPmid" /> 
      <output message="tns:queryPmidResponse" /> 
      <fault message="tns:WhatizitException" name="WhatizitException" /> 
     </operation> 
     <operation name="search"> 
      <input message="tns:search" /> 
      <output message="tns:searchResponse" /> 
      <fault message="tns:WhatizitException" name="WhatizitException" /> 
     </operation> 
    </portType> 

    <binding type="tns:whatizit" name="pipelineBinding"> 
     <soap:binding style="document" 
      transport="http://schemas.xmlsoap.org/soap/http" /> 
     <operation name="contact"> 
      <soap:operation soapAction="" /> 
      <input> 
       <soap:body use="literal" /> 
      </input> 
      <output> 
       <soap:body use="literal" /> 
      </output> 
      <fault name="WhatizitException"> 
       <soap:fault use="literal" name="WhatizitException" /> 
      </fault> 
     </operation> 
     <operation name="getPipelinesStatus"> 
      <soap:operation soapAction="" /> 
      <input> 
       <soap:body use="literal" /> 
      </input> 
      <output> 
       <soap:body use="literal" /> 
      </output> 
      <fault name="WhatizitException"> 
       <soap:fault use="literal" name="WhatizitException" /> 
      </fault> 
     </operation> 
     <operation name="queryPmid"> 
      <soap:operation soapAction="" /> 
      <input> 
       <soap:body use="literal" /> 
      </input> 
      <output> 
       <soap:body use="literal" /> 
      </output> 
      <fault name="WhatizitException"> 
       <soap:fault use="literal" name="WhatizitException" /> 
      </fault> 
     </operation> 
     <operation name="search"> 
      <soap:operation soapAction="" /> 
      <input> 
       <soap:body use="literal" /> 
      </input> 
      <output> 
       <mime:multipartRelated> 
        <mime:part> 
         <soap:body parts="" use="literal" /> 
        </mime:part> 
        <mime:part> 
         <mime:content part="parameters" type="text/xml" /> 
        </mime:part> 
       </mime:multipartRelated> 
      </output> 
      <fault name="WhatizitException"> 
       <soap:fault use="literal" name="WhatizitException" /> 
      </fault> 
     </operation> 
    </binding> 
    <service name="whatizit"> 
     <port binding="tns:pipelineBinding" name="pipeline"> 
      <!--<soap:address location="http://www.ebi.ac.uk/webservices/whatizit/ws"/> --> 
      <soap:address location="http://localhost:8080/whatizit/ws" /> 
     </port> 
    </service> 
</definitions> 

現在我很新的使用WSDL Web服務。我遇到兩個錯誤,在這條線,我無法修復:

<output> 
       <mime:multipartRelated> 
        <mime:part> 
         <soap:body parts="" use="literal" /> 
        </mime:part> 
        <mime:part> 
         <mime:content part="parameters" type="text/xml" /> 
        </mime:part> 
       </mime:multipartRelated> 
      </output> 

在這條線找到多個註釋:

- cvc-attribute.3: The value '' of attribute 'parts' on element 'soap:body' is not valid with respect to its type, 
    'NMTOKENS'. 
    - cvc-minLength-valid: Value '' with length = '0' is not facet-valid with respect to minLength '1' for type 
    'NMTOKENS'. 

任何建議將不勝感激。謝謝你的幫助。

+0

我會稍後再看看,但是這個WSDL不符合WSI,這將解釋爲什麼它很難使用。我已經將它導入到SOAP用戶界面中,並會盡快得到它,但它違反了WSI合規性的BP2703。 – Namphibian

+0

謝謝。我設法解決這個問題,如下所示: <皁:身體部位= 「NMTOKENS」 使用= 「字面」/> 基本上,Eclipse的問提交爲類型NMTOKENS的部分。 – Martin

+0

Martin將其添加爲答案並接受您自己的答案。它可能會幫助別人。 – Namphibian

回答

1

最後,我設法解決了這個問題。基本上,Eclipse是要求提交的部分是nmtokens類型。所以,我從換了塊:

<output> 
      <mime:multipartRelated> 
       <mime:part> 
        <soap:body parts="" use="literal" /> 
       </mime:part> 
       <mime:part> 
        <mime:content part="parameters" type="text/xml" /> 
       </mime:part> 
      </mime:multipartRelated> 
     </output> 

<output> 
       <mime:multipartRelated> 
        <mime:part> 
         <soap:body parts="nmtokens" use="literal" /> 
        </mime:part> 
        <mime:part> 
         <mime:content part="parameters" type="text/xml" /> 
        </mime:part> 
       </mime:multipartRelated> 
      </output> 

和錯誤消失。