Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot import wsdl:portType, wsdl:binding, wsdl:port

I am getting error while generating proxy for WCF using SVCUtil. Error is

Attempting to download metadata from 'net.pipe://localhost/WebServices/Mgmt.svc' using WS-Metadata Exchange. This URL does not support DISCO.
Error: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: Referenced type 'SearchCriteria, Service.DataContracts, Version=2.5.0.0, Culture=neutral, PublicKeyToken=null
t be used since it does not match imported DataContract. Need to exclude this type from referenced types.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:portType[@name='IMgmt']


Error: 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='http://tempuri.org/']/wsdl:portType[@name='IMgmt']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:binding[@name='NetNamedPipeBinding_IMgmt']


Error: 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='http://tempuri.org/']/wsdl:binding[@name='NetNamedPipeBinding_IMgmt']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:service[@name='Mgmt']/wsdl:port[@name='NetNamedPipeBinding_I


Generating files...
Warning: No code was generated.
If you were trying to generate a client, this could be because the metadata documents did not contain any valid contracts or services
or because all contracts/services were discovered to exist in /reference assemblies. Verify that you passed all the metadata documents to the tool.

Warning: If you would like to generate data contracts from schemas make sure to use the /dataContractOnly option.

Everything was working fine till I add a enum member in data contract.

like image 683
Pranav Singh Avatar asked Sep 13 '13 12:09

Pranav Singh


2 Answers

Other problem could be, not passing all XSDs to svcutil. Our problem was we were using

svcutil.exe service.wsdl

instead of

svcutil.exe service.wsdl first.xsd second.xsd ......

FYI, we were integrating java web services to our wcf service/.net client.

like image 127
spicet Avatar answered Oct 20 '22 06:10

spicet


Turned out to be, we are reusing DataContract while generating proxy & old DataContract dll was not replaced in location from where it is referenced.

Also get help from an response in question what-does-this-wcf-error-mean-custom-tool-warning-cannot-import-wsdlporttype?

like image 32
Pranav Singh Avatar answered Oct 20 '22 06:10

Pranav Singh