I'm trying to connect to an ASP.NET 2.0 Web Service (ASMX) by using a WCF client proxy generated through the 'Add Service Reference'. The import works fine and the proxy classes are created however all dependency objects that are used as parameters and return values are duplicated in the generated source file.
This is due to the the service publishing both SOAP 1.1 and 1.2 bindings apparently and the importer apparently importing the bindings for each of the types repeatedly, so I end up with two partial classes for each dependent type. It looks something liekt his:
[System.SerializableAttribute()] public partial class wws_itemsRow : WcfWebStoreServiceClient.WebStoreConsumerService.wwDataRowContainer
And the second instance:
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.west-wind.com/WebStoreService/")] public partial class wws_itemsRow : wwDataRowContainer
They are generated slightly differently but this still leaves them generated as the same type that has overlapping fields and properties at this point. The code won't compile...
If I remove one of the set of classes I can get the service client to work correctly...
What's the way to make this work correctly? The service Url is here
I suppose I can turn off the dual bindings on the server, but this is hardly the right solution...
+++ Rick ---
Do you have the latest VS extensions for WCF installed? If not, can you try installing from http://www.microsoft.com/downloads/details.aspx?FamilyId=F54F5537-CC86-4BF5-AE44-F5A1E805680D&displaylang=en ? I tried to do "Add service reference" against your service using the latest bits and could not repro the problem.
Yeah I'm running the November CTP on Vista RTM...
Incidentally there are a bunch of odd things happening with SvcUtil.exe. I've posted more on this here:
It appears the presence or absence of a DataSet in one of the method signatures has a significant effect on how SvcUtil generates the service.
Incidentally the duplication problem has come and gone, and come back, then gone again. I can't seem to pin down when it happens and in which combination. Right now both of my services that were problematic work but I still have these inconsistencies that generate very different proxies based on whether there's a DataSet in any of the methods which seems very odd. The proxy signatures (for all classes generated) change significantly based on a single method change in the service.
+++ Rick ---
It seems that SVCUTIL is having problems with this service, even though it's a pretty basic ASMX service. I imported the service using the stock VS Generate Service Reference option from the project menu.
I can no longer get this duplicate class problem to occur on this service (but I've seen this happen on several other test services as well! But same thing - it'll generate a duplicate and then after tweaking both service and regenerating the duplication problem goes away). I can't explain what the difference is, since I haven't made any significant changes in the service on the server.
There's a new problem however and this may be related to these inconsistencies which I've outlined here:
Basically I've set up the the ASMX service in question two ways - once with a method that contains a DataSet parameter, once without that method. The proxy generates two very, very different service proxies depending on whether the DataSet is present. Oddly the absence of the DataSet makes the proxy generated not usable directly as it exposes the raw message objects on service methods rather than standard parameters.
You can find the two services here:
My concern is that this is somewhat inconsistent <s>. I've basically have gotten 3 different results for essentially a simple change in the Web service interface (although as I said I can't reproduce the duplicate class issue any longer <shrug>).
I know this sounds like a crazy man post <g>, but honestly I'm at a loss why any of these should happen. I'd expect SvcUtil (or the default VS usage of it) to generate a fairly predictable client proxy...
+++ Rick ---