Hello folks,
i now spend several hours looking in SAP-Documentation, Forum Entries here and at least at Google to find hints solving my problem.
The problem seems simple to me, but i can not solve it.
I hope that someone here can give me the missing hint.
The problem is, that i want to make a function call out of an abap-System to a Netweaver 7.11 Eh1 CE Java Application Server.
So i created a Function-Module in SE37 in SAP, marked it remote startable, created an SM59 Entry for the Java-System.
As far as i understood, there are two possible ways of solving the probem.
a) First way is to create a Jco RFC Provider in the Java-System. Connection itself works after creating the neccessary Entries in NWDA and starting the Jco-Provider. I can see that because SM59 Connection test from Abap works fine.
I now created a Java Stateless Session Bean and created the Method processFunction
@Stateless public class Z_BESCHLAGPAKETBean implements FB_BESCHLAGPAKETLocal { public void processFunction(com.sap.mw.jco.JCO.Function function) { com.sap.mw.jco.JCO.ParameterList input = function.getImportParameterList(); com.sap.mw.jco.JCO.ParameterList output = function.getExportParameterList(); com.sap.mw.jco.JCO.ParameterList tables = function.getTableParameterList(); System.err.println ("Eingabe="+input.getString("IV_BELN")); } }
As i further read is, that i have to create a JNDI-Entry for that Session Bean that has the same name as Function-Module in SAP
So i edited ejb-j2ee-engine.xml
<?xml version="1.0" encoding="UTF-8"?> <ejb-j2ee-engine xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ejb-j2ee-engine_3_0.xsd"> <enterprise-beans> <enterprise-bean> <ejb-name>Z_BESCHLAGPAKETBean</ejb-name> <jndi-name>Z_EEL_BESCHLAGPAKET</jndi-name> <session-props/> </enterprise-bean> </enterprise-beans> </ejb-j2ee-engine>
But when i now start i see in Log-Viewer, that the Jco-RFC Provider tries to start the Bean but cant find it
Bean Z_EEL_BESCHLAGPAKET not found on host hvwvml99, ProgId =KALLISTO: Object not found in lookup of Z_EEL_BESCHLAGPAKET.registered entries for FuctionName=JNDIName : {RSPOR_SETUP_CHECK=PRTRFC_BASE, UWL_PUSH_ITEMS=PRTRFC_BASE}
With JNDI-Browser i also cant find an Entry for Z_EEL_BESCHLAGPAKET. So i think the problem is maybee that the jndi-Entry can not correctly set.
There is no ejb-jar.xml generated (in none of my projects and we created a lot of working beans together with WebDynpro Java.
I also asking myself if only creating the Method processFunction is enough or is there special interface the bean has to implement additionaly.
b) Second way is to use the JRA
As far as i understood the Documentation this is done by creating a Message Driven Bean.
This is my MDB for this
@ MessageDriven(name = "EelClassRfcInBean") public class EelClassRfcInBean implements MessageDrivenBean, SynchronousMessageListener { private static final long serialVersionUID = 2077941497342675725L; private MessageDrivenContext context; public MappedRecord onMessage(MappedRecord request, MappedRecord response, Properties info) { // data from SAP are passed over request. // response contains initial data as defined in SAP // set import parameter RESPTEXT of the Remote Function // Module STFC_CONNECTION request.get("IV_VBELN"); response.put("EV_RETURN", new Integer(10000000)); // get value of the import parameter REQUTEXT and copy // it into export parameter ECHOTEXT return response; } public void ejbRemove() throws EJBException { } public void setMessageDrivenContext(MessageDrivenContext contextParam) throws EJBException { context = contextParam; } } }
To map the Function Module to this MDB i also created entries in the ejb-j2ee-engine.xml
<?xml version="1.0" encoding="UTF-8"?> <ejb-j2ee-engine xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ejb-j2ee-engine_3_0.xsd"> <enterprise-beans> <!-- Shortend: Remove ejb-Entries for better readability --> <message-driven> <display-name>Z_EEL_BESCHLAGPAKET</display-name> <ejb-name>EelClassRfcInBean</ejb-name> <ejb-class> com.huelsta.kall.eel.entity.beans.EelClassRfcInBean </ejb-class> <messaging-type> com.sap.mw.jco.jra.SynchronousMessageListener </messaging-type> <transaction-type>Bean</transaction-type> <activation-config> <activation-config-property> <activation-config-property-name> FunctionName </activation-config-property-name> <activation-config-property-value> Z_EEL_BESCHLAGPAKET </activation-config-property-value> </activation-config-property> </activation-config> </message-driven> </enterprise-beans> </ejb-j2ee-engine>
Doing a local Build in NWDS via Development-Component->Build works fine and without errors. Also for the Ear-Project containing the Bean-Project.
But i cannot deploy the ear because i get the following Exception:
DeploymentException: Cannot find message listener method 'onMessage' with args [interface javax.jms.Message] in class com.huelsta.kall.eel.entity.beans.EelClassRfcInBean for component kall.huelsta.com/mdata_prod_ear*annotation|kall.huelsta.com~mdata_prod_beans~ejbjar.jar*annotation|EelClassRfcInBean
It seems that the deployer expected the onMessage as for a "normal" MDB. But for incoming Abap Connections there are other Parameters in the onMethod Method. I think maybee it is also a problem of the deployment-Descriptor ejb-j2ee-engine.xml?
It would be great if someone could help me out of this problems. Solving one of the two problems would be ok for me ;-)
Best regards
Matthias