2011-07-27 16 views
6

En mi máquina tengo un archivo WSDL y todos los archivos de esquema necesarios. Estoy tratando de usar svcutil para crear un código proxy del cliente desde el WSDL. Comando:svcutil from wsdl file: Error Schema con el espacio de nombres de destino no se pudo encontrar

svcutil myfile.wsdl 

Me aparece un error al utilizar svcutil, pero no tienen problemas al cargar el WSDL con soapUI si eso significa algo.

me siguen dando este error:

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'] 

Aquí está el 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> 

Aquí está el archivo de esquema arevent-service.xsd (situados en un mismo directorio que 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> 

Todos los espacios de nombres de destino parecen coincidir conmigo. Como dije, soapUI no tiene problemas para cargar el wsdl.

No tengo ni idea de qué hacer.

+0

Intente especificar las rutas a todos los esquemas después de la ruta al WSDL. Eso es lo que tienes que hacer con el viejo WSDL.EXE. –

+1

hombre tengo aproximadamente 40 esquemas referenciados. Intenté los primeros y parece que al menos está generando nuevos mensajes de error. ¿Estás diciendo que hay una nueva versión mejorada que no requiere especificar los 40? –

+1

No. Tendrá que especificarlos todos, o use "Agregar referencia de servicio", que lo hará todo por usted. –

Respuesta

12

O bien especifique las rutas a todos los archivos WSDL y de esquema en la línea de comandos, o bien utilice "Agregar referencia de servicio", que lo hará por usted.

Tenga en cuenta que "Agregar referencia de servicio" funciona con archivos en su sistema local, no solo para archivos en una URL.

+5

Tuvo un problema similar y puede confirmar que agregar los archivos XSD a la llamada SvcUtil solucionó el problema. La línea de comando se veía como: 'SvcUtil/t: código WsdlFile.wsdl FirstSchemaFile.xsd SecondSchemaFile.xsd ThirdSchemaFile.xsd/l: cs' –

+0

Pasar explícitamente todos los archivos XSD en lugar de utilizar * .XSD también me funcionó. –

+0

Agregar referencia de servicio no resolvió mi problema http://stackoverflow.com/questions/15815095/cannot-load-xml-types. ¿Alguna idea de por qué? – Lijo

Cuestiones relacionadas