on 09-09-2009 2:35 PM
Hi Experts,
I have developed an adapter module to read a excel file , have used the module in the sender file adapter.
What entrie should i put in parameter name and parameter value in module configuration of adapter module in comm channel.
Im too confused,,pls help
Hi Ravindra,
>>parameter name
If your module is expecting any input (say fileType) then specify it here.
>>parameter value
and the value that you will b passing (eg xlx or xslx)
Regards
Suraj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
solved
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Guys,
Im using this blog by felix
Hence, I feel I dont have to add any thing in the parameter and value fields in module configuration.
am i right?
Then i get an error in sender communication channel as seen below..
Im unable to follow where I have gone wrong..request ur help
Error: javax.ejb.TransactionRolledbackLocalException: (Failed in component: sap.com/UserModule_EAR) Exception raised from invocation of public com.sap.aii.af.lib.mp.module.ModuleData com.sap.adaptermodule.GetHostNameBean.process(com.sap.aii.af.lib.mp.module.ModuleContext,com.sap.aii.af.lib.mp.module.ModuleData) throws com.sap.aii.af.lib.mp.module.ModuleException method on bean instance com.sap.adaptermodule.GetHostNameBean@299c92f0 for bean sap.com/UserModule_EARxml|UserModule_EJB.jarxml|GetHostName in application sap.com/UserModule_EAR.; nested exception is: java.lang.NullPointerException; nested exception is: javax.ejb.EJBException: (Failed in component: sap.com/UserModule_EAR) Exception raised from invocation of public com.sap.aii.af.lib.mp.module.ModuleData com.sap.adaptermodule.GetHostNameBean.process(com.sap.aii.af.lib.mp.module.ModuleContext,com.sap.aii.af.lib.mp.module.ModuleData) throws com.sap.aii.af.lib.mp.module.ModuleException method on bean instance com.sap.adaptermodule.GetHostNameBean@299c92f0 for bean sap.com/UserModule_EARxml|UserModule_EJB.jarxml|GetHostName in application sap.com/UserModule_EAR.; nested exception is: java.lang.NullPointerException; nested exception is: javax.ejb.EJBTransactionRolledbackException: (Failed in component: sap.com/UserModule_EAR) Exception raised from invocation of public com.sap.aii.af.lib.mp.module.ModuleData com.sap.adaptermodule.GetHostNameBean.process(com.sap.aii.af.lib.mp.module.ModuleContext,com.sap.aii.af.lib.mp.module.ModuleData) throws com.sap.aii.af.lib.mp.module.ModuleException method on bean instance com.sap.adaptermodule.GetHostNameBean@299c92f0 for bean sap.com/UserModule_EARxml|UserModule_EJB.jarxml|GetHostName in application sap.com/UserModule_EAR.; nested exception is: java.lang.NullPointerException; nested exception is: javax.ejb.EJBException: (Failed in component: sap.com/UserModule_EAR) Exception raised from invocation of public com.sap.aii.af.lib.mp.module.ModuleData com.sap.adaptermodule.GetHostNameBean.process(com.sap.aii.af.lib.mp.module.ModuleContext,com.sap.aii.af.lib.mp.module.ModuleData) throws com.sap.aii.af.lib.mp.module.ModuleException method on bean instance com.sap.adaptermodule.GetHostNameBean@299c92f0 for bean sap.com/UserModule_EARxml|UserModule_EJB.jarxml|GetHostName in application sap.com/UserModule_EAR.; nested exception is: java.lang.NullPointerException any help is appreciated
Regards,
Teja
Edited by: Ravindra Teja on Sep 10, 2009 8:50 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If you are following Felix's blog then you don't have any input parameter. Make sure you are reading the excel file as BIN (specify the mode in sender file adapter)
Also see whether the module is correctly deployed or not. Check this document
Regards
Suraj
Im still getting this error
Error: javax.ejb.TransactionRolledbackLocalException: (Failed in component: sap.com/UserModule_EAR) Exception raised from invocation of public com.sap.aii.af.lib.mp.module.ModuleData com.sap.adaptermodule.GetHostNameBean.process(com.sap.aii.af.lib.mp.module.ModuleContext,com.sap.aii.af.lib.mp.module.ModuleData) throws com.sap.aii.af.lib.mp.module.ModuleException method on bean instance com.sap.adaptermodule.GetHostNameBean@299c92f0 for bean sap.com/UserModule_EARxml|UserModule_EJB.jarxml|GetHostName in application sap.com/UserModule_EAR.; nested exception is: java.lang.NullPointerException; nested exception is: javax.ejb.EJBException: (Failed in component: sap.com/UserModule_EAR) Exception raised from invocation of public com.sap.aii.af.lib.mp.module.ModuleData com.sap.adaptermodule.GetHostNameBean.process(com.sap.aii.af.lib.mp.module.ModuleContext,com.sap.aii.af.lib.mp.module.ModuleData) throws com.sap.aii.af.lib.mp.module.ModuleException method on bean instance com.sap.adaptermodule.GetHostNameBean@299c92f0 for bean sap.com/UserModule_EARxml|UserModule_EJB.jarxml|GetHostName in application sap.com/UserModule_EAR.; nested exception is: java.lang.NullPointerException; nested exception is: javax.ejb.EJBTransactionRolledbackException: (Failed in component: sap.com/UserModule_EAR) Exception raised from invocation of public com.sap.aii.af.lib.mp.module.ModuleData com.sap.adaptermodule.GetHostNameBean.process(com.sap.aii.af.lib.mp.module.ModuleContext,com.sap.aii.af.lib.mp.module.ModuleData) throws com.sap.aii.af.lib.mp.module.ModuleException method on bean instance com.sap.adaptermodule.GetHostNameBean@299c92f0 for bean sap.com/UserModule_EARxml|UserModule_EJB.jarxml|GetHostName in application sap.com/UserModule_EAR.; nested exception is: java.lang.NullPointerException; nested exception is: javax.ejb.EJBException: (Failed in component: sap.com/UserModule_EAR) Exception raised from invocation of public com.sap.aii.af.lib.mp.module.ModuleData com.sap.adaptermodule.GetHostNameBean.process(com.sap.aii.af.lib.mp.module.ModuleContext,com.sap.aii.af.lib.mp.module.ModuleData) throws com.sap.aii.af.lib.mp.module.ModuleException method on bean instance com.sap.adaptermodule.GetHostNameBean@299c92f0 for bean sap.com/UserModule_EARxml|UserModule_EJB.jarxml|GetHostName in application sap.com/UserModule_EAR.; nested exception is: java.lang.NullPointerException
ne help on this?
Hi Ivan,
The code is basically to read the all colums add em under xml tags and read from second row on wards the data
please find below the module data code
public ModuleData process(ModuleContext mc, ModuleData imd)throws ModuleException
{
Object obj = null;
Message msg = null;
MessageKey amk = null ;
amk = new MessageKey(msg.getMessageId(),msg.getMessageDirection());
Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"Module called");
try {
obj = imd.getPrincipalData();
msg = (Message) obj;
XMLPayload xp = msg.getDocument();
if (xp != null)
{
byte by[] = convert(xp.getContent());
xp.setContent(by);
}
imd.setPrincipalData(msg);
}
catch (Exception e)
{}
return imd;
}
public byte[] convert(byte src[]) throws Exception
{
String xmldata = "";
try
{
ByteArrayInputStream byteArr = new ByteArrayInputStream(src);
Workbook w = Workbook.getWorkbook(byteArr);
xmldata ="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n"+ "<ns0:""MT_ExcelFiles"" ""xmlns:ns0=\"""urn:xyz:abc"+"\"> \n";
int a = w.getSheet(0).getRows();
int b = w.getSheet(0).getColumns();
for(int j=1;j<a;j++)
{
for(int i=0;i<b;i++)
{
xmldata = xmldata + "<"w.getSheet(0).getCell(i,0).getContents().toString()">"w.getSheet(0).getCell(i,j).getContents().toString()"</"w.getSheet(0).getCell(i,0).getContents().toString()">";
}
}
xmldata = xmldata"</ns0:""MT_ExcelFiles"+">";
w.close();
}
catch (Exception e)
{}
return xmldata.getBytes();
Hi,
As I told you in my last post:
amk = new MessageKey(msg.getMessageId(),msg.getMessageDirection());
//msg is null
Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"Module called");
try {
obj = imd.getPrincipalData();
msg = (Message) obj;
It must be
obj = imd.getPrincipalData();
msg = (Message) obj;
amk = new MessageKey(msg.getMessageId(),msg.getMessageDirection());
Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"Module called");
try {
Regards
Ivan
If your module is expecting some parameters from the module tab(for example your may read message type and the namespace to bulid the xml inside the module
Whatever the ModuleKey you are specifiying in the Processing Sequence, the same you have to use in Module Configuration(example res)
Module key parameter Name parameter value
res msgType MT_Source
res nameSpace http://example/moduletest
then you will read these parameters inside the module for processing
ModuleContext mc;
msgType = (String) mc.getContextData("msgType");
nameSpace = (String) mc.getContextData("nameSpace");
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
Inside you module, use the following code to read any parameter you enter in the CC.
String myParameterValue = moduleContext.getContextData("myparameter");
Regards
Ivan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.