There are actually three different ways to invoke a Web service:
- static binding
- dynamic binding
- dynamic invocation
With dynamic binding the only thing that you compile at development time is the interface to a service type (i.e., the WSDL <portType> definition). At runtime your client can bind to any service implementation that supports that <portType>. It generates a dynamic proxy from the service's WSDL <binding> at runtime and casts it to the interface. From a developer's point of view, this approach is as easy to use as a static proxy. There is a slight performance hit, though. You need to retrieve the WSDL and do some runtime compilation of the WSDL, so the initial connection takes a bit longer (a few hundred milliseconds), but once the binding is complete, performance is equivalent. In exchange you win a lot of flexibility. Using this technique, your application can connect to any number of different service implementations without modification. It can automatically handle changes to the underlying protocols. It doesn't automatically handle changes to the service signature, though. For that you need dynamic invocation.
With dynamic invocation, you don't compile anything at development time. Instead you do everything at runtime. The application retrieves and interprets the WSDL it at runtime and dynamically constructs calls. It gives you the most flexibility, but also requires a much more sophisticated client. Obviously, there's a bigger hit in terms of performance, which occurs on each invocation.
This was first published in March 2003