WCF: Svcutil generates invalid client proxy, Apache AXIS Web Service, overload operations

北城余情 提交于 2019-11-28 01:27:45
Mitch

For what it is worth (4 years later), it seems that by calling WSDL.exe manually and passing the /protocol:SOAP parameter, this problem can be avoided. Generating a service client through the UI still seems to cause this issue as of VS2012 for services generated by Apache Axis.

Example usage:

c:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\NETFX 4.0 Tools>wsdl /l:cs /protocol:SOAP http://rxnav.nlm.nih.gov/RxNormDBService.xml /out:c:\drop\rxnavapi.cs

Edit: sphinxxx correctly noted that the SOAP protocol option is exposed in UI as "Add Web Reference", so executing wsdl.exe directly is not necessary.

The only workaround that I have been able to find is to edit the generated code by hand and remove all of the overloads that I don't need.

John Saunders

I didn't see this question before, because you had a "java" tag on it, and I ignore Java questions. Your question wasn't about Java, so should not have had a "java" tag.

svcutil is not renaming the overloaded operations. That's because there's no such thing as overloaded operations. WSDL has no concept of two operations with the same name, but using different messages.

If you look at the WSDL from Axis, I believe you'll find the operations have the numbers appended to them.


Correction: In a comment, Mark Good correctly points out that WSDL 1.1 does permit overloading. I happen to think it only makes any sense in the context of an RPC-based service, where the message name can be used to distinguish between one overload and another.

However, he may not be aware that operator overloading is prohibited by WS-I Basic Profile 1.1:

4.5.3 Distinctive Operations

Operation name overloading in a wsdl:portType is disallowed by the Profile.

R2304 A wsdl:portType in a DESCRIPTION MUST have operations with distinct values for their name attributes.

Note that this requirement applies only to the wsdl:operations within a given wsdl:portType. A wsdl:portType may have wsdl:operations with names that are the same as those found in other wsdl:portTypes.


If one reads more of WS-I BP1.1, one will learn why not everything in WSDL 1.1 is a good idea.

Write a script that'll do this text fix and set it as the post-build script for your proxy library.

Jiří Zídek

I have found that when using "old fashioned" AddServiceReference, it correctly generates classes with overloads, even in VS2012.

None of the solutions here worked for me.

Generating the reference in a vs2010 project targeted for .NET2, and then opening the solution in vs2012 or vs2013 targeting .NET4, does work though.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!