svcutil не импортирует ошибки при импорте wsdl - PullRequest
0 голосов
/ 11 мая 2011

при создании прокси-класса из wsdl, который я получил от клиента, я получаю следующее предупреждение от svcutil:

Warning: Fault named "ContractException" in operation "create" cannot be imported.    
Unsupported WSDL, the fault message part must reference an element. This fault message    
does not reference an element. If you have edit access to the WSDL document, you can fix 
the problem by referencing a schema element using the 'element' attribute.

Итак, вот части из wsdl, в которых упоминается ContractException

<schema targetNamespace="http://exceptions.webservice"     
xmlns="http://www.w3.org/2001/XMLSchema" xmlns:impl="http://webservice" 
xmlns:intf="http://webservice"     
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
       <complexType name="ContractException">
        <sequence>
         <element name="message" nillable="true" type="xsd:string"/>
        </sequence>
       </complexType>
       <element name="ContractException" nillable="true" type="tns3:ContractException"/>
</schema>

<wsdl:message name="ContractException">
    <wsdl:part name="fault" type="tns3:ContractException"/>
</wsdl:message>

<wsdl:portType name="Contract">
    <wsdl:operation name="create" parameterOrder="pApiKey pContractData">
      <wsdl:input message="impl:createRequest" name="createRequest"/>
      <wsdl:output message="impl:createResponse" name="createResponse"/>
      <wsdl:fault message="impl:ContractException" name="ContractException"/>
    </wsdl:operation>
  </wsdl:portType>

 <wsdl:fault name="ContractException">
        <wsdlsoap:fault encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"    
 name="ContractException" use="encoded"/>
 </wsdl:fault>

Я не могу найти никаких проблем в этом wsdl, но, надеюсь, кто-нибудь подскажет мне, что я должен изменить, чтобы мой прокси был успешно создан. Wsdl был загружен с веб-сервера, поэтому я могу редактировать свою локальную копию (которую я использую для создания прокси-класса).

1 Ответ

0 голосов
/ 15 августа 2011

Исходя из отображаемого сообщения об ошибке, ошибка должна быть заключена в элемент, т. Е. -

вместо:

<wsdl:message name="ContractException">
    <wsdl:part name="fault" type="tns3:ContractException"/>
</wsdl:message>

, вам необходимо сделать следующее:

<wsdl:message name="ContractException">
    <wsdl:part name="fault" element="tns3:ContractException"/>
</wsdl:message>
...