pbni问题,有哪位大侠研究过?

li_d_s 2004-12-30 05:31:03
最近要用pb去调别人java写的接口,在sybase网站上下了个pb2java的东西看了看,怎么调用是知道了,但是我如何从java的class文件产生一个代理对象呢?对象的注释是“Proxy generated for Java class”。我照葫芦画瓢搞了一个导进去不对,哪位大侠做过的话,可否指点一二?或者有例子及文档发给我也行,谢谢,我的邮件:lidsh@bizsmooth.com msn:ghostmickey@hotmail.com!
...全文
238 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
li_d_s 2005-01-06
  • 打赏
  • 举报
回复
sybase网站上的那个例子我看过,调用是可以的,但是他的java类写的非常简单,默认构建器无参数,调用的函数参数类型也非常简单(只有一个double型),我这边要用到各种类型的参数(String,int,...),而且构建器有参数,所以不知道应该怎么写那个*.srx。唉,痛苦的事情,实在不行就只有自己把java类包装一下了。
li_d_s 2005-01-06
  • 打赏
  • 举报
回复
沉的还真快
hchi0118 2005-01-02
  • 打赏
  • 举报
回复
up
tw829 2005-01-02
  • 打赏
  • 举报
回复
这里http://www.sybase.com/pb9_samples#pb2java有个关于PB2Java的例子,不知道是不是楼主要的!
pb与java不熟,搞的不多,此问题还待研究ing...........!
tw829 2005-01-02
  • 打赏
  • 举报
回复
PB2Java

Description
The following PowerBuilder® 9 sample demonstrates a PBNI marshaler extension that allows you to call Java from PowerScript.
This extension declares a native class, JavaVM, which has two functions, createJavaVM and createJavaObject.
The CJavaVM class implements the JavaVM native class.
The CreateJavaVm function of CJavaVM gets the classpath and properties from the PBCallInfo structure, and loads the JVM by calling the loadJavaVM function of the JavaVMWrapper class. The JavaVMWrapper class is a singleton class, encapsulating the JavaVM interface provided by JNI.
The CreateJavaObject function creates an instance of a Java class based on the given class name, creates a PowerBuilder proxy object for the Java object, creates a JavaMarshaler object, and associates the marshaler object with the proxy object.
The JavaMarshaler class implements the IPBX_Marshaler interface, which is responsible for translating a PowerBuilder function call into a Java function call and returning the result from Java to PowerBuilder.
A JMethod object represents a Java method, which is responsible for translating PowerBuilder data types into Java data types, and invoking the Java function specified by method name and method signature.
A JValue object represents a parameter or a return value passed to or from a Java function.

Features
· PBNI – marshaler extension
Setting up Your Environment
· PowerBuilder 9 GA
· Visual C++ 6.0 (only if the extension workspace needs to be opened)
Detailed Steps
· Unzip into a folder, for example c:\pb2java.
· Open the workspace calljava.pbw in the \test directory with PowerBuilder 9 and add the marshaler extension pbjava.pbd to the library path.
· Run the application using the running man.
· Click on the button labeled "call Java Converter." You will see a message box showing the result of the function call.
· Tips: If you encounter error messages such as: “Error calling method of PBNI object” please check your PATH and CLASSPATH environment variables. PATH should include jdk\jre\bin\classic (where the jvm.dll is located) and jdk\jre\bin. The CLASSPATH environment variable should include jdk\jre\lib.

For example when using JDK 122 in c:\program files\Sybase\shared\sun\jdk122:

PATH: c:\program files\Sybase\shared\sun\jdk122\jre\bin\classic;c:\program files\Sybase\
shared\sun\jdk122\jre\bin
CLASSPATH: c:\program files\Sybase\shared\sun\jdk122\jre\lib

Optional:
· Open the Visual C++ 6.0 workspace pb2java.dsw, and look at the different .cpp files included in the workspace to see how the extension is implemented.

For more information
The best source for information is the PowerBuilder Native Interface Programmer’s Guide and Reference. Chapter 3, “Creating Marshaler Extensions,” has some more information about this sample.

Also look for another sample called java2pb that enables you to call PowerScript from Java.
zhangdatou 2005-01-01
  • 打赏
  • 举报
回复
晕!!~~搞不明白
nsqsmile 2005-01-01
  • 打赏
  • 举报
回复
顶一下
hygougou 2005-01-01
  • 打赏
  • 举报
回复
没做过类似接口,顶吧
amekoxiao 2004-12-31
  • 打赏
  • 举报
回复
我试验过c++的没有弄过java
有时间的话,我也研究研究,共同进步
balloonman2002 2004-12-31
  • 打赏
  • 举报
回复
我只能友情UP,:)
li_d_s 2004-12-31
  • 打赏
  • 举报
回复
人呢?帮我看看啊
sywen 2004-12-31
  • 打赏
  • 举报
回复
楼主点子高啊,顶!!!
WorldMobile 2004-12-31
  • 打赏
  • 举报
回复
呵呵,还真没弄过

帮你顶吧
li_d_s 2004-12-31
  • 打赏
  • 举报
回复
我现在写个简单的函数和类是可以了,可是如果class有带参数的构建器这个搞不定,构建器的参数不知道怎么传,也不知道怎么声明,pb的官方文档上使用的class是无参数构建器的,例子都没一个

1,075

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧