Your client program can build a synchronized Map from WSDL URI to
javax.wsdl.Definition (or you could go further and cache Service or Port
objects, or WSIFProvider, WSIFPort objects, etc).  Instead of calling
org.apache.wsif.util.WSIFUtils.readWSDL directly, you call a similar method
on the cache, which only reads the file if it doesn't already contain the
results.  If you build a more complex cached object, you can add timestamps
or usage counts or other fields to determine how to manage the size of the
cache.  You could also store the wsdl as a DOM document if you need it for
other purposes, such as getting at the schemas inside.  If you're developing
the web services and clients simultaneously, you might want to add a public
way to flush the cache (or remove individual items) to be able to deal with
wsdl files that are changed during a run.

This is one of those areas where what should be cached should depend on the
details of the application (are you accessing lots of different WSDL
services, or a few repeatedly, do you want to reuse operation and port
objects, etc).  It's sufficiently easy to build the basic cache mechanism in
java, and stuff in what you need that it's unlikely that some provided
facility will do as well for your application as something you can put
together in a few hours.

Jeff

----- Original Message -----
From: "BAKHSHI Sanveer-Singh (ITG/ASG)" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, April 02, 2003 8:46 AM
Subject: RE: Caching


> Firstly, thanks Ant for the info on WSIF Providers - huge timesaver there.
>
> From an architectural perspective, one can not hide the fact that reading
> WSDL files DOES take a fair amount of time. With the average java method
> invocation taking under a second, the impact of 1.5-3 seconds just for
> reading a WSDL file for one service can be enormous, especially if you're
> switching to a SOA where '000s of transactions will be running in this
> manner.
>
> Can anyone help me with a possible solution for this ? How can one prevent
> reading the WSDL file EVERY time the transaction is invoked ?

Reply via email to