简体   繁体   中英

Failing to generate proxy from WSDL in VS2017

I have a WSDL that I try to generate a client proxy from within Visual Studio 2017.

  1. Right click project name (WinForm)
  2. Add > Service Reference
  3. Paste WSDL adr
  4. Click OK

Now I got 1 error and 20 warnings

Error

Severity Code Description Project File Line Suppression State Error Custom tool error: Failed to generate code for the service reference 'ServiceReference1'. Please check other error and warning messages for details. WindowsFormsApp1 c:\\users\\Me\\source\\repos\\WindowsFormsApp1\\WindowsFormsApp1\\Connected Services\\ServiceReference1\\Reference.svcmap 1

Warnings(some of them)

Severity Code Description Project File Line Suppression State Warning Custom tool warning: Cannot import wsdl:port Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on. XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='MyTest.GetInformation:v2']/wsdl:binding[@name='GetInformationBinding'] XPath to Error Source: //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

Severity Code Description Project File Line Suppression State Warning Custom tool warning: Cannot import wsdl:binding Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on. XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='MyTest.GetInformation:v2']/wsdl:portType[@name='GetInformationInterface'] XPath to Error Source: //wsdl:definitions[@targetNamespace='MyTest.GetInformation:v2']/wsdl:binding[@name='GetInformationBinding'] WindowsFormsApp1 c:\\users\\Me\\source\\repos\\WindowsFormsApp1\\WindowsFormsApp1\\Connected Services\\ServiceReference1\\Reference.svcmap 1

Severity Code Description Project File Line Suppression State Warning Custom tool warning: Cannot import wsdl:portType Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter Error: The datatype 'MyTest.attentionSignal:v1:II' is missing. XPath to Error Source: //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 can generate proxy from the same WSDL and I can also genereate it by using Web Reference (compability mode 2.0) in VS2017. The later solution do however not work for me becouse I have code from v1 of this WSDL that I want to reuse.

Edit :

Here is the WSDL, add it as a service referece in VS 2017 and you should see the problem : https://1drv.ms/u/s!AskujIssKpne6170QEQdCLrkG8-u

  • you should download wsdl locally using browser then follow your rest steps
  • Right click project name (WinForm)
  • Add > Service Reference
  • Paste WSDL local path and Click OK

Update : If above way is not working.You can try another way - Create web proxy by XSD.exe using below command

wsdl.exe [path To Your WSDL File] //in visual studio command line
  • That will generate proxy classes which you can copy/move to your project and use it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM