Questions about AIF in Ax2009

Hi,

I would like try AIF in Ax 2009. I found some example video but I have still some questions.

  1. Can I create service in Ax without Query? For example. I would like create simple method that retrieve ItemId, does some operation in method and return boolean

  2. It seems that AIF in 2012 R2 is better and more powereful than AIF in 2009. Is it right?

  3. Is it posssible work with 2 and more queries in one service? If yes, how please?

  1. Yes, you can create custom services (distinct from document-based service) even in AX2009.
  2. It’s definitely much better in AX2012. Namely creating custom services is way easier. Also the overall infrastructure (e.g. by the fact the AOS itself hosts WCF services) and the ease of configuration were significantly improved.
  3. Document services are always modeled on a single query, although the query can be quite complex. It makes sense, because it represents a single document.
    Your implementation of the service can call do whatever you need, including calling another query, it it makes sense. Can you explain what you’re trying to achieve?

Thank you for your reply, Martin. Point 3 was only question.

I have got one more question please. If I create query that return for example Items for some external application in Visual Studio. Next I need get InventSum and for this Items, do I have to do new Query and new service, right? So I need reference two services in my external application. Could I do it in one service?

You surely can include additional information in your query/document for items - check the existing AxdItem query to see that it contains much more than just InventTable.

Nevertheless you should be aware of performance. If you create one huge service, it may be very inefficient. For example, if you want to know the on-hand quantity of item A in warehouse B, you aren’t interested in any details about the item itself. Two services makes better sense to me.

By the way there are standard services for both items (InventItemService) and on-hand quantity (InventInventoryOnHandService).

I found these two services but with InventInventoryOnHandService is one problem. I need to use table’s method InventSum.availPhysical() for specific ItemId and inventory dimension. How should I do it please?

The service exposes InventSum.AvailPhysical field. Use the read operation to find the record you want (see How to Call the Read Operation on an AIF Web Service if you don’t know how).

I know that there is the field AvailPhysical but why does InventSum form use availPhysical() method instead of field ? I thought that is from some reason and everywhere i use this method .

When InventSum record is inserted or updated, a value get from availOrdered() is saved to AvailOrdered field. The method will give you an updated value (if an underlying field changed) even before saving. That’s not relevant to read AIF operation and therefore the service doesn’t need to expose the method.