View Full Version : JAXB2 question
mmccaskill
Oct 19th, 2007, 06:12 PM
I'm using JAXB2 along with @Endpoint & @Payload annotations. I've been told that using SAX (since it is a stream parser) is significantly faster and memory efficient than JAXB2. Is this true? I can't seem to find any good articles comparing JAXB2 and SAX. I've also been told that by using JAXB2 it is like using RPC and that one doesn't receive the benefits of using document driven services.
Arjen Poutsma
Oct 20th, 2007, 06:46 AM
Well, JAXB2 parses the entire payload to create a Java object from your message. If incoming messages are large, and you don't need to read all of it, then using SAX or StAX directly might be more performing.
With regard to XML marshalling being less document driven, see http://static.springframework.org/spring-ws/site/reference/html/why-contract-first.html#d0e217. However, marshalling is also quite convenient.
Luckily for you, Spring-WS offers you the choice: you can handle XML in any way you want to.
mmccaskill
Oct 26th, 2007, 08:38 AM
Well I could just use Axiom to build the SOAP instead of SAAJ. But to really get the benefit of Axiom (StAX) I would need to turn off payloadCaching right? Otherwise its roughly the same as SAX or DOM.
Arjen Poutsma
Oct 27th, 2007, 04:45 AM
Yes, and the change is only really significant when you are dealing with large documents.
Powered by vBulletin® Version 4.2.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.