Generate c# webservice based on .p file (for use in WCF)

Posted by Admin on 20-Oct-2008 04:26

Hi,

I have a question regarding a project where i am trying to make functionality from a .p file directly available(from appserver) as a webservice(WCF - Windows Communication Foundation).

I am aware of the ProxyGen that generates either proxy or webservices, but i do not want to use this tools since using a Proxy means updating dlls, in multiple projects every now and then and Webservice does not support dataset parameters. Anyway i want the integration to be based on WCF, and with as few components as possible.

My intention is tohave a solution where the OpenEdge-developer can select a .p-file, when file is selected the system automatically generates the c# classes representing the p. file functionality and makes it available as webservice.

To make this possible, i first have to get programmatically access to the p.file properties(i.e. parameter names, parameter types, procedure names with parameters, function names with parameters and so on). Proxy explorer does this when it creates both .Net proxy and webservice, but how does the proxy generator tool get this information about the p files? I asume proxygenerator uses a API of some kind, but i am not able to find out any information about this.

I am aware of the .Net open Client manual and the manual for Serviced and Integration, but theese manuals does not give me the proper insight to solve the the proplem mentioned.

Can anybody help?

Asle

All Replies

Posted by rstanciu on 20-Oct-2008 06:56

bproxygen is a script to start a java application.

Package: $DLC/java/progress.jar -> RCodeParser.class

When you generate the .net/java/web-services interface

you'll need to compile (.r).

ProxyGen use the r-code informations stocked into r-code file.

May be a jade RCodeParser.class give you more help

(http://www.kpdus.com/)

Posted by Admin on 21-Oct-2008 02:27

Checked out what you suggested, but it did not take me any closer..

I had a look at the Progress.o4glrt assembly, and found it contains many more namespaces than those documented in the manuals.

Does anyone know if any of thees classes contains the functionality to get metadata about .r-files?

Posted by rstanciu on 21-Oct-2008 03:55

If you take a look to the java class RCodeParser you can see a trace log,

bproxygen have a log file like this, you can use this log file to check out parameters.

The java class is looking for input parameters into the .r ->> see the attaced image ...

,,INPUT cBegins CHARACTER,OUTPUT cCustomersList CHARACTER EXTENT 100

    • ProxyGen, Version Progress 10.1C

    • Checking for existence of .r files ...

    • Processing non-persistent procedures ...

    • Processing: /opt/WSA/4GL/getCustomerName.r ...

-- Parsing r-code ...

MAIN /opt/WSA/4GL/getCustomerName.p

INPUT iCustomerNumber INTEGER

OUTPUT cCustomerName CHARACTER

-- Validating saved information against latest .r ...

Customizations applied

Defaults used for parameters

    • Processing: /opt/WSA/4GL/getInvoice.r ...

-- Parsing r-code ...

MAIN /opt/WSA/4GL/getInvoice.p

INPUT iInvoiceNum INTEGER

OUTPUT cInvoice CHARACTER

-- No customizations; Validation not necessary

Posted by Admin on 21-Oct-2008 04:33

Hi,

I found this section you mention in the .r-file:

My app will contain a lot of files, many with complex datasets as parameters:

for one of the r-files i found this:

MAIN
mm\mm\m\dl\x-get-cust.p

,

,

INPUT wLacNo INTEGER,

INPUT wLanguage CHARACTER,

OUTPUT DataSet-Lac DATASET TmpLac TmpLacCC TmpLacPhone TmpLacEmail TmpLacFqv TmpLacGDS

DATALINKS 5

RELATION1 0

TmpLac TmpLacCC 1 LacNo LacNo

RELATION2 0 TmpLac TmpLacPhone 1 LacNo LacNo

RELATION3 0 TmpLac TmpLacEmail 1 LacNo LacNo

RELATION4 0 TmpLac TmpLacFqv 1 LacNo LacNo

RELATION5 0 TmpLac TmpLacGDS 1 LacNo LacNo,

OUTPUT wError CHARACTER FUNCTION GetText,

CHARACTER,

INPUT wNo INTEGER,

INPUT wLangCode CHARACTER,

INPUT wDebug LOGICAL,

INPUT wUpdate LOGICAL,

INPUT wOpt CHARACTER FUNCTION GetTextUpdate,

CHARACTER,

INPUT wNo INTEGER,

INPUT wLangCode CHARACTER,

INPUT wDebug LOGICAL,

INPUT wUpdate LOGICAL,

INPUT wOpt CHARACTER FUNCTION GetCCTac,

CHARACTER,

BUFFER Lac cr_base.Lac,

BUFFER Tac cr_base.Tac,

INPUT wType CHARACTER FUNCTION GetFoidTac,CHARACTER,BUFFER Tac cr_base.Tac,

INPUT wFoidTypeList CHARACTER,

INPUT wOpt CHARACTER

TEMP-TABLE TmpLac 1,LacNo:Lac 0 NO,LacNo integer 0 0,Active logical 1 0,LacName character 2 0,LacNameSearch character 3 0,FirmCode character 4 0,RacNo integer 5 0,RacName character 6 0,EmpCode character 7 0,AddrBill1 character 8 0,AddrBill2 character 9 0,AddrBill3 character 10 0,AddrBillAttnTrav logical 11 0,AddrBillAttn character 12 0,AddrBillZipCode character 13 0,AddrBillZipName character 14 0,AddrMail1 character 15 0,AddrMail2 character 16 0,AddrMail3 character 17 0,AddrMailAttnTrav logical 18 0,AddrMailAttn character 19 0,AddrMailZipCode character 20 0,AddrMailZipName character 21 0,ContactName character 22 0,CustResp character 23 0,CustNo integer 24 0,AllowOnlineBooking logical 25 0,AllowOnlineTravel logical 26 0,AllowOnlineProfile logical 27 0,AllowPassword logical 28 0,CtrlTravCode logical 29 0,CtrlCustRef logical 30 0,CtrlDepCode logical 31 0,CtrlProCode logical 32 0,CtrlProSubCode logical 33 0,CtrlTravCodePrg character 34 0,CtrlCustRefPrg character 35 0,CtrlDepCodePrg character 36 0,CtrlProCodePrg character 37 0,CtrlProSubCodePrg character 38 0,CtrlTravCodeText character 39 0,CtrlCustRefText character 40 0,CtrlDepCodeText character 41 0,CtrlProCodeText character 42 0,CtrlProSubCodeText character 43 0,WingsTravCode character 44 0,WingsCustRef character 45 0,WingsDepCode character 46 0,WingsProCode character 47 0,WingsProSubCode character 48 0,CurrCode character 49 0,LangCode character 50 0,FP character 51 0,TacIDType character 52 0,PolicyCode character 53 0,ConfigCode character 54 0,CurrentTimeDB character 55 0

TEMP-TABLE TmpLacCC 1,LacNo,CCCompCode,CCNoEncode:TmpLacCC 0 NO,LacNo integer 0 0,CCCompCode character 1 0,CCNo character 2 0,CCNoEncode character 3 0,CCExpDate date 4 0,CCTravelAcc logical 5 0

TEMP-TABLE TmpLacPhone 1,LacNo,CommCode,CommValue:TmpLacPhone 0 NO,LacNo integer 0 0,CommCode character 1 0,CommValue character 2 0

TEMP-TABLE TmpLacEmail 1,LacNo,CommValue:TmpLacEmail 0 NO,LacNo integer 0 0,CommValue character 1 0,SendInfo logical 2 0,SendItin logical 3 0,

SendRec logical 4 0,

SendRecETicket logical 5 0

TEMP-TABLE TmpLacFqv 1,LacNo,FqvType,VendorCode,FqvCode:TmpLacFqv 0 NO,

LacNo integer 0 0,FqvType character 1 0,VendorCode character 2 0,FqvCode character 3 0

TEMP-TABLE TmpLacGDS 1,LacNo,LacIDCode:TmpLacGDS 0 NO,LacNo integer 0 0,LacIDCode character 1 0,LacIDName character 2 0,LacIDOfficeID character 3 0

I guess i can find a way to read this so i can make sense of it, but will it be bullet proof since this is an undocumented format? I guess the answer is no, and perhaps another solution if so exist is to prefer.

Posted by rstanciu on 21-Oct-2008 07:13

hmm ... complicated ... beter is to generate a web-service project using

ProxyGen , generate the *.wsdl description.

Document the web-service using:

bprowsdldoc project.wsdl

This thread is closed