web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Pass credentials when consuming web service from Ax 2012

(0) ShareShare
ReportReport
Posted on by 150

Hello

I get an error 401 - not authenticated when calling a web service from within Ax 2012. I not allowed to call the web service as "Anonynous" as I am doing not.

How can I pass credentials to the 'client'?

Best regards
Lars

 

 

CodeAccessPermission permission;

System.Exception ex;

 

 

;

 

permission =

 

 

new

InteropPermission(InteropKind::ClrInterop);

permission.assert();

 

 

 

 

 

// Always try and catch errors as CLR exceptions

 

 

 

try

{

 

 

 

// Retrieve the X++ type for the service client object.

clientType = CLRInterop::getType(

 

 

"CmsService.GN.Services.CmsServiceSoapClient"

);

 

 

 

 

 

 

// Use the AifUtil class to create an instance of the service client object.

_client = AifUtil::CreateServiceClient(clientType);

 

request =

 

 

new

CmsService.GN.Services.GetThirdPartyProductsRequest();

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    236,960 Most Valuable Professional on at
    Re: Pass credentials when consuming web service from Ax 2012

    AFAIK you should set the appropriate credential type (e.g. NTLM) in app.config of your WCF client application, i.e. in your VS project.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 3

#3
Community Member Profile Picture

Community Member 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans