Xojo Case Study: A Custom API For A Promotional Products Company
A few months ago, a client that works in the promotional products industry contacted me about a potential project. They purchase products from a large number of suppliers, and needed a way to integrate two of their systems (a FileMaker-based order processing system, and a custom ecommerce system) with their suppliers' APIs.
Many of their suppliers provide APIs that follow Promo Standards, a set of standards that have been established by a group of suppliers, distributors, and service providers in the promotional products industry. In theory, that should have made this integration project easy.
However, the standard uses Simple Object Access Protocol (SOAP) for both requests and responses. SOAP can be challenging to work with, and it isn't supported by either of my client's systems. Another challenge is that some suppliers do not fully follow the standards.
Designing A Solution
I proposed developing a system that would provide a simple, consistent API that would hide all of the complexity that goes into sending, receiving, and transforming the SOAP envelopes. It would take requests from the client's system, package the requests up as SOAP envelopes, and send them to the suppliers' APIs. It would receive the SOAP responses, transform the responses into JSON or HTML, and return those results to my client's systems.
Initially, I thought that I would be able to use Luna for this project. (Luna is an open source, Xojo-based framework for creating RESTful APIs.) However, because the API would need to pull data from a number of other third-party APIs and use SOAP to do so, it quickly became clear that Luna wasn't going to be of much help. The project would require building a custom solution from scratch. And that's here Xojo comes in.
Developing A Xojo Web Application
So instead, I developed an entirely new Xojo-based Web application. It listens for requests and handles them using the HandleURL method of the Xojo WebApplication class.
For every incoming request, the HandleURL method creates an instance of a custom PSRequest class (shown to the left). The PSRequest instances handle all aspects of responding to the request - from authentication, to identifying and locating supplier credentials, to creating, sending, and receiving tje SOAP requests and responses. They also handle the transformation of the SOAP responses into JSON or HTML.
From Concept to Production
The project has been a huge success. The Xojo Web app that was developed is easy to maintain and enhance. It is being hosted on a low-cost Linux-based Amazon EC2 Server, and performance and reliability have been terrific.
This project is a good example of the power and flexibility that Xojo provides. It's further proof that with Xojo, you can go from concept to a production-ready solution very quickly.
If you aren't already familiar with Xojo, I encourage you to check it out. You can use Xojo to create powerful, cross-platform, native apps for desktop, web, iOS, and Raspberry Pi™. Visit Xojo.com for details.