Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Pass credentials when consuming web service from Ax 2012

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

  • Martin Dráb Profile Picture
    Martin Dráb 229,918 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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,113 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,918 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans