RSS

Monthly Archives: October 2012

AIF Webservice : Tracing Web Service calls

When using AIF through web services, you can be in the dark when you want to know what’s really going on in there.

I was looking in to the web.config file suddenly i have seen a tag to trace the AIF Web services.

 

<;system.diagnostics>
<;!-- This is used for enabling tracing in retail and debug builds.
AIF Service processing stack outputs and information
messages used for debugging.
Possible values for the switch are Off, Warning,
Information, Critical, Verbose.
Change the switchValue to Information to enable tracing.
-->;
<sources >
<;source name="AifServiceProcessing" switchValue="Information">
<;listeners >
<;add name="TextWriterListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="AifServiceTrace.webinfo" >;
</add>
<;remove name="Default" />
<;/listeners>
<;/source>
<;/sources>
</system.diagnostics>

 

by default the Inner tag switchValue="Off”> and i have changed in to  switchValue="Information">. I found this on MSDN and will show an example here of what the result of the tracing shows.

i have invoked the service through .net class . there should be a file named AifServiceTrace.Webinfo present with the tracing information : 

The following information can be viewed :

  • UserId’s
  • Message ID
  • Source and destination endpoint
  • Key Data XML
  • Return Data from Ax

 

AifServiceProcessing Information: 0 : SourceEndpointUser : rajdiscoms\axbcproxy
AifServiceProcessing Information: 0 : Logged on to Dynamics Ax successfully.
AifServiceProcessing Information: 0 : Incoming MessageId : 5af19da1-9532-4842-9522-2f499f012e50
AifServiceProcessing Information: 0 : Submitting User : rajdiscoms\axbcproxy
AifServiceProcessing Information: 0 : External Action : http://schemas.microsoft.com/dynamics/2008/01/services/BiliingDeterminantsService/create
AifServiceProcessing Information: 0 : Source Endpoint
AifServiceProcessing Information: 0 : Destination Endpoint
AifServiceProcessing Information: 0 : Parameter in request : <;BiliingDeterminants xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/BiliingDeterminants"><SenderId xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /><Rdm_BillingDeterminants class="entity"><_DocumentHash xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /><BinderNo>798080</BinderNo><DiscomCode xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /><OfficeCode>80980</OfficeCode><ScheduledForBillMonth xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /><ScheduledForBillYear xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /><TimeStamp xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /><TokenIssueDate xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /><TokenNo>90124</TokenNo><TotalConsumers xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /></Rdm_BillingDeterminants></BiliingDeterminants>
AifServiceProcessing Information: 0 : Aif Message Xml Request: : <;?xml version="1.0" encoding="utf-16"?><Envelope xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/Message"><Header><MessageId>{5af19da1-9532-4842-9522-2f499f012e50}</MessageId><SourceEndpointUser>rajdiscoms\axbcproxy</SourceEndpointUser><SourceEndpoint /><DestinationEndpoint /><Action>http://schemas.microsoft.com/dynamics/2008/01/services/BiliingDeterminantsService/create</Action></Header><Body><MessageParts xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/Message"><BiliingDeterminants xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/BiliingDeterminants"><SenderId xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /><Rdm_BillingDeterminants class="entity"><_DocumentHash xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /><BinderNo>798080</BinderNo><DiscomCode xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /><OfficeCode>80980</OfficeCode><ScheduledForBillMonth xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /><ScheduledForBillYear xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /><TimeStamp xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /><TokenIssueDate xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /><TokenNo>90124</TokenNo><TotalConsumers xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /></Rdm_BillingDeterminants></BiliingDeterminants></MessageParts></Body></Envelope>
AifServiceProcessing Information: 0 : Return value from DynamicsAx : <;EntityKey xmlns="http://schemas.microsoft.com/dynamics/2006/02/documents/EntityKey"><KeyData><KeyField><Field>TokenNo</Field><Value>90124</Value></KeyField></KeyData></EntityKey>

 

happy Daxing Smile

Advertisements
 

Tags: ,

Unable to validate the AX 2009 Workflow Webservice URL on a Windows Server 2008 R2 x64-Error :The request failed with HTTP status 405: Method Not Allowed.

I have recently successfully installed Dynamics Ax 2009 Workflow.this is running on the following System configuration:
1. Windows 2008 R2 64 bit.
2. SQL Server 2008
3. IIS 7.5

However when i tried to Validate the workflow URL (e.g. http://jai-mdas-05/MicrosoftDynamicsAXWorkflow50/AxWorkItem.asmx in the AX Client (AX 2009 Client -> Administration -> Setup -> Workflow infrastructure configuration wizard) I got the following error:

The request failed with HTTP status 405: Method Not Allowed.

However when we browse one of the web service pages, AxWorkItem.asmx, we get the following error:

"HTTP Error 404.17 – Not Found. The requested content appears to be script and will not be served by the static file handler"

i have done lots of Google searches to find out this error resolution and got to know that it is usually occurs when you have the 4.0 .NET framework installed on the machine.  The workflow web services are built with version 2.0 of .NET.  IIS has associated the workflow web service files with the 4.0 file handler and the services are not functional with that handler.

This indicates we have an asp.net handler issue and it cannot find the correct handler to process the .asmx file. So looking at the handler mappings for the MicrosoftDynamicsAXWorkflow50 application, identified that there was only one *.asmx handler and this was mapped to ASP.NET 4.0 (C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll)

 

image

 

 

To solve the issue, I basically have gone through following steps:

1. Deleted MicrosoftDynamicsAXWorkflow50 Application directory in IIS, under the default web site.

2.create a “Virtual Directory” to the same site and named the new virtual directory with the same name of the deleted application.

3.set the  physical path  as “D:\Program Files\Microsoft Dynamics AX\50\Workflow“of the newly created virtual directory named MicrosoftDynamicsAXWorkflow50 .This folder contains the web services of AX workflow.i have done dynamics ax installation in D Drive.most probably it will be in “C:Program FilesMicrosoft Dynamics AX50Workflow“.

4.Now select the virtual directory named MicrosoftDynamicsAXWorkflow50 and  by right-clicking that directory and clicking “Convert to Application”

5.then select the application and double click ”Authentication” and I insured that “ASP.NET Imporsenation” ,“Windows Authentication”and “Anonymous Authentication” are enabled and remains should be disabled.

6.Now went to the “Handler Mapping” of the Workflow Application. I selected “WebServiceHandlerFactory-ISAPI-2.0″ and then clicked “Edit”. I insured that the “Executable” path is pointing to the %windir%\Microsoft.NET\Framework64\v2.0.507\aspnet_isapi.dll.

Note:by default  the “Executable” path is pointing to the %windir%\Microsoft.NET\Framework\v2.0.507\aspnet_isapi.dll.

7.“Basic Authentication” should be disabled,otherwise you may face below error

 

image

 

 

Smile Happy Daxing

 
Leave a comment

Posted by on October 22, 2012 in Microsoft Dynamics AX, Workflow

 

Tags: ,

Error:Update reference of Web service Wsdl

today i was facing the  trouble while updating the service reference in visual studio 2010. 

The following errors can be occurs because of the points mentioned below:

1. IIS is not running

2.Web service namespace has been changed.

3.Endpoint Address and Binding is changed

 

 

image

 
Leave a comment

Posted by on October 10, 2012 in Visual Studio, Web Service

 

Tags: ,

Ax error " A user session on the server could not be created. Try to start the client again. If the problem continues contact Ax Administrator

 

 

today we are having trouble with logging onto our Ax system.  The following errors occurs:

A user session on the server could not be created.  Try to start the client again.  If the problem continues contact Ax Administrator

 

this error is coming because of  AOS has no access to createusersessions stored procedure in the database.

 

finally got the conclusion that  the transaction log of the dbase is full, which will cause your login session to fail as well and throw the error

” A user session on the server could not be created. Try to start the client again. If the problem continues contact Ax Administrator”

 

 

the solution of this problem for

 

SQl Server 2008



EXEC sp_helpdb [DatabaseName]
ALTER DATABASE [Database Name] SET RECOVERY SIMPLE
go
DBCC
SHRINKFILE(Database_log)
go
Alter Database [Database Name] Set Recovery Full

EXEC sp_helpdb [DatabaseName]

 

 

SQL Server 2005

USE [DatabaseName];
GO;
SELECT file_id, name FROM
sys.database_files;

Backup log [DatabaseName] with Truncate_only;

DBCC Shrinkfile(DatabaseName_log)

 

SQL SERVER – Find Current Location of Data and Log File of All the Database

SELECT name, physical_name AS current_file_location

FROM sys.master_files

 
4 Comments

Posted by on October 9, 2012 in Microsoft Dynamics AX, SQL SERVER

 

Tags: ,

AIF Web Service actions(Find,Read, etc.) lost after recreating service in Dynamics AX 2009

When you delete service objects (classes, macros, service node…) and recreate the service you may have run into the issue that none of the service operations were visible.

Here’s how I solved it today when having the same issue. (We had to remove everything or else the problem was not solved) 

The problem is that the actions are not gone, but they were linked incorrectly. The AIFAction table contains the operations and also contains the classId of the class where the methods to handle the actions are. 

image

 

Well as the service objects were deleted and afterwards recreated, the class ID of the service class had been altered. Due to this changed ID, none of the operations were visible on the service. 

To fix this, just delete the current records in the AIFAction table for the corresponding service and then we can recreate the actions by calling the AIFServiceGenerationManager class,
method RegisterService.

AIFServiceGenerationManager::registerService("RdmCrmQueryService");

 
Then we can see the operations again in the services form.
 
 image

 

Tags: , ,

How to resolve int/real with 0/0.00 values via AIF outbound integration with external application

there is known issue with Dynamics Ax AIF Does not serialize the integer or Real values like when table fields having values 0/0.00. it will always return the null values and does not allow to update these values.

Scenario 1.

Table XYZ

Fields

X1(String),X2(Int),X3(Real) having values

X1=Deepak ,X2=0,X3=0.0

when you will try to execute the  AIF find operation it will return the data set fields values “Deepak”,Null,Null respectively fields X1,X2,X3. it will not allow to update the null values while execution of AIF Update Operation.

Scenario 2

X1=Deepak ,X2=2,X3=2.0

when you will try to execute the AIF find operation it will return the data set fields values “Deepak”,2,2.0 respectively fields X1,X2,X3. it will allow to update with null values as well as other values while execution of AIF Update Operation.

but when you will update these values with null or zero then it wont allow you update the values and got stuck in first scenario.

 

this is a known limitation that AIF does not serialize null values in outbound XMLs. If the outbound document has int or real fields with value 0 or 0.0, they would not appear in the outbound XML generated by AIF. The reason is that AX does not have null values so default values (0 for int, 0.00 for real, ‘’ for strings) for each type are treated as nulls and are not serialized by outbound operations.

 

There are some workarounds for this limitation. If you want a field to be serialized irrespective of its value, you need to make it a “required” field. This can be done in two ways:

– Make field mandatory at table level ie. In AOT , set the field property ‘Mandatory’ to Yes.

– Make the field mandatory at service level.

Making a field mandatory at the table level affects all the consumers of the table such as forms. The second way is less intrusive since it only affects services stack.

 

This article demonstrates shows how to make a field mandatory at service level.To demonstrate this i have created a table named CrmTable having fields (SanctionLoad(Real),PeakLoad(Real),Multiplyfactor(Real),Account(String),qty(Int)), and run the Application Integration Framework wizard.

Now we are  using CrmTableQueryService document service with operations find,Create,Update.

 

Now we will try to consume this web service though .Net Application,whenever we will  try to run the first scenario it will through the error because the xml file does not contains the  Real and Interger values fields.we can Check the resulting xml in Basic->Periodic->AIF->Document Schema. The outbound xml in this case does not contain the tag ‘Sanction Load,Peak Load,Multiply factor, Qty  since its value is 0.00/0.

As you would have observed that the ‘the fields property are missing from the outbound xml. Let’s apply workaround #2 – of making fields mandatory for CrmTableQueryService by following steps:

 

1. Open the document class for CrmTableQueryService service – AxdCrmQueryTable . Override method initMandatoryFieldsMap() from the AxdBase in AxdCrmQueryTable class

2. Update method body as

protected void initMandatoryFieldsMap()

 

 {

 

 super();

 

 this.setParmMethodAsMandatory(classNum(AXCrmTable),methodStr(AxCrmTable,parmSanctionLoad));

 

 }

For more information about the initMandatoryFieldsMap method, see http://msdn.microsoft.com/en-us/library/axdbase.initmandatoryfieldsmap.aspx .

3. Here AxCrmTable is the AxBC class for the table that contains the field and parmSanctionLoad is the name of the field parm method.

4. Compile the method.

5. Register the service again by right clicking the service node in AOT and selecting ‘Register Service’

6. Stop and restart the AOS to flush all caches.

7. Click on View Schema button on Document Data Policies form for the outbound port. The updated schema now shows ‘Sanction Load’ as a mandatory field.

image

 

9. Send another request to the outbound port with Sanction Load= 0.00.

 

10. Open the outbound xml and  this time you will see the Sanction Load property in the output xml.

 

image

 

 

Happy Daxing Open-mouthed smile

 

Tags: ,