In my application, we have a webservice method called getFoo () that returns a Foo object. The getFoo () method is called several hundred times per second . The Foo Marshalled object from our Java object to the SOAP XML response using Apache CXF.
From the profiling of our application, we determined that sorting this object (java object → soap encoded xml) is the largest consumer of processor cycles. and since our Foo object does not change very often, remarketing this object every time is not required.
I realized that this is a normal optimization and wonders how others turned to it.
I looked briefly at the CXF docs, and there is a Marshall interceptor that I could probably use. I could create a map that could map Foo objects to an XML-encoded version. But then several other problems arise, for example, how you delete objects from this Map as soon as they are no longer needed, etc. It would be nice if support were built in to somehow detect changes to the object and re-mark. Nothing is impossible, but did not want to reinvent the wheel.
EDIT (6/16/09) . Some progress has been made by creating a custom BareOutInterceptor and modifying the Interceptor chain to invoke the custom one. The user sets up additional logic only for calling the writeParts (....) "method, which sorts only once for a given java object. It will deliver a solution after completion. In addition, I renamed this question.
source
share