locked
How web service can use, Client side application functionality RRS feed

  • Question

  • User133728449 posted

    Dear Expert(s),

    we have an application which perform Leasing Early termination business as its a huge application, we have a requirement customer wants to get ET Quote of a contract, they will call our web serice (Asp.Net) exposed method by sending contract Number as parameter and we will generate ET quote and send  those and some additional information back to consumer.

    Our application is is in Power Builder and have this functionality, New web service will interact with existing application as  ET logic is wriitern behind just one button clicked and quote is generated.

    would you please share your expert oponion in this regard, is it possible if yes how ? otherwise i have to re-write ET quote function which needs almost 2 months effort.

    Awaitig for your kind response.

    Regards,

    Thanks

    Monday, November 11, 2013 4:18 AM

Answers

All replies

  • User133728449 posted

    Yes you can but it has some limitations. You have 2 options:

    • Migrate to latest powerbuilder : there is default .NET support present
    • Wrap your business logic in a Powerbuilder DLL (the one called from the button click). You can integrate this DLL as you can integrate other native/legacy DLL's in .NET (C#). Beware: data exchange is limited to some basic types : int, String, byte[], ...  Also, you should beware of memory leaks that can destabilize the whole application.

    The 2nd scenario has some limitations. In the current situation you have fat client code. If you wrap this in a DLL and integrate this in a .NET webservice, this means the powerbuilder code can be invoked multiple times in parallel on the same machine. You should test this very thouroughly. If the underlying code contains blocking constraints to this concurrency model, this integration will fail.

    By the way : do not hesistate to post new questions under new forum topics. This keeps things a little more structured, and will avod people not responding because of previous reviews on your initial question.

    Regards,

    Illeris

    Monday, November 11, 2013 4:19 AM
  • User1519735232 posted

    So you have solved your problem

    Tuesday, November 12, 2013 2:56 AM
  • User-488622176 posted

    This is strange : I posted the reponse, and now it is marked as an answer by the person that posted the question. ...

    Tuesday, November 12, 2013 8:05 AM
  • User133728449 posted

    Hi Illeris,

    I just started new thread as you suggested and posted your response as it is. Secondly i did not solve my problem. Need advise

    Wednesday, November 13, 2013 2:52 AM
  • User-488622176 posted

    It is very hard to solve this without code. These are the steps to follow in order to open Powerbuilder code to C#:

    • Wrap everything you do after the button_click in powerbuilder in a simple function. 
    • Remove all UI related stuff from the function. Make it something linke "int myFunction(input param 1, input param 2, output param 1). All data collected from the form are to be considered as input parameters. Make the result the output parameter. The result (return value) is a number referring to the type of error that occured. Modify the powerbuilder code to fit this.
    • Create a powerbuilder DLL that exports the method you created
    • Use PInvoke in C# to call the DLL function. See http://msdn.microsoft.com/en-us/magazine/cc164123.aspx
    Thursday, November 14, 2013 3:59 AM
  • User133728449 posted
    .Net Class
    namespace dllPractice
    {
        class Program
        {
    
            [DllImport("assembly.dll")]
            public static extern int _puts();
          //  [DllImport("assembly.dll")]
          //  internal static extern int _flushall();
            static void Main(string[] args)
            {
                try
                {
                    int a = _puts();
              //      _flushall();
                }
                catch (DllNotFoundException d) {
                    Console.WriteLine(""+ d.Message + " stack "+d.StackTrace );
                }
                Console.Read();
            }
        }
    }
    

    Power Builder: I have assembly.dll which has a non_visulaobject with name n_assembly having function _puts() which just return an integer value but when i call from above .net code dllNOT found exception occured. Could you please help how will call/use this function in .net.

    I placed dll in same .net folder. also could you please what type this powerbuilder file will be when i try to load it as reference. i can see 5 tabs while adding reference .net, com, project, brows, recnet.

    Monday, November 25, 2013 6:10 AM
  • User-488622176 posted

    See:

    The dll is probably not found. You should put it in the same place as your .NET exe (or the bin folder of your web app), or include the path in the dllimport statement.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, November 26, 2013 10:41 AM