Web Reference vs. Service Reference, Part 1

  • Post category:Development
  • Post comments:0 Comments
  • Reading time:4 mins read

Smorgasbord! by Charles RoffeyOnce upon a time, Freddy has delivered a great series on connecting to NAV Web Services from a smorgasbord of technology flavors. If you are a .NET enthusiast, like me, the obvious choice is to connect through the tools that are at your disposal in Visual Studio: the proxy classes.

A proxy class is a class which wraps a Web service functionality into a strongly-typed .NET object, and allows simpler communication through Web services. It hides away all intricacies of SOAP communication, authentication, serialization and deserialization, and exposes simple, easy-to-use objects. Every NAV Web service results in a series of proxy classes, and in Visual Studio the generation of those classes is as simple as clicking a mouse a couple of times.

There are two types of proxy classes, and they get generated through two different technical choices: Web References or Service Reference.

As Freddy explains:

Add Web Reference is a wrapper over wsdl.exe and can be used to create proxies for .NET 1.1 or 2.0 clients. Of course this means when you are pointing to a WCF service you have to be pointing to an endpoint that uses basicHttpBinding.

Add Service Reference is a wrapper over svcutil.exe and also creates clients proxies. These proxies, however, can only be consumed by .NET 3.5 clients.

Beyond that, there are no obvious differences, and neither of them seems to provide an obvious benefit over the other. NAV Web services doesn’t care who consumes them and in which way – so performance on NAV side is not affected by the choice between these two. Difference in performance on client side has never been proven to exist (at least to my knowledge), so as long as dependency on .NET framework being used is the only constraint, you should be safe to go with either of these.

Well, not quite so. There are considerations, and in the next two blog posts I’ll talk about two specific ones, one of which will definitely convince you to use Service Reference approach; and the other one which would have you consider using Web Reference approach instead.

Just in case you wondered if I have completed my “bug theater” series – I have not. What I decided to do is to give it a more practical aspect, and actually talk about Web services in a more generic way, focusing on solutions, rather than problems. So, the series of Web Reference vs. Service Reference will be just that – explanation of practical aspects of NAV Web services consumption, which explains certain issues in NAV Web services, and what effects they have on your choice of the type of proxy classes you’d use.

It’s Friday afternoon, and I want to keep it suspenseful (at least for those few who would read this Smile) – so see you all on Monday, when you can read about the first type of difference between Service Reference and Web Reference approaches from the point of view of a consumer.

Vjeko

Vjeko has been writing code for living since 1995, and he has shared his knowledge and experience in presentations, articles, blogs, and elsewhere since 2002. Hopelessly curious, passionate about technology, avid language learner no matter human or computer.

Leave a Reply