POST parameters to an external REST service from an Adobe LiveCycle Process

314 views
Skip to first unread message

mmvidus

unread,
Aug 5, 2014, 2:58:12 PM8/5/14
to live...@googlegroups.com


Is it possible to POST parameters such as XML string to an external REST service from within an Adobe LiveCycle Process (ES4)?

From all the research I've done it does not look possible to invoke an external REST webservice hosted in a WebLogic Web application from within an Adobe LiveCycle Process (ES4)

mmvidus

unread,
Aug 5, 2014, 5:24:26 PM8/5/14
to live...@googlegroups.com

Murali Raghavan

unread,
Aug 5, 2014, 9:50:17 PM8/5/14
to live...@googlegroups.com
Hello,

You can try writing a Java server script function and invoke it via executeScript operation in a process.


--
You received this message because you are subscribed to the Google Groups "Adobe LiveCycle Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to livecycle+...@googlegroups.com.
To post to this group, send email to live...@googlegroups.com.
Visit this group at http://groups.google.com/group/livecycle.
For more options, visit https://groups.google.com/d/optout.

Brian Kalbfus

unread,
Aug 6, 2014, 9:38:18 AM8/6/14
to live...@googlegroups.com

I have tried executeScript to use apache httpClient and it wouldn't make the call.  I was thinking it's a security issue and heard that writing a custom component would work.  In our environment we use JMS to send messages to other systems. 

-Brian

Rob McDougall

unread,
Aug 6, 2014, 9:41:06 AM8/6/14
to live...@googlegroups.com
We had to do this recently for a client - we build a custom component to perform the work.  It's not a difficult custom component, especially if you use the Apache HTTPClient library as Brian suggests.  It's maybe 1-2 weeks of java work.

Regards,
Rob

mmvidus

unread,
Aug 6, 2014, 10:58:34 AM8/6/14
to live...@googlegroups.com
What version of LiveCycle were you using and Eclipse? I tried to make a custom component, but Eclipse was not importing the plugin. The Component Wizard was having a conflict with XMLBeans library when I tried to create a new custom component in eclipse?

Rob McDougall

unread,
Aug 7, 2014, 10:55:04 AM8/7/14
to live...@googlegroups.com
We were using LiveCycle ES3 and Eclipse Kepler (although I've also used Luna).

Are you referring to the custom component plug-in?  That isn't really required in order to create a custom component.

A custom component is really just a .jar file with a component.xml in it.  The .jar must be created without compression (don't ask my why this is an issue but it is).

We typically just create them in Eclipse by creating a new J2EE "Utility" Project.  We copy an existing component.xml into the top level source directory and customize it for the specific project.  We then create the .jar either by performing an export to .jar from eclipse (don't forget to turn off compression) or by invoking a build.xml file that we've stolen from some other custom component project that generates the .jar.

AFAIK, the custom component plug-in isn't being actively maintained by Adobe so this is the way we've been creating them.

Regards,
Rob

mmvidus

unread,
Aug 7, 2014, 12:59:33 PM8/7/14
to live...@googlegroups.com
Hello Again,

I just created a custom component, but it's unable to invoke the process due to an error retrieving the org.apache.http.client.methods.HttpPost library:
Below is the stacktrace error. The component.xml is defined below as well.

ALC-DSC-003-000: com.adobe.idp.dsc.DSCInvocationException: Invocation error.
    at com.adobe.idp.dsc.component.impl.DefaultPOJOInvokerImpl.invoke(DefaultPOJOInvokerImpl.java:152)
    at com.adobe.idp.dsc.interceptor.impl.InvocationInterceptor.intercept(InvocationInterceptor.java:140)
    at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptorChainImpl.java:60)
    at com.adobe.idp.dsc.interceptor.impl.DocumentPassivationInterceptor.intercept(DocumentPassivationInterceptor.java:53)
    at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptorChainImpl.java:60)
    at com.adobe.idp.dsc.transaction.interceptor.TransactionInterceptor$1.doInTransaction(TransactionInterceptor.java:74)
    at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapterBean.execute(EjbTransactionCMTAdapterBean.java:357)
    at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapterBean.doSupports(EjbTransactionCMTAdapterBean.java:227)
    at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapter_z73hg_ELOImpl.__WL_invoke(Unknown Source)
    at weblogic.ejb.container.internal.SessionLocalMethodInvoker.invoke(SessionLocalMethodInvoker.java:31)
    at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapter_z73hg_ELOImpl.doSupports(Unknown Source)
    at com.adobe.idp.dsc.transaction.impl.ejb.EjbTransactionProvider.execute(EjbTransactionProvider.java:104)
    at com.adobe.idp.dsc.transaction.interceptor.TransactionInterceptor.intercept(TransactionInterceptor.java:72)
    at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptorChainImpl.java:60)
    at com.adobe.idp.dsc.interceptor.impl.InvocationStrategyInterceptor.intercept(InvocationStrategyInterceptor.java:55)
    at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptorChainImpl.java:60)
    at com.adobe.idp.dsc.interceptor.impl.InvalidStateInterceptor.intercept(InvalidStateInterceptor.java:37)
    at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptorChainImpl.java:60)
    at com.adobe.idp.dsc.interceptor.impl.AuthorizationInterceptor.intercept(AuthorizationInterceptor.java:188)
    at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptorChainImpl.java:60)
    at com.adobe.idp.dsc.interceptor.impl.JMXInterceptor.intercept(JMXInterceptor.java:48)
    at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptorChainImpl.java:60)
    at com.adobe.idp.dsc.engine.impl.ServiceEngineImpl.invoke(ServiceEngineImpl.java:121)
    at com.adobe.idp.dsc.routing.Router.routeRequest(Router.java:131)
    at com.adobe.idp.dsc.provider.impl.base.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:93)
    at com.adobe.idp.dsc.provider.impl.vm.VMMessageDispatcher.doSend(VMMessageDispatcher.java:225)
    at com.adobe.idp.dsc.provider.impl.base.AbstractMessageDispatcher.send(AbstractMessageDispatcher.java:69)
    at com.adobe.idp.dsc.clientsdk.ServiceClient.invoke(ServiceClient.java:208)
    at com.adobe.workflow.engine.PEUtil.invokeAction(PEUtil.java:893)
    at com.adobe.idp.workflow.dsc.invoker.WorkflowDSCInvoker.transientInvoke(WorkflowDSCInvoker.java:350)
    at com.adobe.idp.workflow.dsc.invoker.WorkflowDSCInvoker.invoke(WorkflowDSCInvoker.java:158)
    at com.adobe.idp.dsc.interceptor.impl.InvocationInterceptor.intercept(InvocationInterceptor.java:140)
    at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptorChainImpl.java:60)
    at com.adobe.idp.dsc.interceptor.impl.DocumentPassivationInterceptor.intercept(DocumentPassivationInterceptor.java:53)
    at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptorChainImpl.java:60)
    at com.adobe.idp.dsc.transaction.interceptor.TransactionInterceptor$1.doInTransaction(TransactionInterceptor.java:74)
    at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapterBean.execute(EjbTransactionCMTAdapterBean.java:357)
    at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapterBean.doRequiresNew(EjbTransactionCMTAdapterBean.java:299)
    at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapter_z73hg_ELOImpl.__WL_invoke(Unknown Source)
    at weblogic.ejb.container.internal.SessionLocalMethodInvoker.invoke(SessionLocalMethodInvoker.java:31)
    at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapter_z73hg_ELOImpl.doRequiresNew(Unknown Source)
    at com.adobe.idp.dsc.transaction.impl.ejb.EjbTransactionProvider.execute(EjbTransactionProvider.java:143)
    at com.adobe.idp.dsc.transaction.interceptor.TransactionInterceptor.intercept(TransactionInterceptor.java:72)
    at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptorChainImpl.java:60)
    at com.adobe.idp.dsc.interceptor.impl.InvocationStrategyInterceptor.intercept(InvocationStrategyInterceptor.java:55)
    at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptorChainImpl.java:60)
    at com.adobe.idp.dsc.interceptor.impl.InvalidStateInterceptor.intercept(InvalidStateInterceptor.java:37)
    at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptorChainImpl.java:60)
    at com.adobe.idp.dsc.interceptor.impl.AuthorizationInterceptor.intercept(AuthorizationInterceptor.java:188)
    at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptorChainImpl.java:60)
    at com.adobe.idp.dsc.interceptor.impl.JMXInterceptor.intercept(JMXInterceptor.java:48)
    at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptorChainImpl.java:60)
    at com.adobe.idp.dsc.engine.impl.ServiceEngineImpl.invoke(ServiceEngineImpl.java:121)
    at com.adobe.idp.dsc.routing.Router.routeRequest(Router.java:131)
    at com.adobe.idp.dsc.provider.impl.base.AbstractMessageReceiver.invoke(AbstractMessageReceiver.java:329)
    at com.adobe.idp.dsc.provider.impl.soap.axis.sdk.SoapSdkEndpoint.invokeCall(SoapSdkEndpoint.java:139)
    at com.adobe.idp.dsc.provider.impl.soap.axis.sdk.SoapSdkEndpoint.invoke(SoapSdkEndpoint.java:81)
    at sun.reflect.GeneratedMethodAccessor736.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397)
    at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186)
    at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
    at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
    at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
    at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
    at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454)
    at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
    at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:751)
    at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:844)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:242)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:216)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:132)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:338)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:74)
    at com.adobe.idp.dsc.provider.impl.soap.axis.InvocationFilter.doFilter(InvocationFilter.java:43)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:74)
    at com.adobe.idp.um.auth.filter.CSRFFilter.doFilter(CSRFFilter.java:86)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:74)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3288)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3254)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
    at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2163)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2089)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2074)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1513)
    at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:254)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
Caused by: java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpPost
    at com.adobe.livecycle.clientproxy.ClientProxyServiceImpl.post(ClientProxyServiceImpl.java:45)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.adobe.idp.dsc.component.impl.DefaultPOJOInvokerImpl.invoke(DefaultPOJOInvokerImpl.java:118)
    ... 93 more
Caused by: java.lang.ClassNotFoundException: org.apache.http.client.methods.HttpPost
    at org.ungoverned.moduleloader.ModuleClassLoader.findClass(ModuleClassLoader.java:296)
    at org.ungoverned.moduleloader.ModuleClassLoader.loadClass(ModuleClassLoader.java:164)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    ... 99 more

mmvidus

unread,
Aug 7, 2014, 1:01:19 PM8/7/14
to live...@googlegroups.com
Here is the component.xml

<component xmlns="http://adobe.com/idp/dsc/component/document">
    <!-- Unique id identifying this component -->
    <component-id>com.adobe.livecycle.clientproxy.restfulComponentv2
    </component-id>
    <!-- Version -->
    <version>1.0</version>
    <class-path>adobe-formdataintegration-client.jar adobe-forms-client.jar
        axis.jar adobe-usermanager-client.jar adobe-utilities.jar
        commons-codec-1.6.jar commons-logging-1.1.3.jar fluent-hc-4.3.4.jar
        httpclient-4.3.4.jar httpclient-cache-4.3.4.jar httpcore-4.3.2.jar
        httpmime-4.3.4.jar commons-lang3-3.1.jar
    </class-path>
    <!-- bootstrap implementation class -->
    <bootstrap-class>com.adobe.livecycle.clientproxy.BootstrapImpl
    </bootstrap-class>
    <!-- lifecycle implementation class -->
    <lifecycle-class>com.adobe.livecycle.clientproxy.LifeCycleImpl
    </lifecycle-class>
    <services>
        <!-- Unique name for service descriptor. The value is used as the default
            name for deployed services -->
        <service name="ClientProxyService">
            <!-- service implementation class definition -->
            <implementation-class>com.adobe.livecycle.clientproxy.ClientProxyServiceImpl
            </implementation-class>
            <!-- description -->
            <description>Allows you to consume a REST web service.</description>

            <!-- You can provide your own icons for a distinct look -->
            <small-icon>icons/Lc_InvokeProcess_Md_N.png</small-icon>
            <large-icon>icons/Lc_InvokeProcess_75x66_N.png</large-icon>

            <operations>
                <!-- method name in the interface ClientProxyService -->
                <operation name="post">
                    <!-- input parameters to the "send" method -->
                    <input-parameter name="url" title="URL"
                        type="java.lang.String">
                    </input-parameter>
                    <input-parameter name="body" title="stringBody"
                        type="java.lang.String">
                    </input-parameter>
                    <output-parameter name="responseString" type="java.lang.String">
                    </output-parameter>
                    <faults>
                        <fault name="Exception" type="java.lang.Exception" />
                    </faults>
                     <hint>Posts a string body to URL</hint>
                </operation>
                <operation name="postDoc">
                    <!-- input parameters to the "send" method -->
                    <input-parameter name="url" title="URL"
                        type="java.lang.String">
                    </input-parameter>
                    <input-parameter name="body" title="stringBody"
                        type="java.lang.String">
                    </input-parameter>
                    <output-parameter name="responseDoc" type="org.w3c.dom.Document">
                    </output-parameter>
                    <faults>
                        <fault name="Exception" type="java.lang.Exception" />
                    </faults>
                     <hint>Posts a document to URL</hint>
                </operation>
            </operations>
        </service>
    </services>
</component>

Darren

unread,
Aug 8, 2014, 12:18:50 AM8/8/14
to live...@googlegroups.com
for your <class-path> you don't need to specify (or include) any of the adobe Jar files. They are available to the DSC automatically at runtime. You usually have them in your eclipse project for compiling purposes but exclude them in Ant from the build and also from the <class-path>

Also make sure the path to your Jar files is the actual path in the project. Yours don't have a path so it will try to locate them in the root of the Jar. If they are in the 'lib' directory, then prefix your Jars with 'lib/jar_name.jar'

Cheers
Darren
Reply all
Reply to author
Forward
0 new messages