cancel
Showing results for 
Search instead for 
Did you mean: 

SAP PI module development (7.5)

peakMeissner
Active Participant
0 Kudos

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:

SAP Help Portal - NW 7.5 - PI

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?

Accepted Solutions (0)

Answers (6)

Answers (6)

former_member189220
Active Contributor

1.

If one would like to deploy any application on the NW AS Java, they must convert app format at least to SDA.

1833230 - deployment of j2ee archive which is no SDA is not supported

This is the most important thing you need to consider.

2.

In case you would like to deploy from the NWDS, you need to add the SAP NW AS Java RunTime System (RTS).

NWDS -> Windows -> Preferences -> SAP AS Java.

VERY IMPORTANT:

2.1. port 5xx13 (HTTP) or 5xx14 (HTTPS) of the NW AS Java, should be accessible from the desktop station where the NWDS has been installed.

2.2. port 5xx04 (for P4 protocol) or 5xx06 (for P4S protocol) should be accessible as well.

2.3. the above mentioned ports are the default ones. If these have been changed on the AS Java. The xx is the central instance number. These ports should be opened in network devices like firewalls and included in the access lists of router devices.

2.4. the AS Java should be up and running. From the NWDS might be implemented ONLY ON-LINE deployment!

3.

In case these ports are not able to be opened, then the deployment from NWDS to the AS Java might not happen - directly. You might use the extract and deploy procedure. Yet, this might be valid if the application might be extracted in an EAR or SCA archive, you might extract it from NWDS and deploy it to SAP AS Java with TELNET or SUM.

More details in this SAP KBA:

1715441 - Deploy/Undeploy/Force Redeploy EAR/WAR/RAR/SDA files on SAP AS JAVA

peakMeissner
Active Participant
0 Kudos

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?

peakMeissner
Active Participant
0 Kudos

*PUSH topic*

former_member190293
Active Contributor
0 Kudos

Hi Frederick-Claud!

In this case I would recommend using JNDI Browser to find your module. If it's found you should use its JNDI-name as module name.

Regards, Evgeniy.

peakMeissner
Active Participant
0 Kudos

Hey evgeniy.kolmakov

THX but basically that has been one of my main resources...

former_member190293
Active Contributor
0 Kudos

Hi Frederick-Claud!

Take a look at this tutorial. I think it would help:

https://blogs.sap.com/2015/01/29/create-sap-pi-adapter-modules-in-ejb-30-standard/

Regards, Evgeniy.

peakMeissner
Active Participant
0 Kudos

Hey milen.dontcheff ,

thx 4 your reply it has been really helpful. So far I've managed to deploy my module to the AS Java instance as provided in your answer. The modules is beeing deployed successfully. I can see the module within the "Development" perspective on the of my NWDS but I do not see the module as an selectable option within the modules at the channel configuration in the "SAP Process Integration Designer". I tried to configure the module by adding the name of the module to to modules list as shown in the followinig picture:

As far as I'm activating the channel an the IFlow is beeing called I'm getting the following error within the message log. Do you have any recommendations?

Kind regards

fcd