cancel
Showing results for 
Search instead for 
Did you mean: 

How to get incoming Abap to Java Calls working with Jco-RFC or JRA

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

meanwhile i found a solution for way a) (JCo RFC Provider) in another thread.

Everything is ok so far in my coding above. BUT nowhere in Documentation i found a hint, that using Jco RFC Provider NOT works with EJB 3.0 but with EJB 2.1 !!!

For this i not only have to create the Local Interface which the Bean has to implement. I further have to create the EBJ 2.1 Interfaces as:


public interface FB_BESCHLAGPAKETLocalHome extends EJBLocalHome {

    public com.dihug.kall.eel.FB_BESCHLAGPAKETLocalComponent create() throws javax.ejb.CreateException, java.rmi.RemoteException;

}

}

and


public interface FB_BESCHLAGPAKETLocalComponent extends EJBLocalObject {

    public void processFunction (Function function);

   

}

Doing so, the RFC from Abap to Java works with JCo RFC-Provider

Unfortunatly i didn't found it in documentation that this EBJ 2.1 specific interfaces have to be declared even NW 7.11 is a JEE5 Server with EJB 3 Support and a developer on this plattform would normally go the EJB 3 Way.

Even though i now have a working solution it would be interesting how the JRA Way would go.

kind regards

Matthias

Former Member
0 Kudos

Hi Matthias,

I have the same problem. I need to get incoming ABAP to Java working on NW 7.4 AS Java.

I also tried both ways, but both are not running:

1. JCo RFC Provider Service

I did it like you, but I got the following warning on deployment of the stateless session bean:

The stateless session bean .. has an interface ... which exposes a method with name processFunction.

That means the bean is exposed for RFC access which since JCo 3.0 is a deprecated functionality and the bean will not be exposed in JNDI for RFC access.

Please check SAP note 1077727 "SAP JCo 3.0 release and support strategy.

2. SAP JRA Server Model

I configured the resource adapter and implemented the MDB that implementscom.sap.mw.jco.jra.SynchronousMessageListener.

But it is not working. The MDB is not called. Instead the following error message appears:

'EXPORT_TOTALS_TO_ADSTAR' could not be found in the server repository.

This is part of a JCo Exception. No idea why a server repository is needed. I found nothing in the documentation, that I should register the function in the server repository.

Any idea what's wrong in my implementation?

kind regards

Christian

Answers (0)