I just started working on xamarin not long ago.
Now I met a problem on Xamarin consuming AX2012 Webservice.
I’m in a project that need an android device connect with AX2012 R3 Inbound port.
I made a very simple webservice like below and tested successfully by using C# project.
AX Webservice code
[SysEntryPointAttribute(true)]
public ItemNameAlias GetItemName(ItemId itemId)
{
return InventTable::find(itemId).NameAlias;
}
C# invoke code(successful)
static void Main(string[] args)
{
TestWebservice.TestWebserviceClient client = new TestWebservice.TestWebserviceClient();
TestWebservice.CallContext cpny = new TestWebservice.CallContext() { Company = "USMF" };
client.ClientCredentials.Windows.ClientCredential.UserName = @"sagcn\wangy";
client.ClientCredentials.Windows.ClientCredential.Password = "aoc-111";
string itemName = client.GetItemName(cpny, "C0004");
Console.WriteLine($"Item Name: {itemName}");
Console.ReadKey(false);
}
When I add this service reference to an Xamarin.form project, it was been used very like in C# project. But when the code invoked the webservice function, it throws a System.NotImplementedException exception. System.NotImplementedException Message=The method or operation is not implemented.
Xamarin code (throw NotImplementedException exception)
private void Button_Clicked(object sender, EventArgs e)
{
string itemName = "";
Debug.WriteLine("Start");
ASMXService.TestWebserviceClient client = new ASMXService.TestWebserviceClient();
ASMXService.CallContext cpny = new ASMXService.CallContext() { Company = "USMF" };
client.ClientCredentials.Windows.ClientCredential.UserName = @"sagcn\wangy";
client.ClientCredentials.Windows.ClientCredential.Password = "aoc-111";
// throw exception here
itemName = client.GetItemName(cpny, "C0004");
Debug.WriteLine($"Item Name: {itemName}");
Debug.WriteLine("End");
}
I searched many places but still don’t know the reasons why.
Does anyone have the same experience or can give me some advice?
Thanks a million.