Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

How can I build a sub XML elements in DataContract class.

Posted on by 362

Hi Everyone,

How to generate a sub XML elements through AX 2012 DataContract as shown below.

 

<LoginResponse>

   <CustId>1234ab5678</CustId>

   <Authentication>

       <ResponseId>400</ResponseId>

       <ReasonId>401</ReasonId>

       <Description>Customer not found</Description>

   </Authentication>

</LoginResponse>

 

 

Thank you

*This post is locked for comments

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,214 Most Valuable Professional on at
    RE: How can I build a sub XML elements in DataContract class.

    Data contract classes can be used at many places, but the tag suggest that you're talking about a custom service.

    The requested result can be achieved by using two data contract classes, one for LoginResponse and another for Authentication. LoginResponse will have two properties - a string for CustId and the data contract class for Authentication.

    Note that "Customer not found" doesn't sound like something related to authentication. It suggests that the request was authorized and performed but no data was found, which is not a problem about authentication.

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,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans