2011-07-27 14 views
6

Na moim komputerze mam plik WSDL i wszystkie niezbędne pliki schematów. Próbuję użyć svcutil do utworzenia kodu proxy klienta z WSDL. Command:svcutil z pliku wsdl: Błąd Schematu z docelową przestrzenią nazw nie można znaleźć

svcutil myfile.wsdl 

Ciągle otrzymuję błąd przy użyciu svcutil, ale nie mają żadnych problemów podczas ładowania WSDL z SoapUI czy to coś znaczy.

Wciąż otrzymuję ten błąd:

Error: Cannot import wsdl:portType 
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter 
Error: Schema with target namespace 'http://www.crsoftwareinc.com/xml/ns/titanium/event/areventservice/v1_0' could not be found. 
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://www.crsoftwareinc.com/xml/ns/titanium/event/areventservice/v1_0']/wsdl:portType[@name='areventservice'] 

Oto WSDL:

<?xml version="1.0" encoding="UTF-8"?> 
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    name="areventservice" 
    targetNamespace="http://www.crsoftwareinc.com/xml/ns/titanium/event/areventservice/v1_0" 
    xmlns:tns="http://www.crsoftwareinc.com/xml/ns/titanium/event/areventservice/v1_0" 
    xmlns:es="http://www.crsoftwareinc.com/xml/ns/titanium/event/areventservice/v1_0"> 



    <wsdl:types> 
     <xsd:schema targetNamespace="http://www.crsoftwareinc.com/xml/ns/titanium/event/areventservice/v1_0" 
        xmlns:tns="http://www.crsoftwareinc.com/xml/ns/titanium/event/areventservice/v1_0" 
        xmlns:es="http://www.crsoftwareinc.com/xml/ns/titanium/event/areventservice/v1_0"> 

      <xsd:include schemaLocation="arevent-service.xsd"/> 
     </xsd:schema> 
    </wsdl:types> 

    <wsdl:message name="SaveAREventWithShortNames"> 
     <wsdl:part element="es:save-arevent-with-shortnames" name="SaveAREventWithShortNames"/> 
    </wsdl:message> 

    <wsdl:message name="RetrieveAREventByConsumerIdentifier"> 
     <wsdl:part element="es:retrieve-arevent-by-consumer-agency-identifier" name="RetrieveAREventByConsumerIdentifier"/> 
    </wsdl:message> 

    <wsdl:message name="RetrieveAREventByConsumerAccountIdentifier"> 
     <wsdl:part element="es:retrieve-arevent-by-consumer-account-agency-identifier" name="RetrieveAREventByConsumerAccountIdentifier"/> 
    </wsdl:message> 

    <wsdl:message name="RetrieveAREventResponse"> 
     <wsdl:part element="es:retrieve-arevent-response" name="RetrieveAREventResponse"/> 
    </wsdl:message> 

    <wsdl:message name="SaveAREventResponse"> 
     <wsdl:part element="es:save-arevent-response" name="SaveAREventResponse"/> 
    </wsdl:message> 

    <wsdl:portType name="areventservice"> 
     <wsdl:operation name="SaveAREventWithShortNames"> 
      <wsdl:input message="tns:SaveAREventWithShortNames" name="SaveAREventWithShortNames"/> 
      <wsdl:output message="tns:SaveAREventResponse" name="SaveAREventResponse"/>   
     </wsdl:operation> 
     <wsdl:operation name="RetrieveAREventByConsumerIdentifier"> 
      <wsdl:input message="tns:RetrieveAREventByConsumerIdentifier" name="RetrieveAREventByConsumerIdentifier"/> 
      <wsdl:output message="tns:RetrieveAREventResponse" name="RetrieveAREventResponse"/> 
     </wsdl:operation> 
     <wsdl:operation name="RetrieveAREventByConsumerAccountIdentifier"> 
      <wsdl:input message="tns:RetrieveAREventByConsumerAccountIdentifier" name="RetrieveAREventByConsumerAccountIdentifier"/> 
      <wsdl:output message="tns:RetrieveAREventResponse" name="RetrieveAREventResponseByAccountIdentifier"/> 
     </wsdl:operation> 
    </wsdl:portType> 

Tutaj jest plik schematu arevent-service.xsd (znajduje się w tym samym katalogu co WSDL):

<?xml version="1.0" encoding="UTF-8"?> 
<!-- (C)opyright 2004-2009 by CR Software, LLC - All Rights Reserved --> 


<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    xmlns:as="http://www.crsoftwareinc.com/xml/ns/titanium/event/areventservice/v1_0" 
    targetNamespace="http://www.crsoftwareinc.com/xml/ns/titanium/event/areventservice/v1_0" 
    xmlns:common="http://www.crsoftwareinc.com/xml/ns/titanium/common/v1_0" 
    elementFormDefault="qualified" attributeFormDefault="unqualified"> 

    <xs:import 
     schemaLocation="arevent-service-common.xsd" 
     namespace="http://www.crsoftwareinc.com/xml/ns/titanium/common/v1_0"/> 

    <xs:element name="save-arevent-with-shortnames" type="common:save-areventType" /> 

    <xs:element name="retrieve-arevent-by-consumer-agency-identifier" type="common:retrieve-by-consumer-agency-idType" /> 

    <xs:element name="retrieve-arevent-by-consumer-account-agency-identifier" type="common:retrieve-by-consumer-account-agency-idType" /> 

    <xs:element name="retrieve-arevent-response" type="as:retrieve-arevent-responseType" /> 

    <xs:complexType name="retrieve-arevent-responseType"> 
     <xs:sequence>        
      <xs:element name="arevent-page-results" type="common:arevent-page-resultsType" 
       minOccurs="1" maxOccurs="1" > 
       <xs:annotation>      
        <xs:documentation> 
         arevent page results type 
        </xs:documentation> 
       </xs:annotation>     
      </xs:element> 
     </xs:sequence> 
    </xs:complexType> 


    <xs:element name="save-arevent-response" type="as:save-arevent-responseType" /> 

    <xs:complexType name="save-arevent-responseType"> 
     <xs:sequence>        
      <xs:element name="arevent" type="common:areventType" 
       minOccurs="1" maxOccurs="1" > 
       <xs:annotation>      
        <xs:documentation> 
         arevent type 
        </xs:documentation> 
       </xs:annotation>     
      </xs:element> 
     </xs:sequence> 
    </xs:complexType> 
</xs:schema> 

Wszystkie przestrzenie nazw pasują do mnie. Tak jak powiedziałem, soapUI nie ma problemu z ładowaniem wsdl.

Nie mam pojęcia, co robić.

+0

Spróbuj podać ścieżki do wszystkich schematów po ścieżce do pliku WSDL. To właśnie musisz zrobić ze starszym WSDL.EXE. –

+1

człowiek mam około 40 referencyjnych schematów. Wypróbowałem kilka pierwszych i wydaje się, że przynajmniej generują nowe komunikaty o błędach. czy mówisz, że istnieje nowa ulepszona wersja, która nie wymaga podania wszystkich 40 !? –

+1

Nie. Musisz podać wszystkie z nich, lub użyć "Dodaj odniesienie do usługi", co zrobi to za Ciebie. –

Odpowiedz

12

Określ ścieżki do wszystkich plików WSDL i schematów w wierszu poleceń lub użyj polecenia "Dodaj odniesienie do usługi", które zrobi to za Ciebie.

Należy zauważyć, że "Dodaj odniesienie do usługi" działa z plikami w systemie lokalnym - nie tylko dla plików pod adresem URL.

+5

Miał podobny problem i mógł potwierdzić, że dodanie plików XSD do wywołania SvcUtil naprawiło problem. Wiersz polecenia wyglądał następująco: 'SvcUtil/t: kod WsdlFile.wsdl FirstSchemaFile.xsd SecondSchemaFile.xsd ThirdSchemaFile.xsd/l: cs' –

+0

Jawnie przekazywanie wszystkich plików XSD zamiast używania * .XSD również działało dla mnie. –

+0

Dodanie odwołania do usługi nie rozwiązało problemu http://stackoverflow.com/questions/15815095/cannot-load-xml-types. Każdy pomysł, dlaczego? – Lijo