> Thank you for you reply. One more question :-)
No problem! I just hope my memory is correct about handlers.
>
> Assuming I will implement the cashing on the handler level, can I know
> the contents of the request once I get the response ?
>
> I mean once I have the response processed in the handler, is there any
> way to access the request, or should I "store" it once the request is
> being made ?
I'm not sure I quite understand, or maybe we're just not quite on the
same page yet. Your image was nice, and it kind of implies what actually
happens (if you connect the lines). In handleMessage(), once you return
false, the request has now become the response.
So you can get the LogicalMessage from the message context, store it if
you'd like, and then set a new message into the LogicalMessage object
and return false. This message object, which represented the request
before, now represents the response. From the spec, my comments in
brackets: "The message direction is reversed, the runtime invokes
handleMessage on the next [which was the previous] handler or dispatches
the message [...] if there are no further handlers."
Just in case it's useful:
As for creating the response message, the simplest way is with JAXB if
you have the JAXBContext around (e.g., using the classes generated by
jax-ws when the client-side code was generated). You just create the
response object, set some fields on it, and set it into the
LogicalMessage. Otherwise, it's simple to wrap a StreamSource around a
StringReader around a String, or get the request as a Source, transform
it to DOM, change whatever you'd like, and create a new Source from it
to set in the message. Of course, however you do it, change as little as
you need to each time you're updating the data. For instance, make sure
you create a new JAXBContext only once and reuse it for faster performance.
Cheers,
Bobby