How to use a 3rd party Web Service from a Xojo Web App?

Now I have a desktop app that uses a 3rd party web service, it works fine with a call to SendSync URLConnection in a thread.

But now, I have to make a Web App that calls this same 3rd party web service but I’m afraid that calling it from the same Web app will be too much strain.

Is it better to use a desktop app as a helpper?

What would be the proper way to make the following process:

User press a button on the browser
WebApp shows a wait dialog
WebApp sends the request to the helper app
Helper app call the 3rd Party WebService and receives a response
Helper app sends response to WebApp
WebApp displays response to the corresponding Web user

Thanks for any advice

Hello Ivan,

I just noticed your question remains unanswered. I’m guessing you worked it out yourself but…

IMO you don’t require a companion app, the overhead is minimal.

Most of my Xojo projects are Web projects - that intermittently connect to a range a databases, web services and platform APIs to share and retrieve data. As I use Xojo Cloud (for hosting), I am in the practice of opening/closing firewall ports when not in use pedantically after each operation, so I assume I save on overhead without a discernible hit in transaction processing.

I have web apps that integrate to the users profile connecting web app functionality with the users preferred ‘email client’, ‘CRM’ and ‘Accounting Software’, calendar etc etc.

For example: user Tom logs in, when he starts a new quotation, I connect to his preferred CRM ’ CapsuleCRM’ retrieving a list of contacts/companies. Ivan chooses a contact for his new quote. Ivan prepares a quotation using functionality within the app, code retrieves and connects to his preferred email ‘gmail’, populates a standard email and attaches quote, sends email, changes several flags in CRM and creates deal in CRM, when quote is accepted updates Accounting Software ‘Reckon’ and sends invoice, inserts/updates a number of mysql tables for reporting purposes.

Using web services is what a web app is born to do. I hope that helps.

Kind regards, Andrew

Just by interest, are you doing this solely with Xojo out-of-the-box tools, or are you using plugins for it?

Hello Jeannot, thank you for asking.

I haven’t worked on this in a while but from memory…

Depending on the nature of the services with which you wish to connect, Xojo may be all you need (SOAP or HTTPSocket for instance), or you may need plugins.

Integrations aren’t fun and I certainly didn’t plan to do so many over time.

PHP has CURL, OAuth etc. I was familiar with PHP before I was familiar with Xojo and many common platforms have examples in PHP, so I usually start by writing a PHP script as a kind of unit test to discover / fine tune the integration, and to pick and choose data etc. These scripts come in handy later, rolled together as a unit test, to spot integration troubles when they appear from time to time. When developing functionality I remember temporarily passing params and get data from Xojo using HTTPSocket to fine tune the php scripts as a kind of WIP service.

I think in one instance I then created them into a service with PHP and another instance I may have used Monkey Bread Software’s CURL and PHP plugins directly from Xojo.

I am going to revisit it all again soon. There are plenty of changes to digest, and what was once done out of haste/necessity could likely be improved markedly next time around.

Kind regards, Andrew

[quote=488062:@Andrew Paul Dickey]IMO you don’t require a companion app, the overhead is minimal.

Most of my Xojo projects are Web projects - that intermittently connect to a range a databases, web services and platform APIs to share and retrieve data.[/quote]

Hi Andrew, thanks for your answer.

The real problem Im facing is licence. As xojo web has not changed a lot in YEARS and because iOS support is very limited, I didnt purchased a Xojo PRO in the last 2 years. The WepApi requires the use of URLConnection not available in the Xojo version with a WEB licence, that is why I think about the Web app with a Desktop app as helper.

But, if it is needed I can purchase the PRO again, Could you describe a little your implementation? What do you use? web threads with sync sockets, dynamic colection of sockets, etc.

Thanks

Hello Ivan,

I currently have a Xojo Web Licence (only) and a Xojo Cloud account.

I can only speak of my own experience/opinion. for me, Xojo Web has made steady progress over time. I also see great progress towards Web Framework 2.0 (refer Greg O’lone’s excellent video update ).

Experience has taught me to value stability/dependability over features shipped. I find Xojo Web a very stable offering. I do use GraffitiSuite and the occasional plugin to fill gaps if/when required, but have always been able to get things done. Having gaps in functionality and having a healthy plugin market to fill those gaps is not the sign of platform weakness many developers think it is. Rather, it allows platform evangelists to build businesses on the back of their platform knowledge - their skills and experience retained to the platform. A few good men/women make a world of difference.

According to the documentation for HTTPSocket , HTTPSocket was deprecated in favour of URLConnection since 2019 r1. I guess it has been on web since then, although I probably continued to use HTTPSocket.

URLConnection is certainly available in the current version of Xojo Web 2019r3.1. Please test for yourself.

My implementation is very simple and likely not a representation of current best practice, so I will leave the best practice notes to someone else.

Not selling (and unsure), but maybe purchasing a standalone web licence, is a less expensive option than upgrading to Pro?

Kind regards, Andrew

[quote=485534:@Ivan Tellez]Now I have a desktop app that uses a 3rd party web service, it works fine with a call to SendSync URLConnection in a thread.

But now, I have to make a Web App that calls this same 3rd party web service but I’m afraid that calling it from the same Web app will be too much strain.[/quote]
I think you’d be fine to use either URLConnection.Send (not SendSync) or Xojo.Net.HTTPSocket.Send and deal with the result in the ContentReceived/PageReceived event. Avoid using URLConnection.SendSync as that could tie up the web app and prevent it from handling other requests.