NetTalk Central

Author Topic: Web service question  (Read 2569 times)

jking

  • Sr. Member
  • ****
  • Posts: 392
    • View Profile
    • Email
Web service question
« on: June 21, 2018, 09:45:44 AM »
Bruce,

     I have a NT 10.24 app that stores pathology data, call it App A.  Many users currently use this app to enter various data items.  It has numerous tps files, including a file called Pathology.tps.    I want to allow an outside pathology lab to automatically send data to this file, doing inserts and updates but no deletes.  I built a second app, call it App B, using the NT wizard, and only had it include the web services procedures.  See the attached image.  App B uses the same dct file as App A.  Both apps are compiled as a dll and managed with the Multi-Site app (host.exe).  Both apps run as expected.

     The Pathology.tps file is in the App A folder but not in the App B folder.  How do I direct the web services App B to do the inserts and updates on the Pathology.tps file in the App A folder?  Is it as easy as setting a path in an embed of the App B code?  If so, which embed is the best for this?

     I also want to require some sort of authentication before allowing data inserts and updates.  In the login procedure, ServiceMethod embed, I see the following code:

  IF p_web.GetSessionLoggedIn() = 0
    p_web.Authenticate(user,password)
  END
  token = p_web.SessionID
  status = p_web.GetSessionLoggedIn()

If I understand things correctly, the user and password variables will need to be sent as parameters, and checked against my own user.tps file.  I store the password as a hash in this file, so I'll need to code for this of course, but have I understood this correctly?

Thanks,

Jeff


jking

  • Sr. Member
  • ****
  • Posts: 392
    • View Profile
    • Email
Re: Web service question
« Reply #1 on: June 21, 2018, 10:14:47 AM »
     It just occurred to me, why not add the web service (App B) to my main App A, since it is a true server app, that is on all the time.  The target file, Pathology.tps, is already available to this app.  The outside path lab should be able to access the web service procedures to do the necessary insert and updates.  Is this the way to go?  If so, I just now need to add some authentication.  I'm looking at the Clarion Live webinars 300, 302 and 304 to get further direction on all this.

Thanks,

Jeff

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11158
    • View Profile
Re: Web service question
« Reply #2 on: June 22, 2018, 06:21:20 AM »
Hi Jeff,

>> It just occurred to me, why not add the web service (App B) to my main App A, since it is a true server app, that is on all the time.

yep, that's the way I'd do it. No need for them to be separate.

But to answer your question, you'd do it using a Full Pathname variable in the dict, setting the var to the appropriate place for app A and App B. Or indeed just run both DLL's from the same folder. Or (lastly) I think in the Multi-Host interface you can set the data folder for each DLL - this populates the DataFolder (?) property, which in turn you can then use to populate the Full Pathname variable.

But smooshing A and B into the same app makes the most sense.

>> If I understand things correctly, the user and password variables will need to be sent as parameters, and checked against my own user.tps file.

yes, which you can do (should do) in the WebHandler procedure, Authenticate method.

Cheers
Bruce