Hello, experts,
I would like to get into the development of SAP PI modules. My first goal is to develop a generic module that writes "Hello world!" to the message log. I've used the following documentation as starting point:
In the example sources the creation of an adapter as well as an module is beeing presented. I was wondering whether is possible to create a generic module without the need to develop an entire adapter.
If I'm not misstaken the code for this approach would be as follows:
package de.sample.aii.af.lib.mp.module;
import com.sap.aii.af.lib.mp.module.Module;
import com.sap.aii.af.lib.mp.module.ModuleContext;
import com.sap.aii.af.lib.mp.module.ModuleData;
import com.sap.aii.af.lib.mp.module.ModuleException;
import com.sap.tc.logging.*;
public class SayHelloWorld implements Module {
private static final Location loc = Location.getLocation(SayHelloWorld.class);
@Override
public ModuleData process(ModuleContext moduleContext, ModuleData inputModuleData) throws ModuleException {
loc.entering();
try {
loc.infoT("Hello World!");
} finally {
loc.exiting();
}
return inputModuleData;
}
}
If this approach would be correct I'd like to package my sources and deploy them to our local SAP PO system. But due the fact that I could not find any possibility to upload my sources using the ESR / ID tools I was wondering whether I need to connect my NWDS to the PO system and run some kind of deployment process. I thought it would be possible to upload an standalone RAR. Can anyone provide me information on how to deploy the module to the server and use it within my integration scenario?
Request clarification before answering.
Hello evgeniy.kolmakov,
thx for your Tipp. I could not find my module in the JNDI Browser. So I dug into my source code and figured that I missed to specify EJB 3.0 specific annotations.
package de.sample.aii.af.lib.mp.module;
import javax.ejb.Local;
import javax.ejb.LocalHome;
import javax.ejb.Remote;
import javax.ejb.RemoteHome;
import javax.ejb.Stateless;
import com.sap.aii.af.lib.mp.module.Module;
import com.sap.aii.af.lib.mp.module.ModuleContext;
import com.sap.aii.af.lib.mp.module.ModuleData;
import com.sap.aii.af.lib.mp.module.ModuleException;
import com.sap.aii.af.lib.mp.module.ModuleHome;
import com.sap.aii.af.lib.mp.module.ModuleLocal;
import com.sap.aii.af.lib.mp.module.ModuleLocalHome;
import com.sap.aii.af.lib.mp.module.ModuleRemote;
import com.sap.tc.logging.*;
/**
* Session Bean implementation class SayHelloWorld
*/
@Stateless(name="SayHelloWorldBean")
@Local(value={ModuleLocal.class})
@Remote(value={ModuleRemote.class})
@LocalHome(value=ModuleLocalHome.class)
@RemoteHome(value=ModuleHome.class)
public class SayHelloWorld implements Module{
private static final Location loc = Location.getLocation(SayHelloWorld.class);
@Override
public ModuleData process(ModuleContext moduleContext, ModuleData inputModuleData) throws ModuleException {
loc.entering();
try {
loc.infoT("Hello World!");
} finally {
loc.exiting();
}
return inputModuleData;
}
}
As far as I changed my sources and redeployed the module to the server I was abled to find the module in the JNDI browser.


When I add the modul to the channel of an IFlow and run the scenario I'm left with the following errors:

*Sender-Channel

* Message protocol

* Log viewer
ANY THOUGHTS ON THIS?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 5 | |
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.