• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Ray Lai : Difference between Dynamic Proxies and Dynamic Invocation Interface

 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ray,
I understand beside Generated Stubs, the other two ways of programming JAX-RPC clients are Dynamic Proxies and Dynamic Invocation Interface. Beside the programming differences which most books cover, what are the factors that influence the choice of these two methods of implementing web services clients? Could you briefly state the pros and cons of these two methods? Thank you.
Best Regards
Frankie
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The dynamic proxy method requires application-specific interfaces (see "dynamicproxy.HelloIF" in http://java.sun.com/webservices/docs/1.3/tutorial/doc/JAXRPC5.html#wp79973 for example) while DII does not pose such requirements and is "completely" dynamic.
 
author
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Frankie Cha:
I understand beside Generated Stubs, the other two ways of programming JAX-RPC clients are Dynamic Proxies and Dynamic Invocation Interface. Beside the programming differences which most books cover, what are the factors that influence the choice of these two methods of implementing web services clients? Could you briefly state the pros and cons of these two methods? Thank you.


With dynamic proxies, developers can simply refer to a WSDL. This simply denotes "static look-up". You do need to generate the service end-point interface (*IF) file though using wscompile or similar utility. This scenario is ideal if you are managing a set of WSDLs that do not require frequent changes.
With dynamic invocation interface (DII), developers can perform service discovery using UDDI or JAXR on the fly. They will create an instance of an RPC call, and instantiate with relevant service end-point information. This scenario is ideal for services that have frequent updates, or that involve frequent addition/changes in the service contents, or in the number of service providers/trading partners.
From a programming construct point of view, you've probably noted that
DII is slightly more complex, as you need to be more specific about what properties/attributes for the RPC call (e.g. call.setProperty(xxx)). But it gives you more flexibility in managing changes (e.g. changes in WSDL, changes in service versioning) that cannot be easily managed by dynamic proxies.
To summarize, dynamic proxies are simpler in program design (e.g. faster to code or debug), more suitable for static WSDLs, and thus less service lookup overhead. DII is more agile for managing web services changes (e.g. changes in WSDL content, changes in service versioning), but it requires dynamic UDDI or ebXML service lookup (and thus have overhead). Choosing which method will be a matter of design strategies, and a case of your web services changes requirement. For example, your online store has many merchants joining or exiting. The WSDLs are so volatile and service versioning becomes an issue. It won't be sensible to use the same WSDL all the time, as the merchant may simply add a new parameter next month. Thus, a DII client is more appropriate.
On the other hand, many early web services deployment use static WSDLs that are exchanged between trading partners. They don't prefer dynamic lookup due to (1) lookup overhead, which may cost 0.2-2 seconds/call, and (2) they don't like building a UDDI infrastructure, which may be exposed to potential security risks (e.g. Denial of Attack).
My book J2EE platform web services ch 4 p. 207 (section 4.8.12-13) discusses some performance information about lookup overhead. To mitigate the service lookup overhead, you may also consider using a SOAP cache (pp. 172-178, section 4.8.1), which can be a client-side or a server-side caching.
 
Xie Ruchang
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ray,
Thank you very much for the clear and concise explanation!
Best Regards
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

With dynamic proxies, developers can simply refer to a WSDL. This simply denotes "static look-up". You do need to generate the service end-point interface (*IF) file though using wscompile or similar utility. This scenario is ideal if you are managing a set of WSDLs that do not require frequent changes.


I dont understand the difference between dynamic proxy and generated stubs. How is dynamic proxy advantageous? How does generating proxies dynamically help?
Thanks
 
Pradeep bhatt
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

The WSDLs are so volatile and service versioning becomes an issue. It won't be sensible to use the same WSDL all the time, as the merchant may simply add a new parameter next month.


How will my program know that the 3rd parameter has been added? The program has to be modified to accomodate 3rd parameter, right? :roll:
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Pradeep Bhat:
How will my program know that the 3rd parameter has been added? The program has to be modified to accomodate 3rd parameter, right? :roll:

Yes (unless the client is built to look for parameter values using reflection on a given "request object", which is unlikely in my opinion).
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ray Lai,
I have a question on Dynamic Invocation Interface..I presume the DII can be used without a WSDL on the client side..But if I have to pass a complexType to a Web Service invocation, how would I create the java representation of that complexType?? If i have to refer to WSDL for this, then how can the DII client be loosely-coupled with the WSDL?If there is any change to the wsdl, then my DII client code has to change..Am I correct?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic