Proxy generator compilation error cs0116

mhtan88

Member
Hi all,

I have a problem using Proxy Generator base .Net 2.0 SDK with .Net Framework v2.0.50727 to generate the DLL file. Is there anyone facing the same problem like me?

It prompt me the error as below:
Spec:
OpenEdge10.0B03


Error as below:
StrongTypesNS\custordlin.cs(1,1): error CS0116: A namespace does not directly contain members such as fields or methods

According to MSDN, The error is due to the:
/*====================================================*/
// CS0116.cs
namespace x
{
using System;

// method must be in class/struct
void Method(string str) // CS0116
{
Console.WriteLine(str);
}
// To fix the error, you must
// enclose a method in a class:
class Program
{
void Method2(string str)
{
Console.WriteLine(str);
}
}
}
/*====================================================*/

My 4GL Procedure Example:
/*====================================================*/

DEFINE TEMP-TABLE ttcust
FIELD custnum AS INTEGER
FIELD bfname AS CHARACTER.


DEFINE TEMP-TABLE ttorder
FIELD ordernum AS CHARACTER
FIELD custnum AS INTEGER.

DEFINE TEMP-TABLE ttordlin
FIELD ordernum AS CHARACTER
FIELD bforderline AS INTEGER
FIELD bforderitem AS CHARACTER.

DEFINE DATASET custordlin FOR ttcust, ttorder, ttordlin
DATA-RELATION custord FOR ttcust, ttorder RELATION-FIELDS (custnum,custnum)
DATA-RELATION OrdOrdLine FOR ttorder, ttordlin RELATION-FIELDS(ordernum,ordernum).

DEFINE INPUT PARAMETER NumCusts AS INTEGER.
DEFINE OUTPUT PARAMETER DATASET FOR custordlin.
DEFINE OUTPUT PARAMETER sError AS CHAR FORMAT "x(30)".

/* */
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DEFINE VARIABLE i1 AS INTEGER NO-UNDO.
DEFINE VARIABLE i2 AS INTEGER NO-UNDO.
DO i = 1 TO 100:
CREATE ttcust.
ttcust.custnum = i.
ttcust.bfname = "customer " + STRING(i).
DO i1 = 1 TO 30:
CREATE ttorder.
ttorder.ordernum = STRING(i,"9999") + STRING(i1,"999").
ttorder.custnum = i.
DO i2 = 1 TO 50:
CREATE ttordlin.
ttordlin.ordernum = ttorder.ordernum.
ttordlin.bforderline = i2.
ttordlin.bforderitem = "item " + STRING(i2).
END.

END.
END.


/*====================================================*/
 

mhtan88

Member
hi rstanciu,

This code I did tried b4 last time. it was successful compiled and list out all the data i wrote into the temp-table in asp.net. but, this is about 3 years ago. i have no idea same piece of code but i can't compile now. is it due to the .net problem?
I have VS2008 with me as well.

Thank you.

Regards,
TanMH
 

rstanciu

Member
Strange ... the support of DATASETS becomes in OE 10.1A .... :) I don't know how to can compile this with 10.0B.
Anyway, this error is from .Net framework, Progress install the .Net 1.1 if you are update you
workstation to .Net 2 ... the proxygen fails.

Check you Progress version. OE 10.2A support .Net 3 !!

Here is the KBase entry:

Symptoms:
Error CS0246 when generating .Net proxies from ProxyGen
error CS0246: The type or namespace name '<Name>' could not be found (are you missing a using directive or an assembly reference?)
Procedures contain OUTPUT Temp-Tables
Procedures contain INPUT-OUTPUT Temp-Tables
ProxyGen is incorrectly finding the C# compiler from the Microsoft Visual Studio 2005 beta software (i.e. the .Net Framework Version 2.0)
Microsoft Visual Studio 2005
Using .NET 2.0


Facts:
OpenEdge 10.0x



Cause:
Bug# OE00110400


Fixes:
Upgrade to 10.1A or later.

If upgrading is not an option, in ProxyGen, modify the generate options and enter the fully qualified path to both the csc and xsd executables for the 1.1 version of the .Net Framework
 

mhtan88

Member
hi rstanciu,

Thank you for your information. I 'll try to get one pc without .net 2 to try out. thanks again.
Thank you.

Regards,
TanMH
 

GregTomkins

Active Member
Hands up if you think ProxyGen and its output is a nightmare. I mean, it's awesome that it works as well as it does, and I love how easily (usually) you can interface Java and .NET with AppServers, but dontcha just love those totally mysterious error messages like 'ClassFactory cannot supply requested class' or 'ActiveX, unable to create object'? How about the zillion-step install procedure? (OK, I am going back to v9 here, but that's reality for a lot of us).
 

rstanciu

Member
agree, and not agree ... in the place of use Java/.Net OpenClient you can expose 4GL procedures
over "web-services". This is standard/vogue/and it work's. Forget API documentation and
perl/ruby/php/java-axis/python ... can play with 4GL back-end applications.
 

GregTomkins

Active Member
Yeah but you are trading ProxyGen pain for getting WS to work pain... never mind the performance of WS's.

I am also kinda keen on the thing in v10c (IIRC) where you can access AppServers without using a proxy at all. As I read the doc, unless you are using WS, you still need the open client runtime, but you can avoid the custom generated proxies. You have to do more work in the client, but it would be worth it in some cases.
 

rstanciu

Member
Yes accesing direct is possible, in attachement, just:

javac -classpath .:$DLC/java/o4glrt.jar sampleClient.java;
java -classpath .:$DLC/java/o4glrt.jar sampleClient;

and of course is faster ...

but te faster way is to create a SERVER SOCKET in 4GL like:
[OpenEdge-samples]/sockets/WebServer/

in this case is a not scalable/administrable solution.

Speaking about WS performances, is not bad, with progress of network and
hardware we can handle 200-500 calls by second (simple :) getCustomerName input cust num) ... which is quite good, in my opinion.

But the gooal of use of web-services is not the performance, the goal is that
any application can have access ....
in other POST i'll we give you an example using Google ANDROID
T-mobile to display the customer name .
 

Attachments

  • Capture-IPhoneAndroidKsoap2OE.jpg
    Capture-IPhoneAndroidKsoap2OE.jpg
    69.8 KB · Views: 23

rstanciu

Member
ok .. and this is the java example for java DirectConnect AppServer,
sorry I don' have the .Net version because I hate Microsoft,
I'm a mature linux-man ... from 2001 ;p

import com.progress.open4gl.javaproxy.*;
import com.progress.open4gl.Parameter;

public class sampleClient {
private static final java.lang.String tName = new String( "KM_client" );
public static void nonPersistentProcedure() {
try {
// Connect to the AppServer
/*
Connection syntax is:
via NameServer:
[[AppServer:][//name-server-host][:name-server-port]/[service-name]]
DirectConnect:
[[AppServerDC:][//AppServer-host][:AppServer-port]
*/
//String appServerURL = "AppServer://rs:5163/asws";
String appServerURL = "AppServerDC://rs:3091";
Connection myConn = new Connection(appServerURL,"","","");
//change the operating mode to session free
myConn.setSessionModel(1);
OpenAppObject dynAO = new OpenAppObject(myConn, "asws");
// Create the parameters
Integer iCustNum = new Integer(9);
String cCustomerName;
// Create a place for RETURN-VALUE
String retVal;
// Create the ParamArray
ParamArray parms = new ParamArray(2);
// Set up input parameters
parms.addInteger(0, iCustNum, ParamArrayMode.INPUT);
// Set up Out parameters - notice the value is null
parms.addCharacter(1, null, ParamArrayMode.OUTPUT);
// Run the procedure
dynAO.runProc("getCustomerName.p", parms);
// Get output parameters - Returned as Object, so must cast
cCustomerName = (String) parms.getOutputParameter(1);
// Get RETURN-VALUE - Will return null for getCustomerName() procedure
retVal = (String)(parms.getProcReturnString());
dynAO._release();
System.out.println("Customer Name = " + cCustomerName);
System.out.println("RETURN VALUE = " + retVal);
} // try to catch all unexpected exceptions
catch ( Exception e ) {
System.out.println("Exception in sample()");
System.out.println("Exception Message: " + e.getMessage());
e.printStackTrace();
}
} //nonPersistentProcedure

public static void main(String[] args) {

sampleClient a = new sampleClient();
a.nonPersistentProcedure();

} //main

} // class
 

GregTomkins

Active Member
Is my understanding correct, that you can use WS with nothing from Progress (no o4glrt.zip, no progress.jar, etc. etc.) installed on the client?
 

rstanciu

Member
If you take a look to the ANDROID picture, I use a T-mobile phone with Google ANDROID
as Operating system, the package ksoap2 ... end that is ... getCustomerName !
 

mhtan88

Member
hi rstanciu,

you are rigth. if i upgrade my .net framework more than or equal to version 2.0
it will give me the error. Is there any sample coding in procedure file and .net file regarding how does the .net update data back to procedure 4GL with value changed validation?

Thank you.

TanMH
 

rstanciu

Member
this is not complicated.
To the Progress side you create a 4GL procedure like:

DEFINE INPUT PARAMETER iCustomerCustNum AS INTEGER NO-UNDO.
DEFINE INPUT PARAMETER iCustomerName AS CHARACTER NO-UNDO.
DEFINE OUTPUT PARAMETER llOK AS LOGICAL NO-UNDO.


FIND FIRST Customer WHERE Customer.CustNum = iCustomerCustNum NO-ERROR.
IF AVAILABLE Customer THEN DO:
ASSIGN Customer.Name = iCustomerName NO-ERROR.
IF ERROR-STATUS:ERROR THEN llOK = FALSE .
ELSE llOK = TRUE.
END.
RETURN "OK".

... compile the procedure, deploy, ProxyGen ... and execute this on .Net :)
 

mhtan88

Member
Thx rstanciu,

But, I facing another problem. I have trying few method but some how, in temp-table have the value (4GL return 49 records in temp-table). But, dataset return in .net returned as 0 records. May I know which part i have did something wrong?

below is my script:
======================== 4GL===========================

DEFINE TEMP-TABLE ttbank LIKE BankTable .
DEFINE QUERY qBank FOR BankTable .
DEFINE DATASET Dsbank FOR ttbank .
DEFINE OUTPUT PARAMETER DATASET FOR Dsbank.
QUERY qBank:QUERY-PREPARE("for each BankTable ").
DEFINE DATA-SOURCE srcbank FOR BankTable .

BUFFER ttbank:HANDLE:ATTACH-DATA-SOURCE(DATA-SOURCE srcBank:HANDLE).
DATASET Dsbank:FILL().

BUFFER ttacp_bank:DETACH-DATA-SOURCE().
======================End of 4GL=========================

====================.Net ================================
Progress.Open4GL.Proxy.Connection m_conn;
TEST.ModuleBANK m_bank ;

string txtURL = "AppServer://testingserver:5162/astest";
m_conn = new Progress.Open4GL.Proxy.Connection(txtURL, "", "", "");
m_bank = new TEST.ModuleBANK(m_conn) ;
TEST.StrongTypesNS.DsbankDataSet ds = null;
pc_msg = "";
m_bank.bank_net(out ds);
DataTable dt = ds.Tables[0];
DataView dataView = new DataView();

GridView1.DataSource = dataView;
GridView1.DataBind();
m_bank.Dispose();

============= End of .Net ==============================
 

mhtan88

Member
ops .... i found the error.

DataTable dt = ds.Tables[0];
DataView dataView = new DataView();

should change to

DataTable dt = ds.Tables[0];
DataView dataView = new DataView(dt);


:lol:
 
Top