Please log a JIRA with Rampart (https://issues.apache.org/jira/browse/RAMPART).. Looks like a bug in Rampart to me..
thanks, Thilina On 9/6/07, Grégoire Rolland <[EMAIL PROTECTED]> wrote: > > > > > Hi All, > > > > I have a file download Service (I use this tutorial > http://www.wso2.org/library/1675), which have a memory > problem. > > It works with file not larger than 10mb, without tuning JVM memory. > > When I disengage Rampart module (both client and server), all works fine > with larger file !! But when Rampart is engaged I get an OutOfMemoryError on > the client side for file larger than 10mb. > > > > For a file of 74MB, I have to set client JVM Memory to 728MB !!! > > > > The version I use : Axis2 1.2, Rampart 1.2, Tomcat/5.5, jsdk_1.5_10 > > > > I upgrade Axis and Rampart to version 1.3, there is the same behavior. > > > > Here is the stack trace for more precision : > > > > Thread [main] (Suspended (exception OutOfMemoryError)) > > String.<init>(char[], int, int) line: not available > > StringBuffer.toString() line: not available > > TextHelper.toString(InputStream) line: 36 > > TextImpl.getText() line: 316 > > DOMStAXWrapper.getText() line: 356 > > > StAXSOAPModelBuilder(StAXBuilder).createOMText(OMContainer, > int) line: 245 > > StAXSOAPModelBuilder(StAXBuilder).createOMText(int) > line: 216 > > StAXSOAPModelBuilder(StAXOMBuilder).next() line: 179 > > SOAPEnvelopeImpl(OMNodeImpl).build() line: 318 > > SOAPEnvelopeImpl(OMElementImpl).build() line: 614 > > Axis2Util.getSOAPEnvelopeFromDOMDocument(Document, > boolean) line: 200 > > RampartEngine.process(MessageContext) line: 174 > > RampartReceiver.invoke(MessageContext) line: 85 > > Phase.invoke(MessageContext) line: 292 > > AxisEngine.invoke(MessageContext, boolean) line: 212 > > AxisEngine.receive(MessageContext) line: 132 > > > OutInAxisOperationClient.handleResponse(MessageContext) > line: 336 > > OutInAxisOperationClient.send(MessageContext) line: 389 > > OutInAxisOperationClient.executeImpl(boolean) line: > 211 > > > OutInAxisOperationClient(OperationClient).execute(boolean) > line: 163 > > > DatabaseUpdaterClient(AbstractUpdaterClient).retrieveFile(String) > line: 221 > > DataBaseUpdater.update(boolean) line: 42 > > TCXUpdater.main(String[]) line: 116 > > > > This is the service code (method getFile) : > > > > public abstract class Updater implements IUpdater { > > private static final String FILE_ELEMENT_NAME = "file"; > > > > private static final String OM_NAMESPACE_NAME = "update"; > > > > private static final String OM_NAMESPACE = > "http://updater.webservices.hussoninfo.fr"; > > > > private String directory; > > > > private String fileName; > > > > public void setFileName(final String in_fileName) { > > fileName = in_fileName; > > } > > > > protected abstract String getRootPath(); > > > > private String getUpdatePath() { > > return getRootPath() + File.separator + directory; > > } > > > > public OMElement getFile(final OMElement in_e) > > { > > OMFactory factory = OMAbstractFactory.getOMFactory(); > > OMNamespace ns = factory.createOMNamespace(OM_NAMESPACE, > OM_NAMESPACE_NAME); > > OMElement fileElement = > OMAbstractFactory.getOMFactory().createOMElement(FILE_ELEMENT_NAME, > ns); > > DataHandler dataHandler = new DataHandler(new > FileDataSource(getUpdatePath() + File.separator + fileName)); > > OMText textData = factory.createOMText(dataHandler, true); > > fileElement.addChild(textData); > > return fileElement; > > } > > } > > > > This is the service.xml (see service DatabaseUptader) > > > > <serviceGroup> > > > > <service name="InitService" > class="fr.hussoninfo.webservices.lifecycle.InitService"> > > <description>Service d'initialisation</description> > > <parameter > name="ServiceClass">fr.hussoninfo.webservices.lifecycle.InitService</parameter> > > <parameter > name="ServiceTCCL">composite</parameter> > > <parameter > name="load-on-startup">true</parameter> > > </service> > > > > <service name="DatabaseUpdater"> > > <description>Service de mise a jour de base de > donnees</description> > > <messageReceivers> > > <messageReceiver > mep="http://www.w3.org/2004/08/wsdl/in-only" > class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" > /> > > <messageReceiver > mep="http://www.w3.org/2004/08/wsdl/in-out" > class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" > /> > > </messageReceivers> > > <parameter name="ServiceClass" > locked="false">fr.hussoninfo.webservices.updater.IUpdater</parameter> > > <parameter > name="ServiceObjectSupplier">org.apache.axis2.extensions.spring.receivers.SpringAppContextAwareObjectSupplier</parameter> > > <parameter > name="SpringBeanName">databaseUpdater</parameter> > > <parameter name="enableMTOM" locked="false">true</parameter> > > > > <module ref="rampart" /> > > > > <operation name="getFile"> > > <messageReceiver > class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/> > > > <actionMapping>urn:getFile</actionMapping> > > </operation> > > > > <wsp:Policy wsu:Id="UTOverTransport" > > > xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" > > > xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"> > > > > <wsp:ExactlyOne> > > <wsp:All> > > <sp:TransportBinding > > > xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> > > <wsp:Policy> > > > <sp:TransportToken> > > <wsp:Policy> > > > <sp:HttpsToken > > > RequireClientCertificate="false" /> > > > </wsp:Policy> > > </sp:TransportToken> > > > <sp:AlgorithmSuite> > > <wsp:Policy> > > > <sp:Basic256 /> > > > </wsp:Policy> > > > </sp:AlgorithmSuite> > > <sp:Layout> > > <wsp:Policy> > > > <sp:Lax /> > > > </wsp:Policy> > > </sp:Layout> > > </wsp:Policy> > > </sp:TransportBinding> > > <sp:SignedSupportingTokens > > > xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> > > <wsp:Policy> > > <sp:UsernameToken > > > sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient" > /> > > </wsp:Policy> > > </sp:SignedSupportingTokens> > > > > <ramp:RampartConfig > xmlns:ramp="http://ws.apache.org/rampart/policy"> > > > <ramp:passwordCallbackClass>fr.hussoninfo.webservices.security.PasswordCallback</ramp:passwordCallbackClass> > > </ramp:RampartConfig> > > > > </wsp:All> > > </wsp:ExactlyOne> > > </wsp:Policy> > > </service> > > </serviceGroup> > > > > > > And here the client (method retreiveFile) : > > > > public abstract class AbstractUpdaterClient { > > > > private static final String URN_GET_FILE = "urn:getFile"; > > private static final String METHOD_GET_FILE = "getFile"; > > private static final String WEBSERVICES_NAMESPACE = > "http://updater.webservices.hussoninfo.fr"; > > private static final String RAMPART_MODULE_NAME = "rampart"; > > > > private String domaine = null; > > > > private ConfigurationContext cc = null; > > > > private Policy policy = null; > > > > public AbstractUpdaterClient(final ConfigurationContext in_cc, final > Policy in_policy, final String in_domaine) > > { > > domaine = in_domaine; > > cc = in_cc; > > policy = in_policy; > > } > > > > protected abstract String getUpdateService(); > > > > private String getEPRString() > > { > > return "http://" + domaine + "/TCXUpdater/services/" + > getUpdateService(); > > } > > > > public void retrieveFile(final String in_outputFile) throws > IOException > > { > > ServiceClient serviceClient2 = new ServiceClient(cc, null); > > > > EndpointReference targetEPR2 = new > EndpointReference(getEPRString()); > > > > OMFactory fac = OMAbstractFactory.getOMFactory(); > > OMNamespace omNs = fac.createOMNamespace(WEBSERVICES_NAMESPACE, > METHOD_GET_FILE); > > > > OMElement method = fac.createOMElement(METHOD_GET_FILE, omNs); > > > > serviceClient2.engageModule(RAMPART_MODULE_NAME); > > > > Options options2 = serviceClient2.getOptions(); > > options2.setTo(targetEPR2); > > options2.setAction(URN_GET_FILE); > > > options2.setProperty(RampartMessageData.KEY_RAMPART_POLICY, > policy); > > > options2.setProperty(Constants.Configuration.ENABLE_MTOM, > Constants.VALUE_TRUE); > > > > MessageContext messageContext = new MessageContext(); > > > messageContext.setServiceContext(serviceClient2.getServiceContext()); > > SOAPFactory soapFactory = > OMAbstractFactory.getSOAP12Factory(); > > SOAPEnvelope envelope = soapFactory.getDefaultEnvelope(); > > envelope.getBody().addChild(method); > > serviceClient2.addHeadersToEnvelope(envelope); > > messageContext.setEnvelope(envelope); > > OperationClient operationClient = > serviceClient2.createClient(ServiceClient.ANON_OUT_IN_OP); > > operationClient.addMessageContext(messageContext); > > operationClient.execute(true); > > MessageContext responseMc = operationClient > > > .getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE); > > > > DataHandler attachement = responseMc.getAttachment( > > responseMc.getAttachmentMap().getAllContentIDs()[1]); > > > > InputStream is = new > BufferedInputStream(attachement.getDataSource().getInputStream()); > > OutputStream os = new BufferedOutputStream(new > FileOutputStream(in_outputFile)); > > > > IOUtils.copy(is, os); > > > > os.close(); > > is.close(); > > > > os = null; > > is = null; > > } > > } > > > > MTOM caching is enabled on client side (axis2.xml fragment): > > > > <parameter name="cacheAttachments" locked="false">true</parameter> > > <parameter name="attachmentDIR" > locked="false">c:/tcx/cache</parameter> > > <parameter name="sizeThreshold" locked="false">1024</parameter> > > > > Policy for client side : > > > > <wsp:Policy wsu:Id="UTOverTransport" > > > xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" > > > xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"> > > <wsp:ExactlyOne> > > <wsp:All> > > <sp:TransportBinding > > > xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> > > <wsp:Policy> > > <sp:TransportToken> > > <wsp:Policy> > > <sp:HttpsToken > > > RequireClientCertificate="false" /> > > </wsp:Policy> > > </sp:TransportToken> > > <sp:AlgorithmSuite> > > <wsp:Policy> > > <sp:Basic256 /> > > </wsp:Policy> > > </sp:AlgorithmSuite> > > <sp:Layout> > > <wsp:Policy> > > <sp:Lax /> > > </wsp:Policy> > > </sp:Layout> > > </wsp:Policy> > > </sp:TransportBinding> > > <sp:SignedSupportingTokens > > > xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> > > <wsp:Policy> > > <sp:UsernameToken > > > sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient" > /> > > </wsp:Policy> > > </sp:SignedSupportingTokens> > > </wsp:All> > > </wsp:ExactlyOne> > > </wsp:Policy> > > > > And the method to get the Policy : > > > > StAXOMBuilder builder = new StAXOMBuilder(CONF_POLICY_XML); policy = > PolicyEngine.getPolicy(builder.getDocumentElement()); > > > > RampartConfig rc = new RampartConfig(); > > rc.setUser("user"); > > rc.setPwCbClass(PasswordCallback.class.getName()); > > policy.addAssertion(rc); > > > > > > I hope someone can help me. > > Thanks in advance > > > > Grégoire Rolland > > -- Thilina Gunarathne - http://www.wso2.com - http://thilinag.blogspot.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
