on 02-12-2019 9:39 AM
Hi Experts,
Is it possible to reuse older java mappings from PI in CPI by calling them in groovy?
i want to reuse my old java mappings from within PI/PO in CPI.
I have imported the jar files into CPI and i am trying to call the mapping class from within groovy.
Here is my groovy code;
import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
import Tester.TestBO; // importing the java class from jar
def Message processData(Message message)
{
//Body as string def body = message.getBody(java.lang.String) as String;
def javaMapping = new TestBO(); // reference jar class
def result = javaMapping.transform(body); // calling the transform method
message.setBody(result); // setting the body
return message; // returning the message that should be mapped
}
With this i am getting the following error;
"No signature of method: Tester.TestBO.transform() is applicable for argument types: (java.lang.String) values; (my XML structure i want to map) "
Any help would be appreciated
Thanks
Hello Dale,
You can follow this blog post: https://blogs.sap.com/2018/03/19/using-java-mappings-in-sap-cloud-platform-integration-cpi/
Regards,
Fatih
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dale,
def result = javaMapping.transform(body); // calling the transform method
"body" is a variable of type String whereas the signature of the method transform has an argument of type TransformationInput and another one of type TransformationOutput.
Normally I take the code of the method transform (in some cases also in the method execute) which usually is called by the method transform) and adapt it as follows in the groovy script:
It ends up you develop a code sequence like this:
String->InputStream->Document->[processing/coding]->Document->OutputStream->String
Regards.
JT
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.