webMethods 10.1 multiple files upload

Hi all!

I’m trying to create an CAF interface to get multiple files and process them.

I’ve created a simple flow service, receiving an objectList, looping through it and appending the content to an stringList to show it on the screen.

My point here is just to know how to pass it to the service, later i’ll upload it to the server, etc.

I succeeded in get 1 file, but when i set true to “multiple” in the File Input and change the structure to List, i’m getting the below error:
image

Here’s the code i’m using:

public String uploadAction() {
	int j = getFileItem().size();
	for (int i = 0; i<j; i++) {
		this.getUploadFile1().getParameters().getUploadFile().getUploadFile().addFileContent(this.getFileItem().get(i));
	}
	getUploadFile1().refresh();
	return null;
	}

Appreciate your help!

Hi,

what is the InvocationTargetException referring to?

Regards,
Holger

Hello Holger,

I think I might have an issue with my objectList, because i can’t set it to byte, right?

Any suggestions?

Below is the error in mws log:

2024-09-11 16:31:28 BRT (j.e.r.w.j.lifecycle:WARN) [qtp1725149928-430451] [RID:1478] - #{Upload_fileDefaultviewView.uploadAction}: com.webmethods.caf.faces.data.ContentProviderException: java.lang.reflect.InvocationTargetException
javax.faces.FacesException: #{Upload_fileDefaultviewView.uploadAction}: com.webmethods.caf.faces.data.ContentProviderException: java.lang.reflect.InvocationTargetException
	at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
	at javax.faces.component.UICommand.broadcast(UICommand.java:315)
	at com.webmethods.caf.faces.component.ViewRoot.broadcastEvents(ViewRoot.java:256)
	at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)
	at com.webmethods.caf.faces.component.ViewRoot.processApplication(ViewRoot.java:130)
	at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
	at com.webmethods.caf.faces.portlet.PortletLifecycle.phase(PortletLifecycle.java:322)
	at com.webmethods.caf.faces.portlet.PortletLifecycle.execute(PortletLifecycle.java:199)
	at com.webmethods.caf.faces.portlet.FacesPortlet.processAction(FacesPortlet.java:349)
	at com.webmethods.portal.framework.portletcontainer.impl.PortletApplicationHandler.process(PortletApplicationHandler.java:596)
	at com.webmethods.portal.framework.portletcontainer.servlet.PortletServlet.service(PortletServlet.java:62)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:595)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:191)
	at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:72)
	at com.webmethods.portal.framework.portletcontainer.impl.PortletContainer.dispatch(PortletContainer.java:293)
	at com.webmethods.portal.framework.portletcontainer.impl.PortletContainer.process(PortletContainer.java:203)
	at com.webmethods.portal.framework.portletcontainer.impl.PortletContainer.processPortletAction(PortletContainer.java:181)
	at com.webmethods.portal.framework.portlet.beans.rest.RestfulPCAHandler.handle(RestfulPCAHandler.java:200)
	at com.webmethods.portal.framework.dispatch.impl.DispatchManager.handle(DispatchManager.java:899)
	at com.webmethods.portal.framework.dispatch.impl.DispatchManager.handleDispatch(DispatchManager.java:793)
	at com.webmethods.portal.framework.impl.PortalServlet.service(PortalServlet.java:328)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
	at org.eclipse.jetty.servlets.UserAgentFilter.doFilter(UserAgentFilter.java:83)
	at org.eclipse.jetty.servlets.GzipFilter.doFilter(GzipFilter.java:300)
	at com.webmethods.caf.faces.servlet.GZIPFilter.doFilter(GZIPFilter.java:49)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
	at com.webmethods.portal.framework.impl.NTLMV1Filter.doFilter(NTLMV1Filter.java:64)
	at com.webmethods.portal.framework.impl.NTLMFilter.doFilter(NTLMFilter.java:30)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
	at com.webmethods.portal.framework.impl.RequestFilter.doFilter(RequestFilter.java:63)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
	at com.webmethods.portal.framework.impl.JsfPartialAjaxRequestFilter.doFilter(JsfPartialAjaxRequestFilter.java:81)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
	at com.webmethods.portal.framework.impl.SpnegoFilterWrapper.doFilter(SpnegoFilterWrapper.java:75)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
	at com.webmethods.portal.webapp.jetty7.MwsServer.handle(MwsServer.java:129)
	at org.eclipse.jetty.server.Server.handle(Server.java:497)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
	at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
	at java.lang.Thread.run(Thread.java:748)
Caused by: javax.faces.el.EvaluationException: com.webmethods.caf.faces.data.ContentProviderException: java.lang.reflect.InvocationTargetException
	at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:101)
	at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
	... 67 more
Caused by: com.webmethods.caf.faces.data.ContentProviderException: java.lang.reflect.InvocationTargetException
	at com.webmethods.caf.faces.data.object.ObjectMethodContentProvider.refresh(ObjectMethodContentProvider.java:414)
	at caf.war.uploadFile.upload_file.Upload_fileDefaultviewView.uploadAction(Upload_fileDefaultviewView.java:90)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.sun.el.parser.AstValue.invoke(AstValue.java:254)
	at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:302)
	at com.webmethods.caf.faces.application.CAFMethodExpression.invoke(CAFMethodExpression.java:73)
	at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)
	... 68 more
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.webmethods.caf.faces.data.object.ObjectMethodContentProvider.refresh(ObjectMethodContentProvider.java:376)
	... 77 more
Caused by: java.lang.RuntimeException: Can not serialize OM Element Envelope
	at org.apache.axiom.om.impl.llom.OMElementImpl.toString(OMElementImpl.java:980)
	at com.webmethods.portal.webservices.wss.stat.SoapMonitorHandler.invoke(SoapMonitorHandler.java:51)
	at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
	at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
	at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:262)
	at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:427)
	at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:484)
	at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:263)
	at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
	at caf.war.uploadFile.wsclient.....UpfileUploadFileWSStub.uploadFile(....UpfileUploadFileWSStub.java:182)
	... 82 more
Caused by: javax.xml.stream.XMLStreamException: Unknow type can not serialize
	at org.apache.axis2.databinding.utils.ConverterUtil.serializeAnyType(ConverterUtil.java:1511)
	at caf.war.uploadFile.wsclient..........serialize(.....UpfileUploadFileWSStub.java:418)
	at caf.war.uploadFile.wsclient..........serialize(.....UpfileUploadFileWSStub.java:371)
	at caf.war.uploadFile.wsclient.........E.serialize(....UpfileUploadFileWSStub.java:1216)
	at caf.war.uploadFile.wsclient.........E.serialize(....UpfileUploadFileWSStub.java:1202)
	at org.apache.axis2.databinding.ADBDataSource.serialize(ADBDataSource.java:90)
	at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:684)
	at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:556)
	at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:855)
	at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:220)
	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:141)
	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:117)
	at org.apache.axiom.om.impl.llom.OMElementImpl.toString(OMElementImpl.java:974)
	... 91 more

Hi,
From the error message “Upload_fileDefaultviewView.uploadAction” looks like something is happening in Upload files. Are you facing this issue when working with very small file size as well? Can you try to process small files and see if exception is thrown? If small files is working fine then this exception is related to your application timeout value which can be increased as below

  • Login to MWS using sysadmin
  • Go to “Folders” > Administrative Folders >Administration Dashboard > Configuration > CAF Application Runtime Configuration
  • Look for your application and click on “Environment Entries”
  • change the “wsclient-socketTimeout” value

Thanks,
Yogesh

Hi Yogesh,

Even with small files, with any kind of extension the error is thrown.
I tried to set a higher timeout, but the error persists.

Thanks!

Did you try adding sleeptimer to the end of the for loop block? Just a hunch, but might work.