Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Livecycle remote Functions Parameter ArrayList (Correspondence Management))

Avatar

Level 2
Level 2

Hi guys,

I'm working on a custom remote function used by Correspondence Management. The implementation/interface class looks like the following:

import com.adobe.exm.expeval.ServiceMethod;

import java.util.ArrayList;

interface EXMService {

    @ServiceMethod

    abstract String testString(String content);

   

    @ServiceMethod

    abstract String testList(ArrayList list);

}

import com.adobe.exm.expeval.ServiceMethod;

import java.util.ArrayList;

public class EXMServiceImpl implements EXMService {

    @ServiceMethod(enabled = true, displayName = "testFunc1", description = "works fine")

    public String testString(String content) {

        return "works";

    }

   

    @ServiceMethod(enabled = true, displayName = "testFunc2", description = "doesnt work")

    public String testList(ArrayList list) {           

        return "works";

    }

}

As soon as I install the bundle and try to get a list of all installed/available custom remote services (correspondence interface), I get an empty list and the following exception:

13.12.2013 12:22:44.998 *INFO* DS.Message.Remoting.Sling Service started for remote invocation: ServiceInfoImpl{reference=[com.adobe.livecycle.content.test.EXMService], destinationId='test', started=true}

13.12.2013 12:23:00.957 *ERROR* DS.Message.Remoting Error processing remote invocation: java.lang.IllegalArgumentException: Unsupported type java.util.ArrayList

  incomingMessage: Flex Message (flex.messaging.messages.RemotingMessage)

    operation = listServices

    clientId = 6FEEEB2B-EED0-4CBE-992A-01FC6425A3A1

    destination = lc.exm.functionService

    messageId = ED6A005A-1542-8A30-E923-EBB201BCEEE7

    timestamp = 1386933780957

    timeToLive = 0

    body =

    [

      null

    ]

    hdr(DSId) = D5AE6DA2-2225-4358-A7A7-B189E6A3DEF5

    hdr(DSEndpoint) = my-amf

java.lang.IllegalArgumentException: Unsupported type java.util.ArrayList

at com.adobe.exm.expeval.fn.MethodUtils.getType(MethodUtils.java:40)

at com.adobe.exm.expeval.fn.FunctionServiceImpl.toFunctionParameterVO(FunctionServiceImpl.java:105)

at com.adobe.exm.expeval.fn.FunctionServiceImpl.toFunctionVO(FunctionServiceImpl.java:150)

at com.adobe.exm.expeval.fn.FunctionServiceImpl.listServices(FunctionServiceImpl.java:164)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at flex.messaging.services.remoting.adapters.JavaAdapter.invoke(JavaAdapter.java:404)

at flex.messaging.services.RemotingService.serviceMessage(RemotingService.java:183)

at flex.messaging.MessageBroker.routeMessageToService(MessageBroker.java:1465)

at flex.messaging.AsyncMessageBroker.filteredRouteMessageToService(AsyncMessageBroker.java:564)

at flex.messaging.filters.SyncMessageFilterChain$MessageFilterContext.filterRequest(SyncMessageFilterChain.java:219)

at com.adobe.dataservices.impl.DelegatingSyncFilter$DelegatingMessageFilterContext.filterRequest(DelegatingSyncFilter.java:95)

at com.adobe.dataservices.impl.DelegatingSyncFilter$DelegatingMessageFilterContext.processRequest(DelegatingSyncFilter.java:83)

at com.adobe.dataservices.impl.DelegatingSyncFilter.filterRequest(DelegatingSyncFilter.java:62)

at flex.messaging.filters.SyncMessageFilterChain$MessageFilterContext.filterRequest(SyncMessageFilterChain.java:215)

at flex.messaging.filters.SyncMessageFilterChain$MessageFilterContext.processRequest(SyncMessageFilterChain.java:201)

at flex.messaging.filters.SyncMessageFilterChain.filterRequest(SyncMessageFilterChain.java:139)

at flex.messaging.AsyncMessageBroker.routeMessageToService(AsyncMessageBroker.java:554)

at flex.messaging.endpoints.AbstractEndpoint.serviceMessage(AbstractEndpoint.java:1041)

at flex.messaging.endpoints.amf.MessageBrokerFilter.invoke(MessageBrokerFilter.java:103)

at flex.messaging.endpoints.amf.LegacyFilter.invoke(LegacyFilter.java:158)

at flex.messaging.endpoints.amf.SessionFilter.invoke(SessionFilter.java:44)

at flex.messaging.endpoints.amf.BatchProcessFilter.invoke(BatchProcessFilter.java:67)

at flex.messaging.endpoints.amf.SerializationFilter.invoke(SerializationFilter.java:192)

at flex.messaging.endpoints.BaseHTTPEndpoint.service(BaseHTTPEndpoint.java:330)

at com.adobe.dataservices.impl.ApplicationManagerImpl.service(ApplicationManagerImpl.java:673)

at org.apache.jsp.libs.dataservices.components.messagebroker.POST_jsp._jspService(POST_jsp.java:98)

at org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:502)

at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:449)

at org.apache.sling.scripting.jsp.JspScriptEngineFactory.callJsp(JspScriptEngineFactory.java:241)

at org.apache.sling.scripting.jsp.JspScriptEngineFactory.access$100(JspScriptEngineFactory.java:86)

at org.apache.sling.scripting.jsp.JspScriptEngineFactory$JspScriptEngine.eval(JspScriptEngineFactory.java:441)

at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:361)

at org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:171)

at org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:463)

at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:508)

at org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:45)

at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:64)

at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilter(WCMDebugFilter.java:148)

at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)

at com.day.cq.wcm.core.impl.WCMComponentFilter.filterRootInclude(WCMComponentFilter.java:333)

at com.day.cq.wcm.core.impl.WCMComponentFilter.doFilter(WCMComponentFilter.java:160)

at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)

at org.apache.sling.engine.impl.SlingRequestProcessorImpl.processComponent(SlingRequestProcessorImpl.java:254)

at org.apache.sling.engine.impl.filter.RequestSlingFilterChain.render(RequestSlingFilterChain.java:49)

at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:64)

at com.day.cq.wcm.core.impl.warp.TimeWarpFilter.doFilter(TimeWarpFilter.java:106)

at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)

at com.day.cq.wcm.mobile.core.impl.redirect.RedirectFilter.doFilter(RedirectFilter.java:290)

at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)

at com.adobe.livecycle.content.appcontext.impl.AppContextFilter.doFilter(AppContextFilter.java:58)

at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)

at com.adobe.livecycle.content.sling.impl.ResourceResolverFilter.doFilter(ResourceResolverFilter.java:34)

at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)

at com.adobe.livecycle.crx.security.SpringSecurityBridgeFilter.doFilter(SpringSecurityBridgeFilter.java:65)

at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)

at com.adobe.livecycle.process.reporting.servlet.filter.ProcessReportingResourceResolverFilter.doFilter(ProcessReportingResourceResolverFilter.java:70)

at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)

at com.adobe.livecycle.lccomponent.util.LcComponentResourceResolverFilter.doFilter(LcComponentResourceResolverFilter.java:54)

at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)

at com.adobe.livecycle.dsc.clientsdk.internal.ResourceResolverHolderFilter.doFilter(ResourceResolverHolderFilter.java:37)

at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)

at org.apache.sling.engine.impl.debug.RequestProgressTrackerLogFilter.doFilter(RequestProgressTrackerLogFilter.java:59)

at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)

at com.day.cq.wcm.foundation.forms.impl.FormsHandlingServlet.doFilter(FormsHandlingServlet.java:220)

at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)

at com.day.cq.theme.impl.ThemeRe...

Without the method testList everything works fine.

Any Hint?

Thx in advance

jwe

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi,

Only primitive types are supported as arguments in the remote functions.

There is no scenario where one needs to pass collection to a remote functions. Therefore usage of list as arguments has been manully blocked in CM.

Can you explain your use case here , as in why you want to pass an ArrayList to a remote function ?

Please refer to the link below on how collection elements are used in an expression.

http://help.adobe.com/en_US/livecycle/11.0/ExpressionManagerTechGuide/WSc070aef4a1ec54562ae81de91312...

Regards,

Javed

View solution in original post

4 Replies

Avatar

Employee

You are getting this exception because Lists are not supported in remote custom functions.

Can you explain the use case that you are trying to accomplish using ArrayList ?

Avatar

Level 2
Level 2

Hi Javad1234,

thx for ur reply.

Are u sure Lists arent supported in remote custom functions? I think they must be supported otherwise it doesnt make any sense to me.

We've got a ArrayCollection of Strings and pass it to our method testList(ArrayList list). There we re doing some work. The typ ArrayList must be the right one according to the following:

http://livedocs.adobe.com/blazeds/1/blazeds_devguide/help.html?content=serialize_data_3.html

and

http://forums.adobe.com/message/2679486

Greetings jwe

Avatar

Correct answer by
Employee

Hi,

Only primitive types are supported as arguments in the remote functions.

There is no scenario where one needs to pass collection to a remote functions. Therefore usage of list as arguments has been manully blocked in CM.

Can you explain your use case here , as in why you want to pass an ArrayList to a remote function ?

Please refer to the link below on how collection elements are used in an expression.

http://help.adobe.com/en_US/livecycle/11.0/ExpressionManagerTechGuide/WSc070aef4a1ec54562ae81de91312...

Regards,

Javed

Avatar

Level 2
Level 2

Hi Javed1234,

You re right. Now I'm using String[] and everything works fine.

Thank you