wsdl 文件中的 svcutil:找不到目标命名空间的错误架构 [英] svcutil from wsdl file: Error Schema with target namespace could not be found

查看:39
本文介绍了wsdl 文件中的 svcutil:找不到目标命名空间的错误架构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的机器上,我有一个 WSDL 文件和所有必要的模式文件.我正在尝试使用 svcutil 从 WSDL 创建客户端代理代码.命令:

On my machine I have a WSDL file and all the necessary schema files. I am trying to use svcutil to create client proxy code from the WSDL. Command:

svcutil myfile.wsdl

我在使用 svcutil 时不断收到错误消息,但是如果这意味着什么,那么在使用 soapUI 加载 wsdl 时没有问题.

I keep getting an error when using svcutil, but have no problems when loading the wsdl with soapUI if that means anything.

我不断收到此错误:

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

这是 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>

这是架构文件 arevent-service.xsd(与 WSDL 位于同一目录中):

Here is the schema file arevent-service.xsd (located in same directory as 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>

目标命名空间看起来都与我匹配.就像我说的,soapUI 加载 wsdl 没有问题.

The target namespaces all look like they match to me. Like I said, soapUI has not problem loading the wsdl.

我不知道该怎么办.

推荐答案

要么在命令行上指定所有 WSDL 和模式文件的路径,要么使用添加服务引用",这将为您完成.

Either specify the paths to all of the WSDL and schema files on the command line, or else use "Add Service Reference", which will do that for you.

请注意,添加服务引用"确实适用于本地系统上的文件 - 而不仅仅是 URL 上的文件.

Note that "Add Service Reference" does work with files on your local system - not just for files at a URL.

这篇关于wsdl 文件中的 svcutil:找不到目标命名空间的错误架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆