Friday, December 19, 2008

Comunicate Ax 4.0 and .Net Application using BusinessConnector

If you try to connect an application from .NET with Axapta 4.0, you can do it using the BusinessConnector, which come with the Ax Client.

Supose you have the following method on an Ax Class called TestClass:

int SumNet(int a, int b)
{
;
return a + b;

}

To execute the method SumNet from a .NET Application you need to do the following:

1. Create a proyect on Visual Studio .NET (2005 or 2008)

2. On the proyect add reference, and on the dialog, choose browse. Locate the folder where the Ax client is installed, and in the folder Bin, select and add the reference to the Microsoft.Dynamics.BusinessConnectorNet.dll

3. Use the following code from the .NET Proyect to call the method:

//Create the Axapta object to connect with Ax
Microsoft.Dynamics.BusinessConnectorNet.Axapta ax = new Microsoft.Dynamics.BusinessConnectorNet.Axapta();

//Create the object to represent the TestClass from Ax on .NET
Microsoft.Dynamics.BusinessConnectorNet.AxaptaObject axObj;

//Logon on Axapta
ax.Logon(null, null, null, null);


//Create an instance for the class
axObj = ax.CreateAxaptaObject("TestClass");

//Create object to be the parameters used in the call to the class on Axapta.
object[] obj = new object[2];
obj[0] = 5;
obj[1] = 13;

//Call the method SumNet on Ax for the class TestClass
int nResult = (int)axObj.Call("SumNet", obj);

//Show the result
MessageBox.Show(nResult.ToString());

//Don't forget do the LogOff on Axapta
ax.Logoff();


In this example, we supose that the Ax Client is configured to the correct AOS and the user has permission to use Axapta, in other case, in the method LogOn you need to specify other parameters to make the correct logon.



That's all, it's easy.

Monday, November 24, 2008

Config ISA Server 2006 to allow SSL on a port different of 443 and 563

By default, SSL work on port 443 and 563, when you need access and URL using SSL with differnt port and using ISA Server 2006, you need to configurate the Web Proxy to allo that port.

For that, create a file with the extension .vbs and copy the next code to the file:

' Define the constants needed.
Const NewRangeName = "SSL 3520"
Const NewRangePort = "3520"
' Create the root object.
Dim root ' The FPCLib.FPC root object
Set root = CreateObject("FPC.Root")
'Declare the other objects needed.
Dim isaArray ' An ISA Server array object
Dim tpRanges ' An FPCTunnelPortRanges collection
Dim newRange ' An FPCTunnelPortRange object
' Get a reference to the array and to
' the collection of tunnel port ranges.
Set isaArray = root.GetContainingArray()
Set tpRanges = isaArray.ArrayPolicy.WebProxy.TunnelPortRanges
' Create a new tunnel port range.
Set newRange = tpRanges.AddRange(NewRangeName, NewRangePort, NewRangePort)
' Save the changes to the collection of tunnel port ranges
' with fResetRequiredServices set to True to restart the Firewall service.
tpRanges.Save True

'end file



Before save the file, replace the number 3520 for the desired port number, i.e. 4886, save the file and execute on the server where ISA Server is running.


That's all.

Thursday, November 13, 2008

Sharepoint Crawl schedule

The sharepoint uses a crawl schedule to index the files uploaded, by default, this crawl task run every 5 minutes.
If you have the SharePoint Database on a shared server, maybe the performance is down, because this task use the HDD.

To avoid this, you can change the Schedule, going to the Central Administration -> Operations -> Services on Server -> Windows Sharepoint Services Search, and modifiying the Indexing Schedule.

Wednesday, September 24, 2008

Error showed when start Axapta 4.0 client referent to the ActiveX Control CmxPhone.

When axapta client is started, and an error messaje is showed like the following:

Unable to create ActiveX Control.
CmxPhone Control

With that message, axapta can run but always the message is showed. To correct the problem, is neccesary do the following steps:

  • Go to Start->Run and type cmd to load the command window.
  • run the following command: regsvr32 c:\Program Files\Microsoft Dynamics Ax\40\Client\Bin\smmPhone.ocx (Suppose that the client is installed on the path c:\Program Files\Microsoft Dynamics Ax\40\Client, else, use the path where the Ax Client is installed and use the Bin Folder)

If the control is registered without any problem, the message won't be showed again.

Monday, August 25, 2008

Error showing reports for Team Projects on Team Site, when Team Foundation Server is installed on different server that WSS

When you have the following:

  • Team Foundation Server installed on ServerA
  • Windows Sharepoint Services installed on ServerB
  • Reporting Services installed on ServerC (or ServerA or any Server different of ServerB)
  • Assume you are creating Team Projects on WSS using the Uri http://ServerB/Sites

And you create a Team Project on TFS, which is configured to use WSS 3.0 (maybe it works onf WSS 2.0), maybe the following error message is showed when the page tries to display the reports:

The following registry key is not set: HKLM\Software\Microsoft\VisualStudio\9.0\TeamFoundation\ReportServer\80\Sites for Uri /Sites/[ProjectName]/_layouts/tfsredirect.aspx?IsReport=1&ReportName=Remaining+Work

This is 'cause the ServerB, where is installed WSS need to know the Uri for the Report Server to redirect you, on this case, you need to create the following key on the registry for the ServerB (where WSS is installed)

  • HKLM\software\Microsoft\VisualStudio\9.0\TeamFoundation\ReportServer\80\Sites

After created it, create the following String Values:
  • BaseReportsUrl with value http://ServerC/Reports
  • ReportsService with value http://ServerC/reportServer

With that key and values, the problem is resolved.

The reason for this, is because the WSS try to redirect your report to the server when Report Service is working, and for that reason need those keys on the registry.

Thursday, August 21, 2008

Connect Visual Studio 2005 with Team Foundation Server 2008

Trying Team Foundation Server 2008, i found the need to use projects created on Visual Studio 2005 with TFS 2008, but i found a problem.

Attempting to create a Team Project, i get an error with the following message:

Plugin error text: "The language id specified in the process template does not exist on the WSS server"

Searching on the web, i found the solution and how can i configure Visual Studio 2005 to work with TFS 2008, just follow the next:

1. We need use the TFS Client for VS 2005, it's the Team Explorer 2005, download from here: Team Explorer 2005

2. The problem bellow is when VS and the Team Explorer try to create the site in SharePoint 3.0, but VS 2005 works with SharePoint 2.0, on this point, if you take a look to the path \Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies and look the version of the file Microsoft.VisualStudio.TeamFoundation.TeamExplorer.dll, this need to be at least the version 8.0.50727.804, so we need to install (or reinstall) the VS 2005 Service Pack 1, this install the Team Explorer 2005 SP 1 too.
After installed, check if the version of the library is 8.0.50727.804.

3. The last step is install a hotfix for Visual Studio 2005, with it, VS 2005 can comunicate with Sharepoint 3.0, the hotfix is VS80sp1-KB932544-X86-ENU.exe



Remember, you can't install the hotfix without installing VS SP1 and when you install the Team Explorer 2005, you need to reinstall the VS SP1, that's the reason why you need to install VS SP1 after Team Explorer and not only the hotfix.

That's All

Wednesday, August 20, 2008

Change SQL Version without uninstall

If you want to change the SQL version, i.e. SQL Express Edition To SQL Standard, you can do it using the following:

1. Put the DVD on the Drive.
2. Start the installation from the command line (supose the DVD Drive it's e:\) using the following:

e:\setup SKUUPGRADE=1

3. Follow the instruction. If the instance to be updated is named, like myserver\sqlinstance, use the same name for the current instalation.

4. After the installation, you need to install all the SP for SQL.

Friday, August 15, 2008

Use Google Maps to display a route

I will show how to display a route using google maps on a web site.

1. go to http://code.google.com/apis/maps/ and get a key for your web site, you need a google mail account, and write your web site address, if you are working locally, type the URL like http://mycomputername/, this is because the web site can be displayed from other computer on the network, if we use http://localhost/, we can only use the page locally. If you are using a public web site, use http://mywebsite/

2. With your key, add the following lines between the head tag of your web page:
<head>
<
script src="http://maps.google.com/maps?file=api&v=2&key=mykey" type="text/javascript"> < / script>


Note the key=mykey, where mykey is the key you got from the google.

3. Add the folowing script between the head tag too, of your web page:

<script type="text/javascript">
function initialize()
{
var map;
//Verify if the browser is compatible
if (GBrowserIsCompatible()) {
//Create the map object, for the div with id map_canvas
map = new GMap2(document.getElementById("map_canvas"));
//Set the center of the map and the initial zoom
map.setCenter(new GLatLng(5.971217,-74.95697), //Center
6 // zoom from 1 to 15
);
//Create the line secuence
var polyline = new GPolyline([
new GLatLng(6.252507, -75.583191),
new GLatLng(6.342597, -75.555725),
new GLatLng(6.247046,-75.421143),
new GLatLng(6.118708, -75.187683),
new GLatLng(5.971217,-74.95697),
new GLatLng(5.807292, -74.602661),
new GLatLng(5.20857,-74.742737),
new GLatLng(4.646920, -74.093170)], //Line points array
"#ff0000", //Color for the line
5 //width
);
map.addOverlay(polyline); //Add the line to the map
//Add mark for the start
map.addOverlay(new GMarker(new GLatLng(6.252507, -75.583191)));
//Add mark for the end
map.addOverlay(new GMarker(new GLatLng(4.658555, -74.100037)));
//Create the map control to show diferent type of the map
var mapControl = new GMapTypeControl();
//Add the control to the map
map.addControl(mapControl);
//Add zoom in/out control
map.addControl(new GLargeMapControl());
}
}
< /script>

4. Asign the onload event to the body, the function initialize:
<body onload="javascript:initialize();">


5. Add the following div to the body, the div size will be the size of your map window in the explorer:


<div id="map_canvas" style="width: 500px; height: 300px">< /div>


note the div id, is the same used when creating the map object.

that's all, browse your web and enjoy the google maps.