We are getting error 500 while trying to use some of our custom services in D365FO , same services where working fine in AX 2012 , when i checked the issue i noticed that when we return a class as a return type service not working but if we return string or another type it is it working fine , you can check the below sample :
XXXX.devaos.sandbox.ax.dynamics.com/.../SMCIntegrationWorkerPaySlipDataSvcGroup
AutoDeploy is active in service group and all classes decorated with DataContractAttribute and DataMemberAttribute
If we return anytype or string in the below service it is working fine ,
[
AifCollectionTypeAttribute('_paySlipContract', Types::Class, classStr(SMCIntegrationWorkerPaySlipContract)),
AifCollectionTypeAttribute('return',Types::Class,classStr(SMCIntegrationWorkerPaySlipResponse))
]
public SMCIntegrationWorkerPaySlipResponse getPaySlip(SMCIntegrationWorkerPaySlipContract _paySlipContract)
{
SMCIntegrationWorkerPaySlipResponse response = new SMCIntegrationWorkerPaySlipResponse();
SMCHcmWorkerProduct hcmWorkerProduct;
SMCHcmWorkerEmploymentType hcmWorkerEmploymentType;
SMCHcmWorkerPaySlipExclude hcmWorkerPaySlipExclude;
SMCIntegrationWorkerPaySlipDataSvc::validate(_paySlipContract);
// Code removed
return response;
}
Sample of return class
[DataContractAttribute]
public class SMCIntegrationWorkerPaySlipResponse
{
str bankAccount;
[DataMemberAttribute]
public str bankAccount(str _bankAccount = bankAccount)
{
bankAccount = _bankAccount;
return bankAccount;
}
// Code removed
}