开发者

Programmatically verifying a Web Reference matches an end point in .NET 3.5

I'm in the unfortunate situation where I need to consume web services that do not have a contract defined, as per normal SOA practices. This means that I need to guard against changes in the web services that break my web references. In the past, breaking changes in new web services versions such as the alteration of enumeration values have caused difficult to debug failures.

I'm using Web References to access the web services. I'm mostly consuming ASMX end points.

The sensible way to guard against breaking changes seems to be to check the endpoint for each web se开发者_C百科rvice, ensuring that the WSDL defined for the service matches the current endpoint schema. I'd like to do this at build time, and possibly also upon the application start up. Preferably the check would only fail for breaking changes, meaning that the addition of new elements to the endpoint schema would be okay.

One way to do this would be to generate a temporary WSDL from the endpoint, and verify that each XML element in the existing WSDL is contained within the temporary WSDL. But this seems fiddly, and I wonder if there is existing tooling, or a better way of doing this.

Thanks for your help and suggestions.


Check this question - it was asked for the same purpose. Mind you that service compatibility is a tricky issue and comparing even WSDL would only mean that you are guarding against syntactical changes. There is no way to detect semantical changes in service contract/implementation - only correct way would service offers versioning and then providing method to see if client is version compatible or not.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜