AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 24.01.2012, 21:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,631 / 848 (80) +++++++
Регистрация: 28.10.2006
axblog4u: Dynamics AX2012: Create Custom Service using X++
Источник: http://axblog4u.wordpress.com/2012/0...rvice-using-x/
==============


Case Study: In this demo scenario, we create a custom service to find the inventory onhand physical item quantity from AX2012.

To expose any Custom Service, method should be ‘public’ Access Specifiers & should be defined by an attribute named ‘[SysEntryPointAttribute(true)]‘.



For this project, I have a created a sample InventoryOnHand service which basically returns the number of qty for a given Item.


class InventOnhandService{}[SysEntryPointAttribute(true)]public InventQty itemOnHandPhysical(ItemId _itemId = ''){ SalesLine salesLine; InventOnhand inventOnHand; InventMovement movement; InventQty qty = 0; select firstOnly salesLine where salesLine.ItemId == _itemId; if (salesLine) { movement = InventMovement::construct(salesLine); inventOnhand = InventOnhand::newPhysicalUpdate(movement, movement.inventdim()); qty = inventOnHand.availPhysical(); } return qty;}
Next step is to create a ‘Service’ & map the custom class with newly created service. By which you could exposed all public methods which are in the scope of current class. Please proceed further by Creating a New Service Group & Add it to Service Node Reference. Please mark the ‘Auto Deploy’ property to ‘Yes’ on the Service group (properties).

Right click on the created Service group and click ‘Deploy Service Group’. This would deploy all the relavent artifacts to the Inbound port under System Administration module.


In order to test your custom Service application, simply start VS Command prompt (or) traverse through Start -> AllPrograms -> Microsoft Visual Studio 2010 -> Visual Studio Tools -> Visual Studio Command Prompt

Enter wcftestclient, space and then paste the WSDL URI (which you can find on the deployed Inbound port)




When the WCF test client starts double click on your method ‘itemOnHandPhysical’(in my case) and specify the value under request by passing the _itemId (i.e. 1290 in my case) the invoke function will return the appropriate response of the available physical quantity of an item from the AX2012.





Download Link: InventoryOnHandService happy servicing AX2012



Tagged: inbound port, new service group, visual studio tools

Источник: http://axblog4u.wordpress.com/2012/0...rvice-using-x/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
axblog4u: Dynamics AX2012: Table Full Text Indexes Blog bot DAX Blogs 0 26.09.2011 13:11
crminthefield: Podcast and Overview: Microsoft Dynamics CRM 2011 Update Rollup 4 Blog bot Dynamics CRM: Blogs 0 24.09.2011 01:16
DynamicsAxSCM: Service products in Microsoft Dynamics AX 2012 Blog bot DAX Blogs 2 02.06.2011 13:36
axinthefield: Dynamics AX Event IDs Blog bot DAX Blogs 0 01.03.2011 22:11
CRM DE LA CREME! Configuring Microsoft Dynamics CRM 4.0 for Internet-facing deployment Blog bot Dynamics CRM: Blogs 0 18.08.2009 11:05

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 05:07.