Hi all,
I am trying to download a file with a size 28 Mb the size can go up to 100
MB
I am facing following error on client side.
I followed the instructions in the following link to set the MTOM and file
caching..
i am using Axis 1.3, Please let me know in case i am missing anything
here.....
My Client code looks as below.
**********************************************************************************************************
*public* String downLoadObject(DocumentumObject docObject)
*throws*VisualLibraryDownloadException {
OMElement result;
List documentumObjList = *new* ArrayList();
documentumObjList.add(docObject);
OMFactory fac = OMAbstractFactory.*getOMFactory*();
OMElement methodElmt = fac.createOMElement(*new* QName(*GET_OBJECT*));
OMElement authenticationElmt = generateAuthenticateRequest();
OMElement objectsElmt = generateDocumentumRequest(documentumObjList);
methodElmt.addChild(authenticationElmt);
methodElmt.addChild(objectsElmt);
Options options = *new* Options();
options.setTo(dctmTargetEPR);
options.setTimeOutInMilliSeconds(*TIME_OUT*);
options.setProperty(Constants.Configuration.*CACHE_ATTACHMENTS*, Constants.*
VALUE_TRUE*);
options.setProperty(Constants.Configuration.*ATTACHMENT_TEMP_DIR*, *new*File(
"C:\\ContentZip1"));
options.setProperty(Constants.Configuration.*FILE_SIZE_THRESHOLD*, "4000");
//Enabling MTOM
options.setProperty(Constants.Configuration.*ENABLE_MTOM*, Constants.*
VALUE_TRUE*);
options.setTransportInProtocol(Constants.*TRANSPORT_HTTP*);
*try* {
serviceClient.setOptions(options);
result = serviceClient.sendReceive(methodElmt);
//System.out.println("Object Return " + result);
} *catch*(Exception e) {
e.printStackTrace();
*throw* *new* VisualLibraryDownloadException(e);
}
*return* processObject(result);
}
Server Side code as below ther is one more method which generates the
response.
**********************************************************************************************************
*
private* OMElement createContentResponseObj(DCTMObject documentumObj){
String objectId = documentumObj.getId();
List contentList = documentumObj.getContentList();
OMFactory factory = OMAbstractFactory.*getOMFactory*();
OMNamespace payloadNs= factory.createOMNamespace(*XML_NAMESPACE*, *
XML_NAMESPACE_PREFIX*);
OMElement payload = factory.createOMElement("Object", payloadNs);
//Object Id Processing
OMElement objId = factory.createOMElement("ObjectID", payloadNs);
OMText objIdValue = factory.createOMText(objectId);
objId.addChild(objIdValue);
payload.addChild(objId);
//Object Content Processing
OMElement contents = factory.createOMElement("ObjectContents", payloadNs);
*int* contentListSize = contentList.size();
*for*(*int* i = 0; i < contentListSize; i++){
ObjectContent content = (ObjectContent)contentList.get(i);
OMElement objContent = factory.createOMElement("ObjectContent", payloadNs);
String contentName = content.getName();
String contentMIMEType = content.getMimeType();
OMElement contName = factory.createOMElement("contenttName", payloadNs);
OMText contNameValue = factory.createOMText(contentName);
contName.addChild(contNameValue);
objContent.addChild(contName);
OMElement contType = factory.createOMElement("contentType", payloadNs);
OMText contTypeValue = factory.createOMText(contentMIMEType);
contType.addChild(contTypeValue);
objContent.addChild(contType);
//Binary Data formatting.
OMElement fileContent = factory.createOMElement("content", payloadNs);
ByteArrayDataSource byteData = *new* ByteArrayDataSource(content.getContent
());
DataHandler handler = *new* DataHandler(byteData);
OMText fileData = factory.createOMText(handler, *true*);
fileContent.addChild(fileData);
objContent.addChild(fileContent);
contents.addChild(objContent);
}
payload.addChild(contents);
*return* payload;
}
Seeting in the Axis2.xml
**********************************************************************************************************
<parameter name="enableMTOM">true</parameter>
<parameter name="enableSwA">false</parameter>
<!--Uncomment if you want to enable file caching for attachments -->
<parameter name="cacheAttachments">true</parameter>
<parameter name="attachmentDIR">C:\\ContentZip1</parameter>
<parameter name="sizeThreshold">4000</parameter>
Error on the console
**********************************************************************************************************
org.apache.axis2.AxisFault
at org.apache.axis2.AxisFault.makeFault(*AxisFault.java:417*)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(*
TransportUtils.java:89*)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(*
OutInAxisOperation.java:326*)
at org.apache.axis2.description.OutInAxisOperationClient.send(*
OutInAxisOperation.java:389*)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(*
OutInAxisOperation.java:211*)
at org.apache.axis2.client.OperationClient.execute(*OperationClient.java:163
*)
at org.apache.axis2.client.ServiceClient.sendReceive(*ServiceClient.java:528
*)
at org.apache.axis2.client.ServiceClient.sendReceive(*ServiceClient.java:508
*)
at com.toro.vl.download.dao.DownLoadDaoImpl.downLoadObject(*
DownLoadDaoImpl.java:104*)
at com.toro.vl.download.struts.action.DownloadObjectAction.getStreamInfo(*
DownloadObjectAction.java:57*)
at org.apache.struts.actions.DownloadAction.execute(*DownloadAction.java:106
*)
at org.springframework.web.struts.DelegatingActionProxy.execute(*
DelegatingActionProxy.java:106*)
at org.apache.struts.action.RequestProcessor.processActionPerform(*
RequestProcessor.java:419*)
at org.apache.struts.action.RequestProcessor.process(*RequestProcessor.java
:224*)
at org.apache.struts.action.ActionServlet.process(*ActionServlet.java:1192*)
at org.apache.struts.action.ActionServlet.doGet(*ActionServlet.java:412*)
at javax.servlet.http.HttpServlet.service(*HttpServlet.java:689*)
at javax.servlet.http.HttpServlet.service(*HttpServlet.java:802*)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(*
ApplicationFilterChain.java:237*)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(*
ApplicationFilterChain.java:157*)
at org.apache.catalina.core.StandardWrapperValve.invoke(*
StandardWrapperValve.java:214*)
at org.apache.catalina.core.StandardValveContext.invokeNext(*
StandardValveContext.java:104*)
at org.apache.catalina.core.StandardPipeline.invoke(*StandardPipeline.java
:520*)
at org.apache.catalina.core.StandardContextValve.invokeInternal(*
StandardContextValve.java:198*)
at org.apache.catalina.core.StandardContextValve.invoke(*
StandardContextValve.java:152*)
at org.apache.catalina.core.StandardValveContext.invokeNext(*
StandardValveContext.java:104*)
at org.apache.catalina.core.StandardPipeline.invoke(*StandardPipeline.java
:520*)
at org.apache.catalina.core.StandardHostValve.invoke(*StandardHostValve.java
:137*)
at org.apache.catalina.core.StandardValveContext.invokeNext(*
StandardValveContext.java:104*)
at org.apache.catalina.valves.ErrorReportValve.invoke(*ErrorReportValve.java
:118*)
at org.apache.catalina.core.StandardValveContext.invokeNext(*
StandardValveContext.java:102*)
at org.apache.catalina.core.StandardPipeline.invoke(*StandardPipeline.java
:520*)
at org.apache.catalina.core.StandardEngineValve.invoke(*
StandardEngineValve.java:109*)
at org.apache.catalina.core.StandardValveContext.invokeNext(*
StandardValveContext.java:104*)
at org.apache.catalina.core.StandardPipeline.invoke(*StandardPipeline.java
:520*)
at org.apache.catalina.core.ContainerBase.invoke(*ContainerBase.java:929*)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(*CoyoteAdapter.java:160*)
at org.apache.coyote.http11.Http11Processor.process(*Http11Processor.java
:799*)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection
(*Http11Protocol.java:705*)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(*PoolTcpEndpoint.java
:577*)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(*
ThreadPool.java:683*)
at java.lang.Thread.run(*Thread.java:534*)
Caused by: *java.lang.ClassCastException
*
at org.apache.axis2.builder.BuilderUtil.createAttachmentsMap(*
BuilderUtil.java:462*)
at org.apache.axis2.builder.MIMEBuilder.processDocument(*MIMEBuilder.java:38
*)
at org.apache.axis2.transport.TransportUtils.createDocumentElement(*
TransportUtils.java:160*)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(*
TransportUtils.java:111*)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(*
TransportUtils.java:87*)
... 40 more