Skip to main content

Notifications

Announcements

No record found.

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

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans