WSDL导入到.NET项目只创建一个空的命名空间 [英] Importing WSDL into a .NET project only creates an empty namespace

查看:302
本文介绍了WSDL导入到.NET项目只创建一个空的命名空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用WCF的第一次。这是我做的:

  1. 创建在VS 2010中一个控制台.NET 4项目
  2. 添加一个WSDL文件作为服务引用。

不过,我似乎无法能够使用该服务,因为没有创建类。该服务引用只是一个空的命名空间。

我在想什么?

下面是WSDL:

 < XML版本=1.0编码=UTF-8&GT?;
<! - 编辑与XMLSPY v2004相对。 3 U(http://www.xmlspy.com)由Christophe杜肯(DRYADE SA) - >
<! - 编辑的XMLSpy的V2007相对。 3 U(http://www.altova.com)由尼克JS诺尔斯(Kizoom) - >
<定义的xmlns =htt​​p://schemas.xmlsoap.org/wsdl/的xmlns:肥皂=htt​​p://schemas.xmlsoap.org/wsdl/soap/的xmlns:HTTP =HTTP://模式。 xmlsoap.org/wsdl/http/的xmlns:XSD =http://www.w3.org/2001/XMLSchema的xmlns:SOAPENC =http://schemas.xmlsoap.org/soap/encoding/的xmlns:默=htt​​p://schemas.xmlsoap.org/wsdl/mime/的xmlns:siriWS =HTTP://new.webservice.namespace的xmlns:Siri的=htt​​p://www.siri.org.uk/ Siri的的xmlns:NS =http://datex2.eu/schema/1_0/1_0的xmlns:NS1 =http://www.ifopt.org.uk/acsb的xmlns:NS2 =HTTP:// WWW .ifopt.org.uk / IFOPT的targetNamespace =HTTP://new.webservice.namespace>
  <类型>
        < XSD:架构的targetNamespace =HTTP://new.webservice.namespace>
            < XSD:导入的schemaLocation =siri.xsd命名空间=htt​​p://www.siri.org.uk/siri/>
        < / XSD:模式>
    < /类型>
    <消息名称=StopMonitoringServiceRequest>
        <部分名称=请求TYPE =Siri的:ServiceRequestStructure/>
    < /消息>
    <消息名称=StopMonitoringServiceDelivery>
        <部分名称=回答类型=Siri的:ServiceDeliveryStructure/>
    < /消息>
    <端口类型名称=SOAP端口>
        <操作NAME =GetStopMonitoringService>
            <输入消息=siriWS:StopMonitoringServiceRequest/>
            <输出消息=siriWS:StopMonitoringServiceDelivery/>
        < /运转>
    < /端口类型>
    <绑定名称=SiriSOAPBindingTYPE =siriWS:SOAP端口>
        <肥皂:绑定样式=RPC传输=htt​​p://schemas.xmlsoap.org/soap/http/>
        <! -  ====一般服务=====  - >
        <! -  ==== SIRI服务=====  - >
        <操作NAME =GetStopMonitoringService>
            <肥皂:操作的soapAction =GetStopMonitoringService/>
            <输入>
                <肥皂:身体使用=文字/>
            < /输入>
            <输出>
                <肥皂:身体使用=文字/>
            &所述; /输出GT;
        < /运转>
    < /装订>
    <服务名称=SiriServices>
        <端口名称=SiriWSPort绑定=siriWS:SiriSOAPBinding>
            <肥皂:地址位置=htt​​p://www.siri-service-location.com/>
        < /端口>
    < /服务>
    <! - 通用信息 - >
    <! -  SIRI功能服务 - >
    <! - 功能 - >
    < XSD:注释>
        < XSD:APPINFO的xmlns:克=htt​​p://www.govtalk.gov.uk/CM/gms>
            <元数据的xmlns =htt​​p://www.govtalk.gov.uk/CM/gms-xs>
                <凝聚>主要架构和LT; /汇聚>
                <观众>电子化服务的开发和LT; /观众>
                <贡献者>尼古拉斯·诺尔斯,KIZOOM有限公司,伦敦EC4A 1LT< /贡献者>
                <保险>欧洲和LT; /覆盖及GT;
                &LT;造物主&GT;&GT;起草了1.0版,由岑TC278 WG3 SG7克里斯托夫杜肯DRYADE SA的mailto:schemer@siri.org.uk< /造物主&GT;
                &LT;日期&GT;
                    &LT;创建&GT; 2005-03-01&LT; /创建&GT;
                &LT; /日期&GT;
                &LT;日期&GT;
                    &lt;变形&GT; 2005-05-11&LT; /修改&GT;
                &LT; /日期&GT;
                &LT;日期&GT;
                    &lt;变形&GT; 2007-01-30&LT; /修改&GT;
                &LT; /日期&GT;
                &LT;日期&GT;
                    &lt;变形&GT; 2007-04-17&LT; /修改&GT;
                    &LT;! - 命名空间的变化 - &GT;
                &LT; /日期&GT;
                &LT;日期&GT;
                    &lt;变形&GT; 2008-02-12&LT; /修改&GT;
                    &LT;! - 现状Exchnages  - &GT;
                &LT; /日期&GT;
                &LT;日期&GT;
                    &lt;变形&GT; 2007-04-17&LT; /修改&GT;
                    &LT;! - 命名空间修正 - &GT;
                    &LT;! - 添加StopMonitoringMultipleRequest  - &GT;
                &LT; /日期&GT;
                &LT;描述&GT;
                    &LT; P&GT; SIRI是实时信息交换欧洲CEN标准。这描述WSDL服务器绑定&LT; / P&GT;
                &LT; /说明&GT;
                &LT;格式&gt;
                    &LT;的MediaType&gt;文字/ XML&LT; /的MediaType&GT;
                    &LT;语法&GT; HTTP://www.w3.org/2001/XMLSchema< /语法&GT;
                    &LT;描述&GT; XML架构,W3C推荐标准2001年&LT; /说明&GT;
                &LT; /格式&gt;
                &LT;标识符&GT; {http://www.siri.org.uk/schemas/1.3/siri} siri_wsProducer.wsdl&LT; /标识符&GT;
                &LT;语言&GT; [ISO 639-2 / B] ENG&LT; /语言&GT;
                &LT;发布商GT; Kizoom,109-123克利夫顿街,伦敦EC4A 4LD&LT; /发行商&GT;
                &LT;大陆;权利与GT
                             &LT;版权&GT; CEN,VDV,RTIG 2005-2008&LT; /版权&GT;
                &LT; /版权&GT;
                &lt;信源&GT;
                    &LT; UL&GT;
                        &LT;李&GT; SIRI从VDV,RTIGXML和Trident的标准衍生LT; /李&GT;
                    &LT; / UL&GT;
                &LT; /来源&GT;
                &LT;状态&gt;批准和LT 1.0版草案; /状态&gt;
                &LT;主题&GT;
                    &LT;类别&GT;艺术,娱乐,旅游,观光,旅游(旅游),交通运输,
 航空运输,机场,
 港口和海运,轮渡(船用)
 公共交通,巴士服务,巴士服务,巴士站和车站,
 铁路运输,铁路车站和轨道,列车服务,地铁,
 商业和工业,交通运输,航空运输,港口和海上运输,公共交通,
 铁路运输,公路运输和公路运输
 &LT; /分类&GT;
                    &LT;项目&GT;岑TC278 WG3 SG7&LT; /项目&GT;
                &LT; /主题&GT;
                &LT;标题&GT; SIRI的XML模式。 WSDL服务器绑定。 &LT; /标题&GT;
                &LT;类型&GT;标LT; /型号&GT;
            &LT; /元&GT;
        &LT; / XSD:APPINFO&GT;
    &LT; / XSD:注释&GT;
    &LT;! -  ========所有的结构从siri.xsd正在添加=========  - &GT;
    &LT;! -  ======== Descritions请求参数(请求和应答)的=========  - &GT;
    &LT;! -  ========服务请求=========  - &GT;
    &所述;! -  ==== StopMonitoring ==  - &GT;
    &LT;! -  ====港口=====  - &GT;
    &LT;! -  ==== BINDINGS =====  - &GT;
&LT; /定义&GT;
 

解决方案

显然存在错误导入模式,我应该看在错误列表窗口。

I'm trying to use WCF for the first time. Here's what I did:

  1. Created a console .NET 4 project in VS 2010
  2. Added a WSDL file as a service reference.

However, I can't seem to be able to use the service, because no classes were created. The service reference is just an empty namespace.

What am I missing?

Here is the WSDL:

<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v2004 rel. 3 U (http://www.xmlspy.com) by Christophe Duquesne (DRYADE SA) -->
<!-- edited with XMLSpy v2007 rel. 3 U (http://www.altova.com) by Nick js Knowles (Kizoom) -->
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:siriWS="http://new.webservice.namespace" xmlns:siri="http://www.siri.org.uk/siri" xmlns:ns="http://datex2.eu/schema/1_0/1_0" xmlns:ns1="http://www.ifopt.org.uk/acsb" xmlns:ns2="http://www.ifopt.org.uk/ifopt" targetNamespace="http://new.webservice.namespace">
  <types>
        <xsd:schema targetNamespace="http://new.webservice.namespace">
            <xsd:import schemaLocation="siri.xsd" namespace="http://www.siri.org.uk/siri"/>
        </xsd:schema>
    </types>
    <message name="StopMonitoringServiceRequest">
        <part name="Request" type="siri:ServiceRequestStructure"/>
    </message>
    <message name="StopMonitoringServiceDelivery">
        <part name="Answer" type="siri:ServiceDeliveryStructure"/>
    </message>
    <portType name="SOAP-Port">
        <operation name="GetStopMonitoringService">
            <input message="siriWS:StopMonitoringServiceRequest"/>
            <output message="siriWS:StopMonitoringServiceDelivery"/>
        </operation>
    </portType>
    <binding name="SiriSOAPBinding" type="siriWS:SOAP-Port">
        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
        <!-- ====general  services ===== -->
        <!-- ====SIRI services ===== -->
        <operation name="GetStopMonitoringService">
            <soap:operation soapAction="GetStopMonitoringService"/>
            <input>
                <soap:body use="literal"/>
            </input>
            <output>
                <soap:body use="literal"/>
            </output>
        </operation>
    </binding>
    <service name="SiriServices">
        <port name="SiriWSPort" binding="siriWS:SiriSOAPBinding">
            <soap:address location="http://www.siri-service-location.com"/>
        </port>
    </service>
    <!--General messages-->
    <!--SIRI Functional services-->
    <!--Capabilities-->
    <xsd:annotation>
        <xsd:appinfo xmlns:gms="http://www.govtalk.gov.uk/CM/gms">
            <Metadata xmlns="http://www.govtalk.gov.uk/CM/gms-xs">
                <Aggregation>main schema</Aggregation>
                <Audience>e-service developers</Audience>
                <Contributor>Nicholas Knowles, KIZOOM LTD., London EC4A 1LT</Contributor>
                <Coverage>Europe</Coverage>
                <Creator>>Drafted for version 1.0, by  Cen TC278 WG3 SG7 Christophe Duquesne DRYADE SA mailto:schemer@siri.org.uk</Creator>
                <Date>
                    <Created>2005-03-01</Created>
                </Date>
                <Date>
                    <Modified>2005-05-11</Modified>
                </Date>
                <Date>
                    <Modified>2007-01-30</Modified>
                </Date>
                <Date>
                    <Modified>2007-04-17</Modified>
                    <!-- Name Space changes -->
                </Date>
                <Date>
                    <Modified>2008-02-12</Modified>
                    <!-- Situation  Exchnages -->
                </Date>
                <Date>
                    <Modified>2007-04-17</Modified>
                    <!-- Name Space correction  -->
                    <!-- Add  StopMonitoringMultipleRequest  -->
                </Date>
                <Description>
                    <p>SIRI is a European CEN standard for the exchange of real time information. This describes WSDL Server binding</p>
                </Description>
                <Format>
                    <MediaType>text/xml</MediaType>
                    <Syntax>http://www.w3.org/2001/XMLSchema</Syntax>
                    <Description>XML schema, W3C Recommendation 2001</Description>
                </Format>
                <Identifier>{http://www.siri.org.uk/schemas/1.3/siri}siri_wsProducer.wsdl</Identifier>
                <Language>[ISO 639-2/B] ENG</Language>
                <Publisher>Kizoom, 109-123 Clifton Street, London EC4A 4LD </Publisher>
                <Rights>Unclassified
                             <Copyright>CEN, VDV, RTIG 2005-2008</Copyright>
                </Rights>
                <Source>
                    <ul>
                        <li>SIRI is derived from the VDV, RTIGXML and Trident standards.</li>
                    </ul>
                </Source>
                <Status>Version 1.0 Draft for approval</Status>
                <Subject>
                    <Category>Arts, recreation and travel, Tourism, Travel (tourism), Transport,
 Air transport, Airports,
 Ports and maritime transport, Ferries (marine),
 Public transport, Bus services, Coach services, Bus stops and stations,
 Rail transport, Railway stations and track, Train services, Underground trains,
 Business and industry, Transport, Air transport , Ports and maritime transport, Public transport,
 Rail transport, Roads and road transport
 </Category>
                    <Project>Cen TC278 WG3 SG7</Project>
                </Subject>
                <Title>SIRI XML schema. WSDL Server binding. </Title>
                <Type>Standard</Type>
            </Metadata>
        </xsd:appinfo>
    </xsd:annotation>
    <!-- ======== All the structures are comming from siri.xsd ========= -->
    <!-- ======== Descritions of request parameters (requests and answers) ========= -->
    <!-- ========Service Requests ========= -->
    <!-- ====StopMonitoring== -->
    <!-- ====PORTS ================ -->
    <!-- ====BINDINGS  ================ -->
</definitions>

解决方案

Apparently there were errors importing the schemas, I should have looked in the Error List window.

这篇关于WSDL导入到.NET项目只创建一个空的命名空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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