02-03-2017 3:49 PM - edited 01-21-2024 9:55 PM
Hi All
Need quick help!! As i need to complete this requirement on priority.
In Java mapping I have included code for Converting input file to Base64,Read Dynamic file name,Map file name to few fields and read Date and convert from YYYYMMDDHHMISS to "YYYY-MM-DDTHH:MI:SS"
I see only one warning "The type StreamTransformation is deprecated"
But as per this link we can still use StreamTransformation. Please help me ..... This is blocking me to test the scenario.
http://help.sap.com/javadocs/pi/sp3/xpi/com/sap/aii/mapping/api/StreamTransformation.html
However I exported with warnings and when I execute the scenarion in interface mapping aswell as in SXMB_MONI I see error.
In MONI:
Java mapping base64/Base64encode has thrown a StreamTransformationException.
In Interface mapping:
Start of test
Regards
Anitha
Thank you Frederik
Thats correct!! Also I have removed .PDF from file name and I can see message processing successfully.
String date = arr[3].toLowerCase().replaceAll(".pdf","");//It will remove the file extension part from fourth token
Hence closing the thread.
Regards
Anitha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Trace:
<Trace level="1" type="T">Java mapping base64/Base64encode has thrown a StreamTransformationException. </Trace>
<Trace level="1" type="T">com.sap.aii.mapping.api.StreamTransformationException: java.lang.IllegalArgumentException: Illegal pattern character 'Y'
at base64.Base64encode.execute(Base64encode.java:59)
at com.sap.aii.ibrun.server.mapping.JavaMapping.executeStep(JavaMapping.java:64)
at com.sap.aii.ibrun.server.mapping.Mapping.execute(Mapping.java:92)
at com.sap.aii.ibrun.server.mapping.MappingHandler.run(MappingHandler.java:90)
at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleMappingRequest(MappingRequestHandler.java:95)
at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleRequest(MappingRequestHandler.java:68)
at com.sap.aii.ibrun.sbeans.mapping.MappingServiceImpl.processFunction(MappingServiceImpl.java:79)
at com.sap.aii.ibrun.sbeans.mapping.MappingServiceObjectImpl0_0.processFunction(MappingServiceObjectImpl0_0.java:131)
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:331)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anitha,
your root cause for the exception is the following:
java.lang.IllegalArgumentException: Illegal pattern character 'Y'
and it is thrown while the creation of your SimpleDateFormat.
Please take a look into the Java 1.4 Documentation of SimpleDateFormat.
The correct initialization of your SimpleDateFormat would be:
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
Kind Regards
Frederik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What is the error messge shown in monitor?
Regards, Evgeniy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Evgeniy
Sorry the error messages which you see is from Operational mapping(when I tested only mapping).
But in MONI there is no such error and I can see file name in DC of MONI.
so I suspect problem is here while reading 4th string(date&time) and converting to required format (YYYY-MM-DDTHH:MI:SS) and omit .pdf from file name.
Please help me!!
Regards
Anitha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anitha!
As I could see from error message:
java.lang.NullPointerException: while trying to invoke the method java.lang.String.split(java.lang.String) of a null object loaded from local variable 'fileName'
String.split() method raises exception because 'fileName' variable is null.
You can easily check it up: just comment DC part of your code and set any constant value to fileName variable in your code. If no error is raised - your variable gets wrong value (null) from DC.
Regards, Evgeniy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Evgeniy
I think problem is here while reading 4th string(date&time) and converting to required format (YYYY-MM-DDTHH:MI:SS) and omit .pdf from file name.
Please help me to resolve this and correct me if wrong.
Regards
Anitha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Evgeniy
I think its going wrong here while reading fourth token(date&time) from file name: 3003222742_6989_6220860905800023_20170117153350.PDF
String arr[] = fileName.split("_"); //it will split the string into multiple token
String InvoiceNumber = arr[0]; //it will take the first token
String MerchantNumber = arr[1]; // second token
String CardNumber = arr[2]; //Third token
//String date = arr[3];
Date yourDate = new Date();
SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("YYYY-MM-DDTHH:MI:SS");
String date = DATE_FORMAT.format(yourDate);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Evgeniy
I see in MONI dynamic configuration is performed.
<SAP:DynamicConfiguration SOAP:mustUnderstand="1" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SAP="http://sap.com/xi/XI/Message/30"><SAP:Record namespace="http://sap.com/xi/XI/System/File" name="FileName">3003222742_6989_6220860905800023_20170117153350.PDF</SAP:Record></SAP:DynamicConfiguration>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Evgeniy
I have already checked the File Name box in ASMA parameters of sender file channel.
Please let me know if I missed anything.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anitha!
Did you read my answer in previous thread?
Your fileName variable is null. This means that you didn't get "FileName" attribute from Dynamic Configuration. Did you set required ASMA parameters to store file name to DC in file sender channel?
Error you get doesn't depends on your JRE version.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.