Results 1 to 3 of 3

Thread: Building an API for a windows app.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2009
    Location
    Queens, NY, NY
    Posts
    7,429

    Default Building an API for a windows app.

    So I have a windows app that needs an API.

    I need to be able to have an external program call a DF method to

    Start()
    Stop()
    SetRecipe(tRecipeStruct)

    I need to Send back

    Resultset(String sData)
    Erroor(string sWhy)

    the external program is gonna be a VB.Net app running on the same hardware.

    Any pointers?

    MM
    Michael Mullan.
    Danes Bridge Enterprises.

    ++++++++++++++++++++++++++++
    There is just today. Tomorrow is a concept
    that is mostly theoretical. -- GM Wylie
    ++++++++++++++++++++++++++++

  2. #2
    Join Date
    Feb 2009
    Location
    Stuart, FL
    Posts
    5,321

    Default Re: Building an API for a windows app.

    the easiest from the standpoint of being supported by DF would be a webservice but it will require you to set up a web server and run a webservice using DF Webapp

    another simple option would be to launch an EXE passing command line data or data via file and back via export file or you can also use the console to send data back

    another option is to use IPC. Gets a bit more complicated but essentially you have your DF program sitting there waiting for commands via IPC and process them when they come in

    the nicest would be if we could create a dot net DLL that could be consumed by the VB.net app but i am not holding my breath
    Michael Salzlechner
    StarZen Technologies, Inc
    http.://www.starzen.com

    IT Director at Balloons Everywhere

    Development Blog
    http://www.salzlechner.com/dev

    DataFlex Package Manager (aka Nuget for DataFlex)
    http://windowsdeveloper.com/dfPackage

  3. #3
    Join Date
    Feb 2009
    Location
    Adelaide, South Australia
    Posts
    2,863

    Default Re: Building an API for a windows app.

    Simple; dataflex web service...
    Just use the wizards for a webapp (clean up later).
    And the wizard for a web service.
    Create a function ’myuppercase’ to start with and in the code explorer right click to make it published.
    Compile and run and you see a test page created.

    See the url is tempuri or something like that. In the properties panel of the web service set a better service name. Compile/ run and see the better url.

    From there I suggest you put all logic in a class package. Within the published function create the object, call it and destroy it.
    That way you do not have to worry about hanging properties.
    Also it makes it easier for unit testing if you decide to build that and / or a windows frontend for testing.

    But overall you’ll find it is much easier than you might expect.

    Cheers from OZ
    Marco
    Marco Kuipers
    DataFlex Consultant
    28 IT Pty Ltd - DataFlex Specialist Consultancy
    DataFlex Channel Partner for Australia and Pacific region
    Adelaide, South Australia
    www.28it.com.au

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •