Uniface User Forum

 View Only
  • 1.  Visual Studio 19 call-in project C#

    PARTNER
    Posted 01-06-2023 13:33
    Hi,

    I have a simple C# RESTAPI, I would like to call a uniface 9 service  from the C# and get a result status, message etc back in C#

    Is there a complete sample VS19 project available?

    Thanks

    Rob

    ------------------------------
    robert Cooper
    Sanderson Multi-channel Solutions Ltd
    ------------------------------


  • 2.  RE: Visual Studio 19 call-in project C#

    PARTNER
    Posted 01-20-2023 03:08

    Hi

    I have no example for you, however I want to comment on this as I often thought about these things being a bit younger :-).
    Nowadays I just try to avoid to think about Call-in to Uniface.
    I suppose that your question is;
    How to call-in to Uniface from C# and is there a VS19 project available to describe this?

    Somehow I think that you are after an example using the Uniface Call-In API.
    If you want to build a lot of Call-ins to Uniface, have you thought about "Uniface web-services call-in" or "making a restful web-service in Uniface" 
    and call those?

    Quite a lot about this is found searching the web for  "uniface call-in"....



    ------------------------------
    Roger Wallin
    Abilita Oy
    ------------------------------



  • 3.  RE: Visual Studio 19 call-in project C#

    PARTNER
    Posted 05-15-2023 11:16

    Hi Roger,

    I did look at the call-in option and the setup is too much, TOMCAT etc, i have a light C# REST API VS solution, i just wanted to apply all the logic we already have in Uniface. Historically we did this directly from C++ with 3GL functions, I think COM would be the way to go.

    Thanks

    Rob



    ------------------------------
    robert Cooper
    Sanderson Multi-channel Solutions Ltd
    ------------------------------



  • 4.  RE: Visual Studio 19 call-in project C#

    PARTNER
    Posted 05-19-2023 03:59

    Hi,

    Ok, I then understand what kind of example you need. Sorry I don't have it.

    Below I put some info to remember the problem next time:

    Call-In Using the Call-In API
    The following is the typical sequence of statements to call a specific operation in a Uniface component:
    #include <uactdef.h>
    uecreate(...); /* Initialize the Uniface environment*/
    ueopen(...); /* Get an environment handle*/
    uinstnew(...); /* Create an instance of a component*/
    uopract(...); /* Activate an operation in this component*/
    uinstdel(...); /* Delete the component instance*/
    uedelete(...); /* Close the Uniface environment*/

    Call-in from third-party applications other applications can call in to Uniface via APIs and connectors. Uniface supports call-in from C, .NET (via COM), Java, and Web services.

    For call in, the COM connector exposes Uniface services as complete COM objects. COM clients can start, call, and stop services, as required.

    Uniface can also call remote Uniface services through the COM connector. The COM connector enables you to export service signatures to a COM Interface DLL, which can then be installed where required using standard Windows functionality.


    Web-Services call-in
    You only need "Application Server" for Web Services callin.
    This is because "Web Services" are implemented as published operations of Services.
    USP pages are not used at all (html/xml presentation only).
    The request for a Web Service is handled by the SRD (Soap request
    dispatcher), rather than the WRD (Web Request dispatcher)
    So, you should only need USRVSVC feature to publish a Web Service.


    Rest based architecture uses Server pages and need Web Application Server.



    ------------------------------
    Roger Wallin
    Abilita Oy
    ------------------------------



  • 5.  RE: Visual Studio 19 call-in project C#

    PARTNER
    Posted 05-22-2023 06:16

    Call-In Using the Call-In API
    The following is the typical sequence of statements to call a specific operation in a Uniface component:
    #include <uactdef.h>
    uecreate(...); /* Initialize the Uniface environment*/
    ueopen(...); /* Get an environment handle*/
    uinstnew(...); /* Create an instance of a component*/
    uopract(...); /* Activate an operation in this component*/
    uinstdel(...); /* Delete the component instance*/
    uedelete(...); /* Close the Uniface environment*/

    It should be possible to use this  from C# by  "Platform Invoke".

    using System;
    using System.Runtime.InteropServices;
    
    public class Program
    {
        // Import user32.dll (containing the function we need) and define
        // the method corresponding to the native function.
        [DllImport("user32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
        private static extern int MessageBox(IntPtr hWnd, string lpText, string lpCaption, uint uType);
    
        public static void Main(string[] args)
        {
            // Invoke the function as a regular managed method.
            MessageBox(IntPtr.Zero, "Command-line message box", "Attention!", 0);
        }
    }


    ------------------------------
    Roger Wallin
    Abilita Oy
    ------------------------------