Calling a CAPI from Java

513 views
Skip to first unread message

J.M.

unread,
Oct 3, 2016, 5:50:21鈥疉M10/3/16
to Fujitsu RunMyProcess Developer Community
Hi,


I'm trying to intantiate some processes from outside RMP, in my case, from Java.
My idea is the following:
In Java, I process a text file, in which, for each of his lines, I will make a call to a CAPI. The only task this CAPI has, is the instantiation of another process I have designed.

I know that making a request to the CAPI's URL is enough to launch it, however, I need to add some parameters in order to use them in my processes.

So, my question is...
驴How should I make the call to my CAPI, from Java, and adding some parameters?


I would appreciate a detailed answer, please.
Thanks in advance and regards.

Murali

unread,
Oct 3, 2016, 7:18:46鈥疉M10/3/16
to Fujitsu RunMyProcess Developer Community, javiermm...@gmail.com
Hi Javier,

Please refer to code example and guidelines as detailed in earlier resolved post and let us know if you are able to progress for the requirement.

RMP userguide ref: https://docs.runmyprocess.com/Developer_Guide/Composite_API/Composite_API_Example#third-party

Regards,
Murali
Fujitsu RunMyProcess Support

javiermm...@gmail.com

unread,
Oct 3, 2016, 9:42:40鈥疉M10/3/16
to Fujitsu RunMyProcess Developer Community, javiermm...@gmail.com
Hi Murali,

Thank you for the reply, It is very useful.
But I have some troubles in order to launch a CAPI instead of a process (as it's explained in the post you linked). I think the code is similar, buy I think the dataPOSTed should change, right?

How should the postData be?

Thanks again and regards.

J.M.

unread,
Oct 3, 2016, 11:03:53鈥疉M10/3/16
to Fujitsu RunMyProcess Developer Community, javiermm...@gmail.com
Hi again,

I'm trying to adapt the code of the mentioned post but I'm not getting it, and I don't know why. I'm getting the following error:
java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:618)
at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:160)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:275)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:371)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:932)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1091)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250)
at es.fujitsu.rmp.peticion.PeticionRMP.post(PeticionRMP.java:48)
at es.fujitsu.rmp.peticion.PeticionRMPTest.testPost(PeticionRMPTest.java:56)
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 org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)


I attach my code too.



Also, I would like to know:
- Which is the correct way to launch a process from Java: instantiating a process (the code I attach) or calling a CAPI with parameters. What is the difference betweeen both options?
- How can I achieve a solution (for any of them)?
I'm trying to instantiate my process because of the example in the post, but I don't know if it is the correct way.

How can I solve the timeout error in my example?
How would the java code be for launching a CAPI with parameters from JAVA?

Please, help me finding a solution.


Regards.
PeticionRMP.java

Pankaj Kumar

unread,
Oct 4, 2016, 7:03:01鈥疉M10/4/16
to Fujitsu RunMyProcess Developer Community, Javier Mart铆n
Hi Javier,

You are using the same xml in java code that is shared by Murali. Please use the xml as per your process configuration. Please refer to attached screen-print for more details.

This code uses the聽Standard HttpURLConnection API to trigger the process corresponding connector/instantiate the process instance. To know the difference between process and Composite API, please refer to below.



Thank you,
Pankaj Kumar
Fujitsu RunMyProcess Support

--
Fujitsu - RunMyProcess
---
You received this message because you are subscribed to the Google Groups "Fujitsu RunMyProcess Developer Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to supportforum+unsubscribe@runmyprocess.com.
To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at https://groups.google.com/a/runmyprocess.com/group/supportforum/.
To view this discussion on the web visit https://groups.google.com/a/runmyprocess.com/d/msgid/supportforum/7b78df60-65bc-48c9-b1a1-44bccd0c2941%40runmyprocess.com.

1.png
2.png
Reply all
Reply to author
Forward
0 new messages