Stephen Smith's Blog

All things Sage ERP…

The Argos SDK

with 16 comments


Introduction

Argos is a framework for creating mobile SData clients using HTML5, JavaScript and CSS. This was originally developed by the Sage SalesLogix group to create the mobile interface for the Sage SalesLogix Mobile product. However since SalesLogix uses SData as its Web Services interface, this library was created entirely on SData. As a consequence it can be used with any product that supports SData.

As part of our Sage 300 ERP 2012 development we tested Argos on our SData feeds and produced a sample mobile application.

Note: that to run this application on your own system, you need at least the Sage 300 ERP 2012 beta.

Argos SDK

The Argos SDK is open source and available on github:

This includes a JavaScript SData client library that you can use standalone independent of the rest of the SDK along with a sample application that shows Argos running on SalesLogix. The SalesLogix sample application also includes the second sample which shows how to customize the first without requiring code changes to it.

Sage 300 Sample Argos Application

Sorry, the Sage 300 team doesn’t have a github account like SalesLogix right now. However I posted the Sage 300 Sample application and the matching Argos SDK on GDrive here:

Generally you would put these as folders under the c:\inetpub\wwwroot folder. Then you can start the app via: http://localhost/sage300/index-dev.html. (Or substitute your own hostname as needed).

In the Sage300 application there is a runtime folder. This needs to be copied to: C:\Program Files (x86)\Common Files\Sage\Sage 300 ERP\Tomcat\portal\sageERP\runtime. These are the definition files for the SData feeds that this sample uses. After you copy this, you need to restart the “Sage 300 ERP Tomcat” service for them to get read.

CORS

The last gotcha is that the Argos SDK uses Cross Origin Resource Sharing (CORS). This is a mechanism where the server that is serving the HTML can let the browser know its ok to talk to another server. This way the Web Server that serves up the HTML, CSS and JavaScript files can be different than the SData server. Normally this isn’t allowed as it’s considered a severe security threat since it allows malicious programs to send sensitive data to a third server or to send out things like Spam. CORS is an internet standard that provides a way to let the browser know what is ok and what is bad in a secure manner.

As a result, you have to configure the IIS (or whatever web server you use for the static content) to grant access to the SData server. You still have to do this, even if they are the same, since all SData requests from the Argos SDK are CORS validated. The Wiki attached to the Argos SDK on the main Github site above has complete information on this.

But since I’m not exposed to the outside world and don’t usually worry too much about this, I tend to just let CORS say everything is valid with a simple web.config file (in c:\inetpub\wwwroot):

<?xml version=”1.0″ encoding=”UTF-8″?>
<configuration>
<system.webServer>
<handlers accessPolicy=”Read, Execute, Script” />
<httpProtocol>
<customHeaders>
<add name=”Access-Control-Allow-Origin” value=”*” />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>

Like I said, don’t just specify “*” like I have for a real situation, but if you are on different networks with a laptop, sometimes this is just easier. Similarly in a real environment, you would want to use https rather than http.

Configuring to Connect to Sage 300 SData Feeds

The key to interfacing to Sage 300 is the development.js file in the configuration folder. To work with Sage 300 it needs to look something like this:

define(‘configuration/development’, [‘Mobile/Sage300/ApplicationModule’], function() {
return {
modules: [
new Mobile.Sage300.ApplicationModule()
],
connections: {
‘crm': {
isDefault: true,
offline: false,
url: ‘http://localhost/sdata/sageERP/sage300mobiledemo/SAMINC/&#8217;,
virtualDirectory: ‘SDataServlet/sdata’,
json: false
}
},
enableUpdateNotification: true
};
});

The key parts are the virtualDirectory to form the correct SData URLs for Sage 300. Remember that Sage 300 URLs start SDataServlet/sdata rather than just sdata. This is to avoid conflict when we are installed on the same server as Sage CRM. So notice the url: tag doesn’t include SDataServlet and then the virtualDirectory tag does. This will then cause the correct URLs to be formed. If you are having trouble with URLs then the Fiddler tool is great for debugging what is going on.

Note that to work, at least you need to change localhost to the server name you are using. Localhost will only work when running on the same computer.

Setup Quick List

So to summarize setup:

  1. Unzip the two zip files under the c:\inetpub\wwwroot folder.
  2. Add something to c:\inetpub\wwwroot\web.config for CORS.
  3. Copy the sage300\runtime folder to …\portal\sageerp\runtime.
  4. Restart Tomcat
  5. Edit the development.js file if you need to change the hostname.

Hopefully this will get you going fairly quickly.

Create Your Own App

This blog post is already getting a bit long, so I’ll go into more detail on how this sample program works in a future post. However this should be enough to get you started with the Argos SDK Wiki information and a working sample.

The Argos SDK is written in JavaScript and oriented to JavaScript development, so learning JavaScript is crucial. There are many good books on JavaScript as well as many good free web based resources. I like “Eloquent JavaScript” by Marign Haverbeke since it is fairly short and complete.

The Argos SDK relies heavily on the Dojo JavaScript framework. Along with the Simplate library and iUI library. My experience is that you don’t need to know too much about these to work with Argos, but I imagine if you get deep into it, it doesn’t hurt to know something about these.

Summary

One of the goals of SData is to enable the use of common tools across all Sage products. The Argos SDK is an example of this; it is a mobile SDK library for creating mobile applications that use SData to communicate with on-premise Sage applications. Over time you will see more and more of these sort of tools that leverage SData to provide enhanced functionality for a whole range of Sage applications.

About these ads

Written by smist08

July 21, 2012 at 6:25 pm

16 Responses

Subscribe to comments with RSS.

  1. Superb…

    Rengarajan

    July 23, 2012 at 4:40 pm

  2. […] week I introduced a sample of how to develop mobile apps for Sage 300 ERP using the Argos SDK. In that article I covered where to get the sample and how to get it working. This week, we’ll […]

  3. […] just posted a couple of articles on the Argos Mobile SDK here and here; and with the news that Windows 8 has just been released to manufacturing; I thought it […]

  4. Stephen, can you give a little more detail about why the Sage 300 ERP 2012 beta is required to run the sample app? For example, could certain parts be commented out and then the remainder used with 6.0? Is this an indication that potential SData developers should wait for 2012 to be released? Thanks!

    Brian

    August 16, 2012 at 2:49 pm

    • The main thing is updating records. You should be able to read records fine with 6.0A, but you will get some problems if you try to insert or update records.

      smist08

      August 16, 2012 at 4:50 pm

      • Does that mean that all inserts/updates will fail, or just that one needs to get involved with workarounds? We are only wanting to create orders at this point, much like described here: http://interop.sage.com/daisy/sdata/CreateOperation/Example.html Would that work with 6.0A?

        Brian

        August 16, 2012 at 6:15 pm

      • I believe your request to insert/update an order will be rejected due to a bad code page. There is a bug that we compare code pages directly and Argos gives the data in a code page that is a sub-set of what we requested. With version 2012 we recognize this correctly and accept the data.

        smist08

        August 16, 2012 at 6:43 pm

      • Thanks for the clarification. I had misunderstood the issue and thought you were saying that using SData in 6.0A it wouldn’t be possible to do inserts or updates properly no matter what SDK was used. But I see now that this issue is related more to the particulars of the Argos SDK SData implementation.

        Brian

        August 16, 2012 at 6:54 pm

  5. […] was also a Service Billing application demonstrated that is written using the Argos SDK and which runs on all smart phones. This application was demonstrated integrated to Sage 50, 100 […]

  6. […] during the keynote presentation. Currently this is an HTML/JavaScript application written with the Argos SDK. At present this has no offline ability, so must be demonstrated while on-line communicating back […]

  7. […] experience to be the best possible. We are writing both HTML5/JavaScript applications using the Argos-SDK, along with writing applications as native iOS, Windows 8 Metro and Android applications. Plus […]

  8. Hi,

    Could you please help me to launch the sample Argos application on my PC?

    PC Environment Settings:
    1. Windows XP with SP3
    2. Sage 300 ERP with Portal (Portal is working fine)
    3. Company ID: 61ASYS, 61ADAT, PORTAL61A
    4. Browser: Google Chrome (Version 23.0.1271.97 m)

    I’ve tried the “Setup Quick List” section to launch the sample Argos Application (logged in with Sage 300 User: ADMIN/admin), but when clicked on any items from the list (Add Customer, Customers, Vendors, Orders, Purchase Orders and Items), the Authentication Required form was popped up asking for the user name and password for the server localhost:80.

    What should be entered for the user name and password?

    Any kind of help will be appreciated.

    Best regards,
    Gevorg

    Gevorg

    December 18, 2012 at 12:54 pm

    • In IIS for the web site (probably default) ensure that “anonymous authentication” is the only one enabled. If one of the others is enabled then it probably is prompting for this and it isn’t handled.

      smist08

      December 18, 2012 at 4:52 pm

      • Hi Smist,

        Thank you for the quick reply.

        I’ve checked the IIS security and make the screenshot of my PC settings (uploaded on URL: http://img824.imageshack.us/img824/1373/iissecurity.jpg). If this is the case you mentioned above, I’m still getting the Authentication Required form.

        Do you have any ideas?

        I’m looking forward for the solution of the issue, to demonstrate this feature to our office team to a new direction with mobile development (as of now we are working with Sage 300 ERP SDK only).

        Best regards,
        Gevorg

        Gevorg

        December 19, 2012 at 6:06 am

      • You might try running Fiddler (http://www.fiddler2.com/fiddler2/). It might give you a clue as to what is going on. Also make sure you can run the web portal, to make sure that is all setup correctly.

        smist08

        December 20, 2012 at 8:41 pm

  9. […] I’ve done simple POC’s in the past like producing a mobile app using Argos. But more recently I embarked on producing a 64-Bit version of Sage 300. This worked out quite well […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 274 other followers

%d bloggers like this: