Hi

If you could post a more detailed sample or blog about it then that would be 
really great.
Looks like it's a very neat approach. By the way, perhaps you can disable the optimization on the output only when dealing with the legacy clients such that the newer ones don't get the performance hit ? May be for small -to-medium messages the perfomance hit would be negligible given the fact CachecOutputStream used in such cases is a very efficient implementation....

I'm also working on the XSLT JAXB provider so another option would be to use XSLT (compiled stylesheet) which would do an identity transform for new clients and and translate the namespace for older ones, it should be quirte effcient too given that it operates on SAX events.. I'll update you once I'm done..

cheers, Sergey

Hi,

just in case someone has to solve the same problem, here is how I did:

Inbound:

Added an interceptor to the phase POST_STREAM, after StaxInInterceptor. This 
interceptor takes the
XMLStreamReader created by StaxInInterceptor and puts a wrapper around it. The 
wrapper translates
the namespaces and sets a threadlocal flag.

Outbound:

Added in interceptor to the phase PRE_MARSHAL. This interceptor takes the 
XMLStreamWriter created by
StaxOutInterceptor and puts another wrapper around it. This outbound wrapper 
evaluates the
threadlocal of the inbound wrapper and wraps the output accordingly.

However, by default, CXF will write the outgoing SOAP message directly to the 
ServletOutputStream
(see BareOutInterceptor.writeParts()). So I had to set the flag 
DISABLE_OUTPUTSTREAM_OPTIMIZATION in
the outbound interceptor to force CXF to use the (wrapped) XMLStreamWriter 
instead of the output stream.


This works quite nice. However, I am not quite sure about this output 
optimization. I could not find
any documentation about the drawbacks when writing to a XMLStreamWriter instead 
of the OutputStream.
Does someone have any hints about "DISABLE_OUTPUTSTREAM_OPTIMIZATION"?

Regards,
Martin

Hi,

I have a web service (Soap 1.1, Document wrapped, JAXB) which uses the namespace
"http://something.old";. I would like to migrate this namespace to 
"http://something.new";.

Unfortunately, there are quite some clients out there which use my service. So 
I cannot just switch
the namespace with a new release of my web service. Instead I would like to have a 
"smooth" transition.

Some code would detect that a client is sending a document with the old 
namespace. This code would
rewrite the old namespace to the new namespace before/while the document is 
being unmarshaled.
Furthermore it would set a thread local flag that namespace translation was 
used. Another piece of
code in the output chain would evaluate this flag and would rewrite the new 
namespace to the old
namespace, if the flag is set.

This way, old clients would be able to send documents with the old namespace 
and they would receive
a response from the server with the old namespace.

Is this possible? Where do I have to start?

I already looked into StaxInInterceptor and StaxOutInterceptor. I think that it 
would be possible to
put a wrapper around XMLStreamReader and XMLStreamWriter, but this would be 
rather cumbersome (and
slow?). Is there an elegant solution to this problem?

Regards,
Martin


Reply via email to