Monday, 23 February 2015

Creating a Custom Inbound and Document Inbound Services


Over View

Application Integration Framework (AIF) services are used to communicate with external systems or applications. Microsoft Dynamics AX 2012 has the following types of services:

  1. Document services
  2. Custom services
  3. System services
An AIF service can be Inbound or Outbound. An Inbound service is used when you want to send data to an external system and Outbound services are used when you want to retrieve data. This tutorial will guide you in creating Custom Inbound AIF services in Microsoft Dynamics AX 2012. Custom services are used when:
  1. The complexity of the entities is relatively low.
  2. When you want to have full control of the service contract.
  3. When data contracts needs to be shared with different entities.

Pre-requisites

  1. Microsoft Dynamics AX 2012
  2. AIF services must be installed and configured on IIS

Important Concepts

  1. Service operation

    Service operations are class methods that expose any business logic in a service. To define a service operation, add the SysEntryPointAttribute attribute at the top of a method. Any existing method can be converted to a service operation by adding this attribute at the beginning of the method. 
    &absp;
    Note:
     The service operation name cannot include Create, Find, Update or Delete. These names are reserved to be used by AIF Document services. AX will make an exception when they are called from a client.
  2. SysEntryPointAttribute

    SysEntryPointAttribute defines the authorization checks that will be performed when a method is called from the server. This attribute must be set on all the service operations. If the value is “true”, it means that authorization checks will be performed for all the tables accessed in the method and if set to “false”, no authorization checks will be performed.
  3. AifCollectionTypeAttribute

    AifCollectionTypeAttribute is used when you want to use a collection as a return type or in a parameter of a service operation. This attribute defines the type of data a collection contains.

Scenario

As part of this tutorial the service will return the list of customer names in Dynamics AX.

Steps

  1. First we will create a new class which will contain Service operations.

  2. Open AOT. Go to Classes and create a new class. Let’s name it CustomerServiceDemo.

  3. Set the RunOn property of the class to Server. This will make sure the class always executes on the server.

  4.  
  5. Add a new method and name it as getCustomerNameList. This method will query customers’ names and return a Type list string. Write the following code in the method:
  6. The SysEntryPointAttribute tells AX that this method is a service operation method.

  7. Now we will create a new service and add the above created service operation to it.

  8. Go to Services, right click and select New Service.

  9. Name it as CustomerServiceDemo.

  10. Open the properties of the newly created service and select the CustomerServiceDemo class in the Class field.

  11. Now expand the CustomerServiceDemo service node and add a new Operation by right clicking on Operations and selecting Add Operation.

  12. All service operations present in the class will be listed. Select the getCustomerNameList service operation by checking the Add field in the grid and press OK.

  13. The next step is to create a service group and deploy the service to the Inbound Port.

  14. Go to Service Groups, right click and select New Service group.

  15. Name it as CustomerServiceDemoGroup.

  16. Set the AutoDeploy to Yes (Service will start automatically when AOS is started) and set the Description asCustomer name service.

  17. Right click the newly created service group and select New Service Node Reference.

  18. In the newly created service node, set the Service property to CustomerServiceDemo. The Name property will automatically default to the Service name.

  19. Now right click the service group and select Deploy Service Group.

  20. A success message will appear if the service group is successfully deployed.

  21. To verify it, go to System administration Ã  Setup Ã  Services and Application Integration Framework Ã  Inbound ports.

  22. The Service group name CustomerServiceDemoGroup will appear here as Port name with a green check mark. This shows that service group is deployed and active. If a red ‘x’ is appearing, select Activate from the action pane to activate the port.

  23. The WSDL URI is the URL of the service which can be used by external systems to access the service.

  24. To test whether the service is running properly, open the Visual Studio Command Prompt by going to All Programsà Microsoft Visual Studio 2010 Ã  Visual Studio Tools Ã  Visual Studio Command Prompt.

  25. Write wcftestclient and press enter. WCF Test Client will open.

  26. Now, go to File Ã Add Service.

  27. In the Add Service dialog box, paste the WSDL URI of the port and press OK.

  28. The WCF Test Client will open the service with the list of operations available.

  29. Double click the getCustomerNameList. It will open the operation details in the right hand side pane.

  30. Click the Invoke button. The result of the service will appear in the Response pane.
  31.  http://www.dynamics101.com/2013/11/creating-custom-inbound-aif-service-microsoft-dynamics-ax-2012/

    Creating a Document Inbound  Services

    Overview

    Application Integration Framework (AIF) services are used to communicate with external systems or applications. Microsoft Dynamics AX 2012 has the following types of services:
    1. Document services
    2. Custom services
    3. System services
    An AIF service can be Inbound or Outbound. An Inbound service is used to send data to an external system while Outbound services are used to retrieve data.
    This tutorial will guide you in creating Document Inbound AIF services for Microsoft Dynamics AX 2012.
    Document services are XML documents that initiate transfer of data into or out of Dynamics AX. Any entity in AX can be represented as Documents, such as Customers or Sales Orders.
    Document services are used when we have to execute complex CRUD (Create, Read, Update, Delete) operations on an entity.

    Pre-requisites

    1. Microsoft Dynamics AX 2012
    2. AIF services must be installed and configured on IIS

    Scenario

    As part of this tutorial, the service will return the list of Item IDs in Dynamics AX

    Steps

    1. Document service uses an AOT query to generate related artifacts. For this tutorial, InventTable query will be used

    2. Open Microsoft Dynamics AX Development workspace. Go to Tools Ã  Application Integration FrameworkàCreate document service

    3. This will open the AIF Document Service Wizard. Click Next to proceed

    4. In this step, specify the Document parameters. Select the Query for which service has to be created. TheDocument name will default to Query name. Modify it as required and give a suitable Document label as shown below. Click Next

    5. Now specify the Code generation parameters. The wizard will use this to create the respective classes. Check the required Service operations you want to be automatically created by the wizard. Click Next
      Note: To allow Update/Delete/Create Service operations, the Update property must be set to Yes

    6. In the Generate code window, review the artifacts that will be generated. Click Generate to proceed

    7. The wizard will now generate all the artifacts. In the end, a Completed screen will display the list of artifacts it created. Click Finish to exit the wizard

    8. The next step is to create a service group and deploy the service to an Inbound Port

    9. Go to Service Groups, right click on it, and select New Service Group

    10. Name it InventServiceDemoGroup

    11. Set AutoDeploy to Yes (so the service will start automatically when AOS is started) and set the Description to Item Id service

    12. Right click the newly created service group and select New Service Node Reference

    13. In the newly created service node, set the Service property to InventTableDemoService. The Name property will automatically default to the Service name

    14. Now right click the service group and select Deploy Service Group

    15. A success message will appear if the service group is successfully deployed

    16. To verify, go to System administration Ã  Setup Ã  Services and Application Integration Framework Ã  Inbound ports

    17. The Service group name InventServiceDemoGroup will appear here as Port name with a green tick mark. This shows that the service group is deployed and active. If a red cross mark is present, select Activate from the action pane to activate the port

    18. The WSDL URI is the URL of the service which can be used by external systems to access the service
http://www.dynamics101.com/2014/06/creating-document-inbound-aif-service-microsoft-dynamics-ax-2012/

Sunday, 22 February 2015

reporting services catalog database file existence while installing SQL server 2008 R2

ERROR : reporting services catalog database file existence while installing SQL server 2008 R2

SQL Server 2008 R2 Setup shows the following error messages after running a set of rules to determine if the installation process wizard Pre-requisites check.


  •  "Reporting Services Catalog Database File Existence" failed
  • "Reporting Services Catalog Temporary Database File Existence" failed.
Error message when you install a SQL Server 2008 Reporting Services instance by using an instance name that you previously uninstalled: "The catalog database file exists"

CAUSE :

This issue occurs because the databases for the SQL Server 2008 Reporting Services instance that you want to install already exist on the computer with following path.

C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA


RESOLUTION :

Solution 1:

Use a different SQL instance name.

Solution 2:

Manually Remove .MDF and .LDF files from below path and Re-run Setup.
C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA

Saturday, 21 February 2015

Creating Header/Detail-based Linkage On One Form


Best Blog
http://talasilarahuldaxing.blogspot.in/

Forma Development
http://daxdave.blogspot.in/2006/10/creating-headerdetail-based-linkage-on.html



Thursday, 19 February 2015

Display customized Text In Status Bar- Axapta 2012

Here i'm sharing the code to Display customized Text In Status Bar

//Copy and paste the below code in a Job

static void statusbar(Args _args)
{
    str customtext;
    ;

    customtext = "Test";

    // Force the text to be shown
    xUserInfo::statusLine_CustomText(true);
    infolog.writeCustomStatlineItem(customtext);

}

Wednesday, 18 February 2015

There was an error while trying to deserialize parameter http://tempuri.org/:queryBuilderArgs. The InnerException message was 'Element 'http://tempuri.org/:queryBuilderArgs' contains data from a type that maps to the name

There was an error while trying to deserialize parameter http://tempuri.org/:queryBuilderArgs. The InnerException message was 'Element 'http://tempuri.org/:queryBuilderArgs' contains data from a type that maps to the name 'http://schemas.datacontract.org/2004/07/XppClasses:SRSQueryBuilderArgs'........................................

Some times we get the above error while running reports in Axapta 2012. To resolve this issue we need to delete usage data in the AOSserver.


Solution : 

Step 1 -> Connect to sql server and go to axapta database(MicrosoftDynamicsAx) and delete all records indbo.SYSCLIENTSESSIONS table.

Step 2-> Close the AX 2012 client to clear any in-memory elements.

Step 3-> Stop the Microsoft Dynamics Server service on the Application Object Server (AOS) to clear any in-memory elements.

Step 4-> Delete the application element cache files (*.auc),(*.KTI) from the Local Application Data folder.

C:\Users\AOSAccount\AppData\Local  (Delete the all the AUC and KTI files)

Step 5-> Delete VSAssemblies from the Local Application Data folder.

C:\Users\youruserid\AppData\Local\Microsoft\Dynamics AX\VSAssemblies

Step 6-> Start the service




Note : Make sure show hidden files,folders,and drivers option enabled
Hello Guys..

Here i'm sharing steps how to add company logo to a ssrs report.

Step1 :

-> Add Extended Data Type "BitMap" to your table and name it as "CompanyLogo".
-> Add Extended Data Type "NoYesId" to your table and name it as "PrintLogo".

Step 2 :

-> Go to insert method of your ssrs report DP class and paste the below code before yourtable.insert();

if (conLen(FormLetter::companyLogo()) == 0)
    {
        yourtable.PrintLogo = NoYes::No;
    }
    else
    {
        yourtable.PrintLogo = NoYes::Yes;
        yourtable.CompanyLogo = FormLetter::companyLogo();
    }

//Note : Change table name

Step 3:
-> Edit your ssrs report design in visual studio.
-> Insert Image as shown in the below screen shot
-> Then go to image properties
-> In the properties go to "Use this field" and paste the below code and change the data set name

=IIF(First(Fields!PrintLogo.Value, "datasetname") = "Yes", First(Fields!CompanyLogo.Value, "datasetname"), "")

-> Select company logo type in the "Use this MIME type"
-> Save and then deploy the report ..

That's It ... :)