I have created a service class that should return the same data passed to the service (for testing purposes). The idea of hosting a web service on IIS instead of AOS is that I cannot use Windows authentication, as this service will be used by different domain users.
This service has been exposed and I created an HTTP Inbound port, set up as described here (https://blogs.msdn.microsoft.com/axsupport/2013/04/23/how-to-implement-basic-authentication-with-dynamics-ax-2012-web-services/). I am able to add the service reference in a visual studio console application, and I am also asked the credentials (which is what I need). the credentials are correct and accepted.
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using ConsoleApplication.H5PortalService; namespace ConsoleApplication { class Program { static void Main(string[] args) { TestServiceClient proxy = new TestServiceClient(); proxy.ChannelFactory.Credentials.UserName.UserName = @"username" proxy.ChannelFactory.Credentials.UserName.Password = "password"; CallContext context = new CallContext(); try { proxy.processString(context, "testRequest"); Console.WriteLine(); } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.ReadLine(); } } }
When I call the service (proxy.processString) I get an System.ServiceModel.FaultException error. IIS is configured ok and validated.
any ideas on how to resolve the issue?
Thanks
*This post is locked for comments
Found the solution. Was able to catch the exception that was being thrown by AX, and it seemed that the requested company could not be determined. I solved the issue by adding this line of code
context.company = "NLD";
that was all. Thanks
I will try the above suggestions thanks. I will post the solution here when I find it.
There are several things you can do.
First of all, make sure that your CIL and service references are up to date.
Get everything possible from the exception. Look at it in debugger and check its exact type, all fields etc. (It may be, and typically is, a subtype of FaultException with additional details).
Check event logs.
I would still use debugger to debug the service, to understand whether it fails before calling the service.
And if everything else fails, use tracing to analyze what exactly was called and where it failed.
That was my initial assumption as well, however, I have tested the same service using a simple netTCP inbound port instead of HTTP, and it worked just fine. Additionally, I created a very simple service class as below and I get the same exception result.
[SysEntryPointAttribute(true)]
public str processString(str _request)
{
return _request;
}
I beleive the issue is probably something to do with the service configuration, but I do not know what I have wrong or where to start unfortunately...
My assumption is that your service is called (without any authentication failure) but it throws an exception. If it's the case, debug your service to see where it fails.
The message is - "an error occured". Not really helpful.
When I was writing the post I believed it could be an authentication issue, but on further testing it seems that it is not.
Doesn't it have a message, at least?
If you agree that it's not about authentication, why did you set the title to "AX Web services authentication"?
I was not able to debug futher. Inner exception is null and the server stack trace System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc).
I dont believe it is an authentication issue, as when I enter incorrect credentials, I get an authentication exception instead.
What is inside the FaultException? Is it really something about authentication?
André Arnaud de Cal...
291,971
Super User 2025 Season 1
Martin Dráb
230,846
Most Valuable Professional
nmaenpaa
101,156