Adapter Module development in NWDI
Like it or not, as a PI/PO developer one will eventually face the need to develop certain custom Adapter Modules to fulfill specific customer requirements. So in this blog we are going to describe how this can be done in NWDS (SAP NetWeaver Development Studio) using NWDI (SAP NetWeaver Development Infrastructure). By doing this, custom java developments are secured in a center repository and can be shared with other developers easily.
Re-requisite: A Development Configuration is needed, which contains Build Time dependencies to at least following software components:
- ENGFACADE
- SAP_BUILDT
- SAP_XIAF
Once a Development Configuration is configured and ready for use. We need to imported it into a NWDS client.
1). Create an EJB development component
Make sure that you are in the NWDS perspective “Development Infrastructure”, and proceed as follow.
Note, if the naming reservation service has not been setup for the development configuration, you will only see the vendor as “demo.sap.com” and with name prefix field disable (as number 1 and 2 indicated above). It is fine like that, just give the development component a name separate either by “/” or “_”.
After clicking on “Finish”, the NWDS client would ask to switch to the “Java EE” perspective. Click on “No”, since there are still a couple of things to be taken care of.
2) Create an EAR development component
Because an EJB development component cannot be deployed into a SAP PI runtime directly, we need to create an EAR development component to do the deployment.
Click on “Next” and “Next”. When promoted with which projects to refer to, tick the check box in front of the EJB development component. So that when deploying the EAR into a PI runtime, the NWDS client knows it should include the EJB development component.
Click “Finish”. Then when the NWDS client asks to switch perspective, still click on “No”. Because we still have one thing left.
3) Add dependencies to the EJB and EAR development components
Following Build Time dependencies are needed for the EJB development component:
- sap.aii.af.ifc.facade
- sap.aii.af.lib.facade
- tc/bl/logging/api
To add a dependency to a development component, first select it and then choose the tab “Dependencies”.
Click on “Finish” and then repeat the same steps for the remaining dependencies. In the end It looks like below for the EJB development component.
Then add Build Time, Deploy Time and Run Time dependencies for the EAR development component:
- sap.aii.af.ifc.facade
- sap.aii.af.lib.facade
- tc/bl/logging/api
The process is pretty much the same as for EJB development component, only this time we need to tick the checkboxes in front of Deploy Time and Run Time as shown below.
In the end It looks like below for the EAR development component.
4) Java Session Bean creation
Now switch to the perspective “Java EE” to create a Java Session Bean. Expand the EJB project; navigate to the folder “ejbModule”; and right click on it.
Click on “Finish”.
A sample custom adapter module implementation would look like below:
Then add bean entries to the “META-INF/ejb-j2ee-engine.xml” file.
Now, we have completed the adapter module development.
5) Deploy the customer Adapter Module into SAP PI runtime
Go back to the NWDS perspective “Development Infrastructure” to build and deploy the EAR development component.
After deployment, you should be able to find the adapter module from the SAP PI NetWeaver Administrator (Path: http://<host>:<port>/nwa >> Troubleshooting >> Java >> JNDI browser).
6) Check in the source code
Until now, we have deployed the custom Adapter Module into the SAP PI runtime, but still the Java source code remains in the local NWDS client. Next we need to check in the source code, so that they are stored in the NWDI server and are available for other developers to check and rework.
Now switch to the NWDS perspective “Development Infrastructure”.
Write some meaningful comments, so that one can always understand what has been done. He can revert it to previous versions if needed.
7) Remove the source code from a local NWDS client
Because source codes have been checked into the NWDI server, we can now remove the developments from our local NWDS client.
Later on, if someone else want to have a look at the source code and work on it, he can just load the source code from NWDI development configuration to his local NWDS client.
Then he is ready to start working on any changes. But always remember to check in his changes to NWDI server!
Hi Kevin,
Nice blog. I followed the steps and deployed EAR on the PO development server. During deployment, I am getting a warning -
DC admodule/ejb does not contain any archives for deployment
And the deployment sign is green. When I try to find the module in JNDI browser, I see nothing. Am I missing something.
Have you added entries in META-INF/ejb-j2ee-engine.xml?