The following services are available in Microsoft Dynamics AX 2012.
Document services
Introduced in Microsoft Dynamics AX 4.0, documents represent business objects, such as customers, vendors, and sales orders. Document services enable you to exchange data with external systems by sending and receiving XML documents. The following figure shows the internal details of a document service.
The DocumentService class exposes the operations of the service. The DocumentService class calls the functionality in Axd <Document> classes that contain any customizations to the business logic for modeled entities. For example, the AxdCustomer class contains the customization logic to create, update, or delete a customer entity. Axd <Document> classes can use Ax<Table> classes to create, update, or delete document tables, or optionally to apply customizations during read operations.
Document services are generated from a query that models the business entity. For example, a customer query will run the Document Service Generation Wizard to create the service artifacts. Document services include logic to handle the details of how a query will be serialized or de-serialized from XML that is sent across a network. For example, the document services framework can serialize and de-serialize dimension attributes and perform natural key substitution. The framework deals with the polymorphic nature of queries, the date effective fields, and so on. All the data-layer improvements have been handled in the framework. The creator of a document service only has to make sure that the business entity is properly mapped to the query object.
All artifacts produced in a document service are customizable so that a developer can further fine-tune the functionality based on the requirements.
Synchronization APIs
Two new APIs have been introduced in the document services framework to enable the synchronization of entities between Microsoft Dynamics AX 2012 and external systems. These APIs are not present in the preinstalled document services or in the Document Service Generation Wizard. Developers must extend this base support to enable their own scenarios.
getKeys method: Similar to the existing findKeys method, but applies the document filters that have been configured for the service and port. Filters provide a mechanism for restricting the overall set of documents that will be returned by a document service. For example, a filter on a customer document on the Name field would return only those customers whose name matches the filter.
getChangedKeys method: Extends the getKeys method by adding a parameter that contains a date and time. The values returned are the ones that changed in the root data source or any child data source of the document after the specified date and time.
Custom services
Custom services in Microsoft Dynamics AX 2012 allow developers to expose any X++ logic through a service interface. Custom services were supported in Microsoft Dynamics AX 2009, but the framework support for some data types was limited. For any complex type, developers were required to write custom serialization and de-serialization logic.
Microsoft Dynamics AX 2012 provides standard attributes that can be set on the DataContract class and its members to make them serialize and de-serialize data that is sent and received across a network connection. Many predefined types, such as Collections and Tables, are also supported. This feature enables you to expose any existing X++ class and its members as part of a service operation without writing new code, just by setting a few attribute values. The syntax is similar to using data contract attributes in WCF.
System services
System services are a new category of services that have been added in Microsoft Dynamics AX 2012. These services are not customizable and are not mapped to any query or X++ code. These services are written in managed code and hosted on the AOS at a fixed address specified in the server configuration file.
1-Query Service
Query Service exposes APIs to execute any Application Object Tree (AOT)–defined or ad hoc client-defined query against the system. It can also execute a dynamically generated query by using X++. The results are returned as an ADO.NET DataSet object. This feature is especially useful in creating Microsoft .NET Framework applications that use controls that can be bound to the returned result.
The URL for Query Service is as follows
net.tcp://<hostname:port>/DynamicsAX/Services/QueryService
where hostname and port are on the computer running the AOS.
The caller of Query Service needs to have appropriate permissions to retrieve all the requested information. If certain fields in the requested set are not permitted, they are trimmed. If any data source in the join list is not permitted, the service call fails with an error.
2- Metadata Service
Metadata Service enables clients to get information about some key metadata in the AOT. Clients can get information about which queries or services exist in the AOT and various details about each instance. This feature is useful in scenarios in which some metadata details need to be checked or published by an application. Another important scenario is retrieving labels for different locales for building and displaying custom user interfaces.
The URL for Metadata Service is as follows
net.tcp://<hostname:port>/DynamicsAX/Services/MetadataService
where hostname and port are on the computer running the AOS.
3- User Session Service
User Session Service allows the caller to retrieve information about the calling user. This includes details such as the user’s company, timezone offset, and locale.
The URL for User Session Service is as follows:
net.tcp://<hostname:port>/DynamicsAX/Services/UserSessionService
where hostname and port are on the computer running the AOS.
No comments:
Post a Comment