dllopenedgeprogress-4gl

calling a dll using Progress 4gl


I am needing to use a dll to obtain data from a webservice. I was given sample code from our VB.net group on how they make the call. I need direction in how to do the exact same thing within Progress.

Here is the VB sample:

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

    Dim client as new TaxWiseProxy(serviceURI:"https://webservice.net/Basic.svc", username:"myusername", password:"aPassword")
    Dim getTitleResponse as String = String.Empty
    
    Try
    
        getTitleResponse = client.GetTitle("12-34567")
    
    Catch ex as Exception
    
        'Exception Handling
        
    End Try
    
End Sub

I have reviewed many posts all with different approaches but not enough detail for me to really follow. We have also used the assembly reference tool and saved the reference within our working directory.


Solution

  • Assuming it's a .NET Assembly. You need to add it to your assemblies.xml file, see here:

    https://docs.progress.com/de-DE/bundle/openedge-abl-manage-applications-122/page/NET-assemblies.html

    https://docs.progress.com/de-DE/bundle/openedge-gui-for-dotnet-in-abl/page/Identify-.NET-assemblies-to-ABL.html

    This is a sample assemblies.xml file, either in your session working directory, or the folder referenced by the optional -assemblies startup parameter:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <references>
        <assembly name="Accessibility, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
        <assembly name="CefSharp, Version=127.3.50.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138"/>
        <assembly name="CefSharp.Core, Version=127.3.50.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138"/>
        <assembly name="CefSharp.WinForms, Version=127.3.50.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138"/>
        <assembly name="clrzmq, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"/>
    </references>
    

    Then your code would translate like this:

    USING <similar to import statement in VB.NET> .
    
    DEFINE VARIABLE client           AS TaxWiseProxy NO-UNDO.
    DEFINE VARIABLE getTitleResponse AS CHARACTER    NO-UNDO.
    
    /* Note, ABL only supports positional parameters, not named parameters */
    client = NEW TaxWiseProxy("https://webservice.net/Basic.svc", 
                              "myusername", "aPassword").
    
    getTitleResponse = client:GetTitle("12-34567").