Take the 2-minute tour ×

I have an existing project that consumes web services. One was added as a service reference, and the other as a web reference. I don't recall why one was added as a web reference, but perhaps it's because I couldn't get it to work!

The existing service reference for the one web service works fine, so it's not a .net version issue.

I can successfully create a service reference for the second web service, but none of the methods are available. The .wsdl shows the schema, but the Reference.vb shows only the Namespace, and none of the methods.

To clarify, these are two different 3rd party web service providers.

We'd like to move to the service reference so we have more control over the configuration as we're having various issues with timeouts.

Anyone come across this before?


Does it matter that there are two services at the address?


I'm using .net 3.5 and VS2008.

alt text

share|improve this question
Are you sure the WSDL that you are viewing is complete/correct? It may look good, but there could be a minor problem causing things to fail... –  Justin Niessner Mar 4 '10 at 15:07
It's the same wsdl location for the web reference, which works fine. –  ScottE Mar 4 '10 at 15:08
I have had this happen, and don't remember what I did to get the service reference instead. I, of course, didn't make a note of it. –  Anthony Potts Mar 4 '10 at 15:09
Cripes, thanks for nothing Anthony! –  ScottE Mar 4 '10 at 16:23
Yeah, I reallly wish I remembered. I think I just kept poking around in the reference adding dialog. –  Anthony Potts Mar 4 '10 at 16:39
show 7 more comments

5 Answers

up vote 8 down vote accepted

The Add Service Reference feature is notoriously a pig and is buggy - I use it most of the time, but occasionally I hit problems where the code it generates is either like this (i.e. non-existent) or it doesn't reuse types where it should do.

You should try using the svcutil command line tool (open a VS Command Prompt to run it), which although it is similar to the reference feature of VS is actually a completely different codebase. You can use that to generate a proxy, all the client-side types etc, just as with the service reference feature.

Most importantly - it seems to work nearly all the time - so long as the service itself is sane.

share|improve this answer
add comment

What exactly do you mean when you say, "the methods are not available"?

Many people who say things like that are expecting the methods to be available in exactly the same way as they were with "Add Web Reference". But they're different. See "How to Consume a Web Service".

share|improve this answer
John, if you read above you'll see that I'm already consuming one of the 3rd party web services successfully, and it was added as a service reference. The other I can add successfully, but there are no methods available under the namespace (intellisense or object browsing). It does work just fine when added as a web reference, however. –  ScottE Mar 13 '10 at 20:48
@ScottE: thanks for clarifying. I suggest you run svcutil from the command line to have it try to generate proxy classes. The benefit would be that if there were any errors, they would be displayed. You can also look in the reference.cs file to see if there are comments indicating problems in generating code, or you might notice a pattern in terms of what's present and what's absent. –  John Saunders Mar 14 '10 at 1:17
the reference.cs file is empty. I'll try the command line and see what happens. Thanks. –  ScottE Mar 14 '10 at 1:32
John - using svcutil did the trick. It wasn't part of your answer, so I couldn't mark your answer as correct. Thanks for the input. –  ScottE Mar 17 '10 at 12:32
@Scott: what was the error? –  John Saunders Mar 17 '10 at 13:13
show 3 more comments

I suspect it is trying to re-use the types from the other reference. Click Advanced... and remove the "re-use types in referenced assemblies" box. You should also ensure that the service name is unique, to avoid conflicts.

share|improve this answer
Nope, that's not it. I tried adding the service reference to a new web app project as well. Have you successfully added a service reference to a wsdl that has more than one endpoint available, via the add service reference wizard? Or, like John has recommended, does this need to be done via the command line? –  ScottE Mar 14 '10 at 12:26
add comment

Have you tried to add the reference to a C# project instead of a VB.NET one?

I noticed all the methods on your service are named "getXXX", maybe it's clashing with some "intelligent" processing on the VB.NET generator.

Try creating a new C# project and adding the service reference.

share|improve this answer
Seems like a shot in the dark as the 'add web reference' worked fine in vb.net, but I'll give it a try. –  ScottE Mar 16 '10 at 21:57
Yep, didn't work. –  ScottE Mar 16 '10 at 22:01
add comment

Although an old post, but just want to share my experience so that it might help some one today.

When communicating with Web services developed on platform such as Java, Phython or Ruby probably the cause of Stub/Proxy classes not being generated due to compliance issues (WS-I interoperability standard). You might encounter errors such as:

Failed to generate code for the service reference ServiceReferenceName. Please check other error and warning messages for details...

The actual error details you can get by using svcutil.exe of course in which case the error might look something like:

Error: Cannot import wsdl:portType

Its better to go with Web Service Reference for such services rather than Service Reference. (Add Service Reference -> Advanced -> Add Web Reference...)

In case you are enthusiast about playing with XML & WSDL you might go ahead and fix the issue with binding & portType. Probably the imports & include need to be corrected if i remember correctly from last time i wasted time fixing it to make it work with Service Reference Option.

share|improve this answer
add comment

Your Answer


