Hi All,
I have developed a custom service in AX 2012, in which the expected XML response schema should be as shown below.
<?xml version="1.0"?>
<LoginResponse>
<CustId>1234ab5678</CustId>
<EmailId>abc.xyz@gmail.com</EmailId>
<Authentication>
<ResponseCode>900</ResponseCode>
<ReasonCode>901</ReasonCode>
<ReasonDescription>Invalid Email Address</ReasonDescription>
</Authentication>
</LoginResponse>
However, the schema generated through the custom service is build with a slight differences where the order of the xml elements [CustID, EmailID, Authentication, ResponseCode, ReasonCode, Description] and the root element label name “WebServiceValidateLoginResponse xmlns='http://tempuri.org'” are incorrect when compared with the expected xml.
Generated Schema:
<?xml version="1.0"?>
<WebServiceValidateLoginResponse xmlns='http://tempuri.org'>
<Authentication>
<ReasonCode>901</ReasonCode>
<ReasonDescription>Invalid Email Address</ReasonDescription>
<ResponseCode>900</ResponseCode>
</Authentication>
<CustId>1234ab5678</CustId>
<EmailId>abc.xyz@gmail.com</EmailId>
</WebServiceValidateLoginResponse>
I Observe that, the elements in the generated schema are arranged in the alphabetic order.
To change the tag name, I have tried by changing the label for DataContract class in the [DataContractAttribute] and the same is updated in the Service reference, but in the xml schema it is not getting updated accordingly. And to get the xml elements in sequence as per the requirement I have tried changing the sequence of the parm methods using SysOperationDisplayOrderAttribute("1") in the data contract class and also changed the sequence in the service reference but still I am facing challenges in generating the xml schema.
Request you to help me out by sharing your ideas on the same. Thank you in advance.