gpt4 book ai didi

java - 在Java环境中调用Genexus过程 stub

转载 作者:行者123 更新时间:2023-11-30 06:27:31 25 4
gpt4 key购买 nike

我目前正在尝试在 Genexus 15 中创建一个过程并从 Java 环境调用,但是当我将 jar 文件导入到 Java 时,无法调用该函数。

我正在创建一个带有 stub 的简单过程,如下所示:

stub salvadados(in:&StringTeste, out:&StringRetorno)
&StringRetorno = "ola " + &StringTeste
endstub

Genexus 在部署应用程序时生成 .jar 文件,然后我将其导入到 NetBeans 上。导入成功并且它识别了我创建的过程,但是当我访问它的方法时,没有调用我的 stub 。

我的Java类如下。我想在 EnviaDados 函数中调用我的 stub 。

import com.genexus.GXProcedure;
import com.genexus.GXutil;
import com.genexus.ModelContext;
import com.genexus.reports.GXcfg;
import com.kbtesteintegracao.projeto.ptesteintegracao;

public class IntegracaoGenexus extends GXProcedure {

ptesteintegracao ptesteintegracao;


public void executeCmdLine(String args[]) {
execute();
}

public IntegracaoGenexus(int remoteHandle) {
super(remoteHandle, new ModelContext(IntegracaoGenexus.class), "");
}

public IntegracaoGenexus(int remoteHandle, ModelContext context) {
super(remoteHandle, context, "");
}

public void iniciar() {
ptesteintegracao = new ptesteintegracao(remoteHandle, context);

}

public void EnviaDados(String strDados) {
//ptesteintegracao.gxep_salvadados(strDados);
}

public void execute() {
execute_int();
}

private void execute_int() {
initialize();
privateExecute();
}

private void privateExecute() {
new ptesteintegracao(remoteHandle, context).gxep_salvadados("teste");
cleanup();
}

public static Object refClasses() {
GXutil.refClasses(IntegracaoGenexus.class);
return new GXcfg();
}

protected void cleanup() {
CloseOpenCursors();
exitApplication();
}

protected void CloseOpenCursors() {
}

/* Aggregate/select formulas */
public void initialize() {
/* GeneXus formulas. */
Gx_err = (short)(0) ;
}

private short Gx_err ;

}

我缺少什么?我感谢任何帮助。

最佳答案

我已经找到解决办法了。我所做的是在我的 Genexus 项目上创建一个测试 Web 面板,并调用我创建的过程。在此 WPanel 中,我只是放置了一个触发以下事件的 Button 组件:

Event 'Teste'
ptesteintegracao.salvadados("oi", &retorno)
Endevent

我不知道为什么,但是通过对我的过程进行此调用,它以某种方式迫使 Genexus 重新创建我的过程的 .java 文件,而它在构建、重建或仅使用此构建时没有这样做选项。重新创建时,我的 java 类具有与我的过程 stub 相对应的函数。

之后,我刚刚部署了该应用程序,生成了一个新的 .jar 文件并将其导入到我的 NetBeans 项目中,我的功能就可用了:

ptesteintegracao.gxep_salvadados("teste", stringReturn);

关于java - 在Java环境中调用Genexus过程 stub ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46847286/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com