开发者

Custom Tool Warning: Cannot import wsdl:portType

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 contra开发者_C百科ct 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.


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.


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.


I find that this also can be solved by using the ?singleWsdl instead of just ?wsdl at the end. There are multiple WSDL files that are linked to, so something too naive to browse them can throw errors.


We had this problem today when trying to convert and old WSDL to a .cs fike with dotnet-svcutil.

We solved by replacing:

<xsd:complexContent>
    <xsd:restriction base="xsd:anyType" />
</xsd:complexContent>

With

<xsd:complexContent>
    <xsd:sequence>
        <xsd:element name="deleteThisField" type="xsd:string" />
    </xsd:sequence>
</xsd:complexContent>

And then manualy delete the deleteThisField string in the generated result code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜