簡體   English   中英

添加服務引用會生成空的reference.cs和空的config.svcinfo文件

[英]Adding service reference generates empty reference.cs and empty config.svcinfo files

我正在嘗試連接到此Web服務: http : //www.eotd.org/search/server/terminology-service-soap.wsdl

網絡服務網站: http : //www.eccma.org/resources/webservices.php

當我在C#中添加服務引用時,生成的reference.cs文件為空,並且config.svcinfo和config91.svcinfo的行為,綁定和端點均不包含任何內容。 另外,不確定為什么,但是在創建的服務引用中有兩個不同的wsdl文件。

我已經嘗試過在SO上發布的解決方案,例如取消選中“引用的程序集中的重用類型”並將集合類型更改為Generic.List,但到目前為止沒有任何效果。

任何人都可以實際連接到該Web服務嗎? 關於問題是什么?

我使用命令svcutil http://www.eotd.org/search/server/terminology-service-soap.wsdl運行svcutil並收到以下錯誤:

C:\\ temp> svcutil http://www.eotd.org/search/server/terminology-service-soap.wsdl Microsoft(R)服務模型元數據工具[Microsoft(R)Windows(R)Communication Foundation,版本4.0。 30319.33440]版權所有(c)Microsoft Corporation。 版權所有。

嘗試使用WS-Metadata Exchange或DISCO從“ http://www.eotd.org/search/server/terminology-service-soap.wsdl ”下載元數據。 錯誤:無法導入wsdl:portType詳細信息:運行WSDL導入擴展時拋出了異常:System.ServiceModel.Description.XmlSerializerMessageContractImporter錯誤:具有目標名稱空間'urn:iso:std:iso:ts:29002:-20:ed的架構-1:tech:xml-schema:resolution-service-data找不到。 錯誤的XPath來源:// wsdl:definitions [@ targetNamespace ='urn:iso:std:iso:ts:29002:-20:ed-1:tech:web-service:terminology-service'] / wsdl:portType [ @na me ='terminology_service']

錯誤:無法導入wsdl:binding詳細信息:導入wsdl:binding所依賴的wsdl:portType時出錯。 wsdl:portType的XPath:// wsdl:definitions [@ targetNamespace ='urn:iso:std:iso:ts:29002:-20:ed-1:tech:web-service:terminology-service'] / wsdl:portType [@n ame ='terminology_service']錯誤的XPath來源:// wsdl:definitions [@ targetNamespace ='urn:iso:std:iso:ts:29002:-20:ed-1:tech:web-service:terminology -service:soap'] / wsdl:binding [@ name ='terminology_service_SOAP_binding']

錯誤:無法導入wsdl:port詳細信息:導入wsdl:port所依賴的wsdl:binding時出錯。 wsdl:binding的XPath:// wsdl:definitions [@ targetNamespace ='urn:iso:std:iso:ts:29002:-20:ed-1:tech:web-service:terminology-service:soap'] / wsdl :binding [@ name ='terminology_service_SOAP_binding']錯誤的XPath來源:// wsdl:definitions [@ targetNamespace ='urn:iso:std:iso:ts:29002:-20:ed-1:tech:web-service: terminology-service:soap'] / wsdl:service [@ name ='terminology_service'] / wsdl:port [@ name ='terminology_service_port']

正在生成文件...警告:未生成代碼。 如果您嘗試生成客戶端,這可能是因為元數據文檔不包含任何有效的合同或服務,或者是因為發現所有合同/服務都存在於/ reference程序集中。 驗證是否已將所有元數據文檔傳遞給該工具。

警告:如果要從架構生成數據協定,請確保使用/ dataContractOnly選項。

您鏈接到的WSDL是有效的。 但是,看來Microsoft工具無法遵循相對的導入路徑-John Saunders嘗試了svcutil.exe,而我剛開始使用wsdl.exe。

不幸的是,這里公開的WSDL充滿了它們。

例如,

<wsdl:import namespace="urn:iso:std:iso:ts:29002:-20:ed-1:tech:web-service:terminology-service" location="terminology-service.wsdl"/>

鏈接到以下位置: http : //www.eotd.org/search/server/terminology-service.wsdl

從該文件中可以導入更多內容:

<xsd:import namespace="urn:iso:std:iso:ts:29002:-5:ed-1:tech:xml-schema:identifier" schemaLocation="identifier.xsd"/>
<xsd:import namespace="urn:iso:std:iso:ts:29002:-20:ed-1:tech:xml-schema:resolution-service-data" schemaLocation="resolution-service-data.xsd"/>
<xsd:import namespace="urn:iso:std:iso:ts:29002:-20:ed-1:tech:xml-schema:terminology-service-data" schemaLocation="terminology-service-data.xsd"/>
<xsd:import namespace="urn:iso:std:iso:ts:29002:-6:ed-1:tech:xml-schema:terminology-service-dictionary" schemaLocation="terminology-service-dictionary.xsd"/>
<xsd:import namespace="urn:iso:std:iso:ts:29002:-20:ed-1:tech:xml-schema:ontology-service-data" schemaLocation="ontology-service-data.xsd"/>

所有這些都是相對導入路徑。 我看了幾個XSD導入,它們還包括相對導入路徑。

因此,最簡單的方法是找到一種使工具遵循相對路徑的方法。 您也可以手動下載每個資源文件,然后編輯它們以確保所有導入路徑都是絕對的。 但是,我不確定Microsoft工具是否可以遵循文件系統上的路徑,或者它們是否需要為URI。

如果不是,那么您必須告訴供應商您不能使用該服務,因為所有各種導入都需要絕對URI。

編輯其他人似乎已經在這里成功完成了本地導入路徑https://stackoverflow.com/a/19912058/569662

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM