Testing M3 APIs

When you work with M3 APIs there are a few very useful resources available, one of them is MITest. MITest has been around for a while and it looks like this:

In Lawson Smart Office 9.1.3 we introduced a new way to call APIs using a grid application called MI-API-WS. This application uses the API repository meta data in a way we have not used it before. Thanks to the Grid team and this new application we were able to build generic Mashup and data services that can call any M3 API without going through the steps of having to generate .Net stubs.

Since we use APIs via this new service we have created a new tool that will help you test M3 APIs. It is called MITest++ and can be launched using the mforms://mitest in the start and search field.

The M3-WS-API has a Management tool within the Grid and from that tool it is possible to test web services as well. So if you want to test close to the source this is an option for you.

If you are creating new APIs or updating meta data it is important to know that you need to refresh the meta data in the M3-WS-API application. You find the link to the administration tool if you follow the two images below. There is this new cool tool, the M3 BE generic API Database reader (MDBREADMI) that enables you to create simple list or get transactions (that retrieve data from a single table) all by yourself. No coding is required. If you use this tool you need to clear the cache.

The new API, MDBREADMI, combines the benefits of MVXDATMI (easy setup and metadata) with good performance and authorization checks. There is no BE program or BE table to define the transactions. Instead, the M3 Interface Repository (MRS001/MRS002/MRS003) is used as the definition of the transactions.

There is also a design program in the M3 API toolkit, MdbRead, that can be used to define and update the transactions in (MRS002) and (MRS003). In just four simple steps the transactions are designed and updated.

If you use MDBREAD then you will need to clear the meta data. In LSO 9.1.3 this as to be done in the Management pages for M3-API-WS in the Grid, but in LSO 10.0.0 this is integrated and available from with MITest++ in LSO. So this news is good news for all Smart Office fans. In 9.1.3 there was a clear cache function within MITest++ but it only cleared the cache in the Client, you still had to have access to the Grid to clear the meta data on the server.

Click the Management pages.

Troubleshooting
My experience is that if you have an issue with calling an API from LSO the reason is that the meta data in MRS100 for the transaction is not correct. In LSO we use the meta data to parse the types and in M3 – API-WS on the grid we use the meta data to transform the data that is sent to M3. This means that a transaction can work fine in the traditional MITest that you probably have used like forever but when you run an API call in a Mashup or in JScript it just does not work!

1. Check the LSO log. Available from the “About Lawson Smart Office” found under the help dialog. If you are developing for LSO you should know were to find it. Change the log level (in Settings) to DEBUG and run your transaction. If there are parsing issues you will see those error in DEBUG.

2. Check the meta data. Now this is not an easy task so you probably should send the issue to Support. Do that! Or if you know your way around MRS001MI you could check the fields and see if you suspect one to be incorrectly specified. Like as a string but it is numeric.

3. Clear the meta data cache to make sure you are testing against the latest version of the meta data. You can clear the cache (if you have access) via a menu item in MITest++. The menu should say Clear metadata cache. If it says something with Local you are on a previous version and have to clear the cache via the Management tools for the Grid.

4. If you are a real Geek, use Fiddler and check the WS request to see the values from M3-API-WS.

4 thoughts on “Testing M3 APIs

  1. mikael

    Hi. One question. How is the connection between mashup-LES-MDBREADMI ? Does MDBREADMI use LES in someway ? Thanks !!!!! /mikael

    Reply

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 )

Connecting to %s