Code: Alles auswählen.
srv[0] = new Server("IP","3302","JAVARFC",repository);
...
protected void handleRequest(JCO.Function function)
{
JCO.ParameterList input = function.getImportParameterList();
JCO.ParameterList output = function.getExportParameterList();
JCO.ParameterList tables = function.getTableParameterList();
System.out.println("handleRequest(" + function.getName() + ")");
if (function.getName().equals("FUNCTION_SM")) {
writeFile("Hallo Test" + cal.getTime());
}
...
}
Code: Alles auswählen.
*" EXPORTING
*" VALUE(E_TEXT) TYPE STRING
*" VALUE(E_FUNCTION) TYPE STRING
*" EXCEPTIONS
*" SYSTEM_FAILURE
*"----------------------------------------------------------------------
DATA: wert TYPE string VALUE 'WERT'.
MOVE wert TO e_text.
MOVE i_function TO e_function.
ENDFUNCTION.
Code: Alles auswählen.
REPORT zsm_0001 MESSAGE-ID at.
text_ausgabe = ''.
function_ausgabe = ''.
function = 'FUNCTION_SM'.
text = 'Daten gefunden'
CALL FUNCTION 'ZSM_JAVARFC' DESTINATION 'JAVARFC'
EXPORTING
i_text = text
i_function = function
IMPORTING
e_text = text_ausgabe
e_function = function_ausgabe
EXCEPTIONS
system_failure = 1
OTHERS = 2.
IF sy-subrc <> 0.
WRITE: 'Fehler beim Funktionsaufruf'.
ENDIF.
Code: Alles auswählen.
CALL FUNCTION 'FUNCTION_SM'
DESTINATION 'JAVARFC'
EXCEPTIONS
communication_failure = 1 MESSAGE mess
system_failure = 2 MESSAGE mess
OTHERS = 3.
Code: Alles auswählen.
JCO.Server could not find server function 'FUNCTION_SM'
Code: Alles auswählen.
if (function.getName().equals("FUNCTION_SM")) {
writeFile("Hallo Test" + cal.getTime());
}
Code: Alles auswählen.
JCO.Server(java.lang.String gwhost, java.lang.String gwserv, java.lang.String progid, IRepository repository)
Code: Alles auswählen.
protected JCO.Function getFunction(String function_name)
{
JCO.Function function = super.getFunction(function_name);
System.out.println("getFunction: " + function );
return function;
}
Code: Alles auswählen.
protected JCO.Function getFunction(String function_name)
{
JCO.Function function = super.getFunction(function_name);
System.out.println("getFunction: " + function );
return function;
}
Code: Alles auswählen.
repository = new Repository("TestRepository");
// non-unicode definition of functions. The server with this repository can
// dispatch calls only from non-unicode systems
//------------------------------------------------------------------------------
// Add function 'STFC_CONNECTION'
//------------------------------------------------------------------------------
JCO.MetaData fmeta = new JCO.MetaData("STFC_CONNECTION");
fmeta.addInfo("REQUTEXT", JCO.TYPE_CHAR, 255, 0, 0, JCO.IMPORT_PARAMETER, null);
fmeta.addInfo("ECHOTEXT", JCO.TYPE_CHAR, 255, 0, 0, JCO.EXPORT_PARAMETER, null);
fmeta.addInfo("RESPTEXT", JCO.TYPE_CHAR, 255, 0, 0, JCO.EXPORT_PARAMETER, null);
repository.addFunctionInterfaceToCache(fmeta);