24.01.2012, 21:11 | #1 |
Участник
|
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, напишите личное сообщение администратору. |
|
|
|