Hi
I am using Ax2009 and i need to access a custom service developed by me, however have not been successful so far.
So what i did is as below
1. i create a AOT class " A_ItemInfo"
2. Added method getItemName
public itemname getItemName(ItemID _ItemId)
{
return InventTable::find(_itemId).ItemName;
}
3. Created a service "A_ItemInfoService" added getItemName as a operation.
4. From Basic->Setup->AIF-> Services , selected the service i created in step 3 and clicked on the button generate, it created all necessary artifacts. Wsdl
5. In visual studio 2008, i created a new console application.
6. I added the service reference to the C# solution, using the wsdl link (ex : http://aif.tst.se/AIFTEST/itemservice.svc?wsdl)
7. Then i am wrote below piece of code using C# however it throws error
code looks like below
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using A_ItemInfoService.ItemInfoServiceRef;
namespace A_ItemInfoService
{
class Program
{
static void Main(string[] args)
{
ItemInfoServiceClient client = new ItemInfoServiceClient();
client.getItemName("A1001"); //
client.Close();
}
}
}
I get below run time exception at line client.getItemName("A1001");
" Request failed. More information is available in the exception log."
I also tried to write , in below fashion, however was not been successful. the same error is thrown.
client.ClientCredentials.Windows.ClientCredential.UserName = "UserName";
client.ClientCredentials.Windows.ClientCredential.Password = "Password";
client.ClientCredentials.Windows.ClientCredential.Domain = "Domain";
client.getItemName("A1001");
Can some one tell me, if i am missing something?
should i have to redirect visual studio 2008 to correct AOS?
Am i misisng some setup in aX2009?