Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

Static versus dynamic invocation of a Web service

What are the pros and cons of static invocation of a Web service versus dynamic invocation?

There are actually three different ways to invoke a Web service:

  • static binding
  • dynamic binding
  • dynamic invocation
With static binding you compile and bind your client proxy at development time. This binding is tightly bound to one and only one service implementation. It provides the fastest performance of the three options, but gives you the least flexibility.

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.

Dig Deeper on Topics Archive

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.