Entering content frame

Procedure documentation Calling Portal Services via RFC Locate the document in its SAP Library structure

Procedure

...

       1.      Portal services that have to be called via RFC must implement the interface com.sapportals.portal.prt.service.rfc.IPRTRFCListener:

public class TestRFCEngineService implements Iservice, IPRTRFCListener

       2.      The portal service should then register in its afterInit() method the RFC it requires using the following function of the RFC Engine Service:

Example

setFunctionCallListener(

   String nameOfFunction,

   String nameOfService) IRFCEngineService service =

   (IRFCEngineService) mm_serviceContext.getService(IRFCEngineService.KEY);

 

service.setFunctionCallListener(

   "MY_R3_FUNCTION",

   "My Service or application name");

       3.      The portal application has to reference the RFC Engine Service:

Example

<application alias="TestRFC">

    <application-config>

       <property name="ServicesReference" value="RFCEngine"/>

       <property name="releasable" value="true"/>

    </application-config>

       4.      Finally, the portal service must implement the function handleRequest to receive calls from an SAP R/3 System:

Example

public JCO.Function handleRequest(JCO.Function function, IUserContext userCtx)

   throws Throwable {

   try {

      JCO.ParameterList input = function.getImportParameterList();

      JCO.ParameterList output = function.getExportParameterList();

      JCO.ParameterList tables = function.getTableParameterList();

 

      if (function.getName().equals("STFC_CONNECTION")) {

         output.setValue(input.getString("REQUTEXT"), "ECHOTEXT");

         output.setValue(

            "This is a response from the TestRFCService side!",

            " RESPTEXT ");

      }

      return function;

   }

 

 

Leaving content frame