Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

Client credential in consuming service

Posted on by Microsoft Employee

Hi Experts,

I have consumed the webservice in ax 2009 and able invoke all classes and methods ,by creating a reference in vs.They provided the url with basic authentication. My question is do i need to hardcode the username and pwd in config file  or  in endpoint if so how? .At the time of creating a service reference i gave the credentials copied the .dll in client and server (both the dll and config).

Kindly guide me if i am following the wrong steps

Thanks,

Anbu

  • Martin Dráb Profile Picture
    Martin Dráb 230,198 Most Valuable Professional on at
    RE: Client credential in consuming service

    I'm sorry, but there is nothing we can do for you if you tell us virtually nothing about your problem.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Client credential in consuming service

    Hi,

    CLR Object cannot be created ,getting this error from morning. Any idea.

  • Martin Dráb Profile Picture
    Martin Dráb 230,198 Most Valuable Professional on at
    RE: Client credential in consuming service

    Sorry, it's years since I've seen AX 2009 for the last time and I typically didn't use AOT references anyway. If I was you, I would use what we discussed above, i.e. setting binding in code.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Client credential in consuming service

    Will there be any issue in connecting https  or http with basic authentication in ax2009. In AOT service reference it didn't allow me to add .

    For https , i got tls/ssl trust relationship error.

    For http - i got 401 unauthorised error.

    Kindly give your comments on this.

  • Martin Dráb Profile Picture
    Martin Dráb 230,198 Most Valuable Professional on at
    RE: Client credential in consuming service

    Please show us your code.

    Use Insert > Insert Code (in the rich-formatting view) to paste it here.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Client credential in consuming service

    I set up the end point  and binding in my class library , but still getting the same error.

  • Martin Dráb Profile Picture
    Martin Dráb 230,198 Most Valuable Professional on at
    RE: Client credential in consuming service

    As I said in my second reply, the solution you've decided to use means that the configuration file will be ignored.

    Copying it anywhere won't help; it won't get loaded into AX.

    Either do the setup in code (as we discussed above) or add a service reference to AOT. Note that the latter approach sometimes causes problems with exception handling and it doesn't give you as much control.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Client credential in consuming service

    Ok,So i create a public method in class library and able to invoke that in x++, I'm getting error "Could not find default endpoint element that references contract 'MyReference.WebServiceProviderPortType' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.

    Do I need to copy the config file to ax bin folder

  • Martin Dráb Profile Picture
    Martin Dráb 230,198 Most Valuable Professional on at
    RE: Client credential in consuming service

    Indeed, that's specific to AX 2012. You can't use it in AX 2009.

    As mentioned before, AX 2009 allows you to add a service reference to AOT, or you can do what you did - creating a reference in Visual Studio and deplying the DLL by yourself.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Client credential in consuming service

    I followed the link community.dynamics.com/.../windows-credentials-in-aif-service-client

    But in AX2009 I dont find the below method createServiceclient.

    Can you help me on this.

    serviceClient = AifUtil::createServiceClient(serviceClientType);

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 Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans