on 09-03-2007 10:40 AM
Hi All,
We are doing one JMS to File Interface in which we are receiving EBCDIC format data from IBM MQ, JMS sender adapter reads this EBCDIC format data and send to the XI, then XI sends that message to the Receiver File adapter. Now My requirement is to convert the EBCDIC format data to ASCII.
For that we developed one Module which converts EBCDIC format to ASCII format. In the standalone system(Eclipse IDE) it is working fine, when we applied the same logic in module we are getting veriety of exceptions. By analising these exception we are unable to identify the problem. The following are the some exceptions we faced in several situations.
EXCEPTION1: Delivery of the message to the application using connection File_http://sap.com/xi/XI/System failed, due to: com.sap.aii.af.ra.ms.api.RecoverableException: java.lang.Exception.
The following is the Java code written for Conversion from EBCDIC to ASCII,
public ModuleData process(ModuleContext modulecontext, ModuleData inputModuleData) throws ModuleException{
Object obj=null;
String filename=null;
Message msg=null;
try{
msg=(Message)inputModuleData.getPrincipalData();
Hashtable mp=(Hashtable)inputModuleData.getSupplementalData("module.parameters");
if(mp!=null)
filename =(String)mp.get("FileName");
}catch(Exception e){
ModuleException me=new ModuleException();
throw me;
}
try{
XMLPayload xmlpayload=msg.getDocument();
InputStream in=(InputStream)xmlpayload.getInputStream();
InputStreamReader isr=new InputStreamReader(in,"CP037");
BufferedReader br=new BufferedReader(isr);
String str=null;
StringBuffer sb=new StringBuffer();
while((str=br.readLine())!=null){
int g=str.length();
String sub1=str.substring(108,525);
String sub2=str.substring(632,g);
StringBuffer sb1=new StringBuffer(); sb.append(sub1).append("\n");
sb1.append(sub2);
int x=0;
int k=1;
int h=sub2.length();
int r=h/1063;
int y=h%1063;
if(y>0){
r=r+1;
} for(int j=0;j<sub2.length();j++){
while(k<=r)
{
sb1.append(sub2.substring(x,k*1063)).append("\n");
x=k*1063;
k++;
}
}
sb.append(sb1);
}
String finalData=sb.toString();
byte[] mybytes=finalData.getBytes();
xmlpayload.setContent(mybytes);
//xmlpayload.setContentType(finalData);
inputModuleData.setPrincipalData(msg);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}catch(Exception e){
ModuleException me=new ModuleException();
throw me;
}
return inputModuleData;
}
}
Can any body Help.
Thanks In Advance.
Madhusudhan.
Hi Madhu,
Please look into these links ,Might be usefull....
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/xi/troubleshooting%2bthe%2bfile%2badapter
/people/shabarish.vijayakumar/blog/2007/07/26/troubleshooting-the-file-adapter-last-updated-on-02-july10
Reward points if usefull........................
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
10 | |
10 | |
9 | |
7 | |
6 | |
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.