簡體   English   中英

無法在VS2017中從WSDL生成代理

[英]Failing to generate proxy from WSDL in VS2017

我有一個WSDL,我嘗試從Visual Studio 2017中生成客戶端代理。

  1. 右鍵單擊項目名稱(WinForm)
  2. 添加>服務參考
  3. 粘貼WSDL adr
  4. 單擊確定

現在我收到1個錯誤和20個警告

錯誤

嚴重級代碼描述項目文件行抑制狀態錯誤自定義工具錯誤:無法為服務引用“ServiceReference1”生成代碼。 有關詳細信息,請查看其他錯誤和警告消息。 WindowsFormsApp1 c:\\ users \\ Me \\ source \\ repos \\ WindowsFormsApp1 \\ WindowsFormsApp1 \\ Connected Services \\ ServiceReference1 \\ Reference.svcmap 1

警告(其中一些)

嚴重級代碼描述項目文件行抑制狀態警告自定義工具警告:無法導入wsdl:port詳細信息:導入wsdl:port依賴的wsdl:binding時出錯。 XPath到wsdl:binding://wsdl:definition [@targetNamespace='MyTest.GetInformation:v2']/wsdl:binding[@name='GetInformationBinding'] XPath到錯誤源:// wsdl:definitions [@ targetNamespace =' MyTest.GetInformation:v2'] / wsdl:service [@ name ='GetInformationService'] / wsdl:port [@ name ='GetInformationPort'] WindowsFormsApp1 c:\\ users \\ Me \\ source \\ repos \\ WindowsFormsApp1 \\ WindowsFormsApp1 \\ Connected Services \\ ServiceReference1 \\ Reference.svcmap 1

嚴重級代碼描述項目文件行抑制狀態警告自定義工具警告:無法導入wsdl:binding詳細信息:導入wsdl:binding依賴的wsdl:portType時出錯。 XPath到wsdl:portType://wsdl:definitionf [@targetNamespace ='MyTest.GetInformation:v2'] / wsdl:portType [@ name ='GetInformationInterface'] XPath到錯誤源:// wsdl:definitions [@ targetNamespace =' MyTest.GetInformation:v2'] / wsdl:binding [@ name ='GetInformationBinding'] WindowsFormsApp1 c:\\ users \\ Me \\ source \\ repos \\ WindowsFormsApp1 \\ WindowsFormsApp1 \\ Connected Services \\ ServiceReference1 \\ Reference.svcmap 1

嚴重級代碼描述項目文件行抑制狀態警告自定義工具警告:無法導入wsdl:portType詳細信息:運行WSDL導入擴展時引發異常:System.ServiceModel.Description.XmlSerializerMessageContractImporter錯誤:數據類型'MyTest.attentionSignal:v1:II ' 不見了。 XPath到錯誤源://wsdl:definitions[@targetNamespace='MyTest.GetInformation:v2']/wsdl:portType[@name='GetInformationInterface'] WindowsFormsApp1 c:\\ users \\ Me \\ source \\ repos \\ WindowsFormsApp1 \\ WindowsFormsApp1 \\ Connected Services \\ ServiceReference1 \\ Reference.svcmap 1

SoapUI 5.3.0可以從同一個WSDL生成代理,我也可以通過在VS2017中使用Web Reference(compability mode 2.0)來生成代理。 然而,后來的解決方案不適合我,因為我有來自此WSDL的v1的代碼,我想重用它。

編輯:

這是WSDL,在VS 2017中將其添加為服務參考,您應該看到問題: https ://1drv.ms/u/s !AskujIssKpne6170QEQdCLrkG8-u

  • 你應該使用瀏覽器在本地下載wsdl然后按照你的休息步驟
  • 右鍵單擊項目名稱(WinForm)
  • 添加>服務參考
  • 粘貼WSDL本地路徑,然后單擊“確定”

更新:如果以上方式不起作用。您可以嘗試其他方式 - 使用以下命令通過XSD.exe創建Web代理

wsdl.exe [path To Your WSDL File] //in visual studio command line
  • 這將生成代理類,您可以將其復制/移動到項目並使用它。

暫無
暫無

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

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