cancel
Showing results for 
Search instead for 
Did you mean: 

parameter name in module configuration of adapter module in comm channel

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

former_member187339
Active Contributor
0 Kudos

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

Answers (4)

Answers (4)

Former Member
0 Kudos

solved

Former Member
0 Kudos

Hi Guys,

Im using this blog by felix

http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417500)ID0367244950DB00578216975372480601End...

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

former_member187339
Active Contributor
0 Kudos

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

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/da5675d1-0301-0010-9584-f6c...

Regards

Suraj

Former Member
0 Kudos

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?

Former Member
0 Kudos

can ne one pls help me out on this..

thanks in advance

Former Member
0 Kudos

HI,

Error is because You are trying to use a reference from a object which is null.

can you provide your source code?

Regards

Ivan

Former Member
0 Kudos

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();

Former Member
0 Kudos

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

Former Member
0 Kudos

Thanks Ivan,

Let me try this and revert back to u

appreciate ur reply

Regards,

Teja

Former Member
0 Kudos

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");

Former Member
0 Kudos

HI,

Inside you module, use the following code to read any parameter you enter in the CC.


String myParameterValue = moduleContext.getContextData("myparameter");

Regards

Ivan