Kbase P104771: How do you pass a memptr to the AppServer from a Java Open Client?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/02/2009 |
|
Status: Verified
GOAL:
How do you pass a memptr to the AppServer from a Java Open Client?
FACT(s) (Environment):
OpenEdge 10.x
All Supported Operating Systems
OpenEdge 10.x
FIX:
The following sample code shows how to pass data to a 4GL program which uses a MEMPTR as an input parameter.
The 4GL code that will run on the AppServer is as follows:
/* Program Name: passPointerToAppServer.p */
DEFINE INPUT PARAMETER pMemoryPointer AS MEMPTR NO-UNDO.
DEFINE VARIABLE vLoop AS INTEGER NO-UNDO.
DEFINE VARIABLE vSize AS INTEGER NO-UNDO.
ASSIGN vSize = GET-SIZE(pMemoryPointer).
/* Dump Contents of MEMPTR to the AppServer Log File Byte by Byte */
DO vLoop = 1 TO vSize:
MESSAGE GET-STRING(pMemoryPointer,vLoop,1).
END.
The Java code is as follows:
import com.progress.open4gl.*;
import com.techsupp.*;
public class MemoryPointerSample
{
public static void main(String[] args) throws Exception
{
PointerProxy appServer = new PointerProxy("AppServer://localhost:5261/StateLess", "", "", "");
String testString = "The Moon is Made of Lots of Green Cheese";
Memptr pointerHolder = new Memptr(testString.getBytes());
appServer.passPointerToAppServer(pointerHolder);
appServer._release();
}
}