Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom Tool Warning: Cannot import wsdl:portType

Tags:

wcf

I am not sure what this error is. Thought I would ask you guys on stack overflow what it could be. I had to change the contract on my service, on a test client that I used, I updated the service reference. Now I am getting this warning. How can I resolve this particular issue.

like image 329
SoftwareSavant Avatar asked Aug 12 '11 19:08

SoftwareSavant


2 Answers

I found the answers in What does this WCF error mean: "Custom tool warning: Cannot import wsdl:portType" help. In my case, I chose unticking the 'Re-use types' box and that solved it.

Additional Thoughts: SOA, Distributed Objects, & Coupling

The ”Service Oriented” Vision implied by a WSDL and the WS-* standards is that the WSDL itself tells your client everything you need to know use the service. On this vision, unticking the 'Re-use types' box is the correct approach. You shouldn't be reusing types from anywhere except the wsdl.

Ticking the 're-use types' box is more a "Distributed Objects" approach: your client and service become coupled through the types in a shared dll. This is a strong distributed dependency. If the shared objects are updated, the service and all its clients must be updated, all in sync with each other. This is one reason why distributed objects fell very much out of favour and SOA took over.

Unless you company chose (possibly accidentally, by sharing libraries on a Nuget feed) a distributed objects architecture, and understand the costs, I would always untick the re-use types.

It reduces coupling.

like image 149
Chris F Carroll Avatar answered Sep 22 '22 09:09

Chris F Carroll


This was the first answer I found when searching for a similar problem, but my issue was a [DataContract] attribute applied to an enum without any [DataMember] attributes, making an empty data contract.

I used this as a resource:

http://www.lukepuplett.com/2010/02/empty-datacontract-causes-misleading.html

It appears as though it is advisable to allow WCF to infer a datacontract for enums.

like image 39
Todd A. Stedel Avatar answered Sep 23 '22 09:09

Todd A. Stedel