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.

25 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
  2. Newton

    Has anyone experienced problems when running several API calls with the same API? I have tried to run the following code both as separate threads (using BackgroundWorker) and directly as a for-loop.

    var api = “OIS100MI”;
    var transaction = “GetOrderPromise”;
    record = new MIRecord();
    record[“CONO”] = companyNo;
    record[“ITNO”] = inputPara.ItemNo;
    record[“WHLO”] = inputPara.Whlo;
    record[“ORQT”] = inputPara.OrderQty;
    record[“DWDT”] = inputPara.ReqDate;
    var response = MIAccess.Execute(api, transaction, record);

    However, my issue is that the API only return a response for every second call and without any errors i.e. the first is OK, second no response, third OK etc. I suspected a timing error so I also added long delays etc but nothing helps. Any ideas what I might be doing wrong? I get the impression I will have to close/reset the connection before a new call can be made.

    Reply
    1. karinpb Post author

      Hi Newton,
      I have not heard of anyone having issues with multiple API calls. So you are requesting order promises for a list of different items? I would take a Fiddler log of the calls (in a tight loop) and report the issue to support. Or at least use the Fiddler log to investigate further.

      Reply
  3. Sam N

    Hi Karin,

    1) Is it possible to create a new transaction in an existing API? For example an update transaction in PPS360MI.

    2) Is it possible to add a field to an existing transaction. I tried adding CRLM field to ChgBasic Data transaction in CRS610MI to test it .But, it would not work. I know that there is a separate transaction ChgFinancial in CRS610MI which will allow me to do this. But, I want to be able to do it in a transaction of my choice.

    Thanks .

    Sam

    Reply
    1. karinpb Post author

      Hi,
      1) Since it is possible to do modifications in all M3 programs it is possible to do them in MI programs as well.
      2) If there is enough room in an existing transaction then you can modify the transaction.
      But with any modification it is best to create your own new API and transaction so that you don’t need to consider what will happen with updates. So I would not recommend updating the delivered MI programs event though I think it is allowed. There is a seperate API toolkit with documentation for the M3 MI APIs and I’m acctually not the correct person to ask about M3 modifications.

      When working with APIs in Smart Office make sure the MRS001MI meta data is correct and that the cache in M3-API-WS has been cleared and the client restarted (we have a cache as well). There is the MDBRead tool that can generate APIs from the database.

      I’m not sure why it would matter where an update transaction is added.

      Reply
      1. Sam N

        Hi Karin,

        Thanks for your immediate reply . I sincerely appreciate it. Especially since I am new to developing in the Infor M3 environment.

        I can access the M3-API-WS through the life-cycle manager.

        I still cant find the API tool kit. What is the API tool kit? Where can I get or find the API toolkit?

        Thanks.
        Sam

      2. Sam N

        Hi Karin,

        Over the day I have made some progress . I tried creating my own MIs and transactions. I keep getting this error : “DC_0005 – Command does not exist ” . What does that mean.

        Thanks and Regards.
        Sam.

      3. karinpb Post author

        Hi,
        I’m sorry but I can’t help you with M3 API development. There might be some forums that can help you. Almost everyone here is on vacation.

        I think the error message is something really core becuase that message exists in all APIs for all transactions.

      4. Sam N

        Hi Karin,
        I totally understand. I have one final question-

        How do you create a transaction in an existing MI and get it to work? At the moment I am creating it in MRS001-> MRS002-> MRS003. I am also clearing cache in the client (mforms:mitest) and in M3APIWS. Still nothing happens. It does not work.

        Am I missing something? I see it , I have created it, the field names, data type, field lengths are correct. But, still wont work.

        Is there documentation somewhere on creating new transactions and new MIs?

        Thanks heaps.

        Sam.

  4. karinpb Post author

    You need the MAK and you need to edit and deploy java code to the M3. Just editing the metadata is not enough. You need the API Toolkit and the developers guide. I think it requires a license as well for the java M3 API development. Check the extreme support for information or contact Infor.

    Reply
    1. Sam N

      Oh.. Ok… that makes sense now. Was breaking my head over it a couple of days. I am sure this information will be useful for others in the future too.

      Thanks again.

      Reply
  5. Amanda

    Hí Karin
    If I use an API, f ex MMS025MI/LstAlias, in a Mashup to list aliasnbr from a special Item. When I have an item that has an Aliasnbr, ok. But when I use an item that doesn’t have an Aliasnbr, I’ll get the messaage, “Post doesn’t exsist”, but Mashup still shows the previous item that had an Aliasnbr. Is it possible to trigger the Mashup to “clear”, so I don’t see the old data?

    Thanks in advance! 🙂

    Reply
    1. karinpb Post author

      Hi,
      Sorry for the late reply. Depending on the version the MIPanel has a clear event that you can trigger before the currentitemchanged event. So Map current item changed first to clear and then to List so that the panel will be cleared before the list.

      Reply
      1. Veeresh

        I’m also facing Kiran’s problem. Please provide more details about how clean the previous data as it’s returning previous record though I’m sending new.

      2. karinpb Post author

        Hi,
        I don’t know what the specific scenario is but I’m thinking something like this:

        <m3:MIPanel Name="CustomerDetail" Grid.Row="2" Margin="8,16,8,8">
        		<m3:MIPanel.Events>
        			<mashup:Events>
        				<mashup:Event SourceName="CustomerList" TargetName="CustomerDetail" SourceEventName="CurrentItemChanged" TargetEventName="Clear">
        					<mashup:Parameter SourceKey="CUNO" TargetKey="CUNO" />
        				</mashup:Event>
        				<mashup:Event SourceName="CustomerList" TargetName="CustomerDetail" SourceEventName="CurrentItemChanged" TargetEventName="Get">
        					<mashup:Parameter SourceKey="CUNO" TargetKey="CUNO" />
        				</mashup:Event>
        			</mashup:Events>
        		</m3:MIPanel.Events>
        
  6. Billy W.

    Greeting; I’m trying to use OIS100MI.AddText, what is the field FLDN “Field Number” expecting?

    Reply
      1. Billy W.

        Good Morning; Sadly, the documentation I have for the M3 API and the Documentation with Smart Office both exclude any explanation of how to populate that field. Thanks; Billy

      2. Billy W.

        Good Evening; I opened a ticket with Infor, for anyone else who has that problem, the AddText field number is listed as a numeric (6,0), but it’s actually a string, you put the field name of the note field you want to update. Thanks; Billy

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