tomcat - JAX-WS: OutOfMemory with large attachments + ChainHandler -


my problem similar to: jax-ws soaphandler large messages: outofmemoryerror , jaxws soap handler large mtom attachments

i using tomcat, metro-runtime-configuration, , when i want add header in handlerchain gives me outofmemory exception.

public boolean handlemessage(soapmessagecontext smc) {     if (boolean.true.equals(smc.get(messagecontext.message_outbound_property))) {         soapmessage sm = smc.getmessage(); // <- outofmemory         ... 

in first link ahmed writes i able write code handles raw data stream in 3 out of 4 cases. fortunately 3 cases included 2 interested in: to/from server. doesn't provide code snippet that.

things tried:

the outofmemory occurs in jdk7 abstractmessageimpl#readassoapmessage wasn't able override. possible override class using custom bootstrap? , how so? able "override" integer-class, abstractmessageimpl not taken.

changing runtime apache cxf did not work generated jax-ws ri clients (cannot create secure xmlinputfactory)

is there possibility use provider/runtime? , if not, how can override jdk7's abstractmessageimpl#readassoapmessage?

or: possible configure order of mtom , handler chains? mtom'ed message shouldn't throw outofmemory, right?

thanks in advance crappi

this problem found in ticket reports here: https://java.net/jira/browse/wsit-1081

i solved problem not using handler adding header when creating port this:

web-service-creation

webserviceendpoint endpoint = w.getwebserviceendpointport(new mtomfeature()); map<string, object> ctxt = ((bindingprovider) endpoint).getrequestcontext(); // enable http chunking mode, otherwise httpurlconnection buffers ctxt.put("com.sun.xml.ws.transport.http.client.streaming.chunk.size", 8192); wsbindingprovider bp = (wsbindingprovider) endpoint; bp.setoutboundheaders(headers.create(jaxbcontext.newinstance(wssecurityheader.class),                        new wssecurityheader())); 

since header-creation not provided methods, jaxb used complex header types.

wssecurityheader.java

@xmlrootelement(name = "security") public class wssecurityheader {      @xmlelement(name = "usernametoken")     public wssecurityusernametoken usernametoken = new wssecurityusernametoken();     ... } 

disadvantages

the client needs many libraries code working: jaxb, jax-ws, streambuffer, policy, stax-ex, gmbal-api-only, horrible adding header. (especially if working fat client without maven support)


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -