web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Error while deserializing contract class

(0) ShareShare
ReportReport
Posted on by 30

While passing JSON from Postman hitting this,

"Message""An exception occured when deserializing the request - Exception occurred when parsing and deserializing parameter 'WLKCustomerReceiptStageList' - 'Error while deserializing contract class'",
My Contract is
[DataContractAttribute]
class WLKCustomerReceiptStageConract
{

    AccountNum              customerCode;
    LedgerJournalTransTxt   description;
    Amount                  receiptAmount;
    CurrencyCode            currency;
    ExchRate                exchangeRate;
    InvoiceId               invoiceNo;
    PaymMode                methodOFPayment,collectionCenter;
    TransDate               transDate,chequeDate; 
    WLKCustReceiptLocation  location;
    WLKIntegrationStatus    status;
    Notes                   log;
    PaymReference           paymReference; 
    PaymId                  bankName; 
    BankCentralBankPurposeCode  bankCode; 
    Voucher                 voucher; 
    [DataMemberAttribute('BankCode')]
    public BankCentralBankPurposeCode parmBankCode(BankCentralBankPurposeCode _BankCode = bankCode)
    {
        bankCode = _bankCode;
    
        return bankCode;
    }

    [DataMemberAttribute('BankName')]
    public PaymId parmBankName(PaymId _bankName = bankName)
    {
        bankName = _bankName;
    
        return bankName;
    }

    [DataMemberAttribute('ChequeDate')]
    public TransDate parmChequeDate(TransDate _chequeDate = chequeDate)
    {
        chequeDate = _chequeDate;
    
        return chequeDate;
    }

    [DataMemberAttribute('CollectionCenter')]
    public PaymMode parmCollectionCenter(PaymMode _collectionCenter = collectionCenter)
    {
        collectionCenter = _collectionCenter;
    
        return collectionCenter;
    }

    [DataMemberAttribute('Currency')]
    public CurrencyCode parmCurrency(CurrencyCode _currency = currency)
    {
        currency = _currency;
    
        return currency;
    }

    [DataMemberAttribute('CustomerCode')]
    public AccountNum parmCustomerCode(AccountNum _customerCode = customerCode)
    {
        customerCode = _customerCode;
    
        return customerCode;
    }

    [DataMemberAttribute('Description')]
    public LedgerJournalTransTxt parmDescription(LedgerJournalTransTxt _description = description)
    {
        description = _description;
    
        return description;
    }

    [DataMemberAttribute('ExchangeRate')]
    public Exchrate parmExchangeRate(Exchrate _exchangeRate = exchangeRate)
    {
        exchangeRate = _exchangeRate;
    
        return exchangeRate;
    }

    [DataMemberAttribute('InvoiceNo')]
    public InvoiceId parmInvoiceNo(InvoiceId _invoiceNo = invoiceNo)
    {
        invoiceNo = _invoiceNo;
    
        return invoiceNo;
    }

    [DataMemberAttribute('Location')]
    public WLKCustReceiptLocation parmLocation(WLKCustReceiptLocation _location = location)
    {
        location = _location;
    
        return location;
    }

    [DataMemberAttribute('Log')]
    public Notes parmLog(Notes _log = log)
    {
        log = _log;
    
        return log;
    }

    [DataMemberAttribute('MethodOfPayment')]
    public PaymMode parmMethodOfPayment(PaymMode _methodOfPayment = methodOfPayment)
    {
        methodOfPayment = _methodOfPayment;
    
        return methodOfPayment;
    }

    [DataMemberAttribute('PaymReference')]
    public PaymReference parmPaymReference(PaymReference _paymReference = paymReference)
    {
        paymReference = _paymReference;
    
        return paymReference;
    }

    [DataMemberAttribute('ReceiptAmount')]
    public Amount parmReceiptAmount(Amount _receiptAmount = receiptAmount)
    {
        receiptAmount = _receiptAmount;
    
        return receiptAmount;
    }

    [DataMemberAttribute('Status')]
    public WLKIntegrationStatus parmStatus(WLKIntegrationStatus _status = status)
    {
        status = _status;
    
        return status;
    }

    [DataMemberAttribute('Date')]
    public TransDate parmTransDate(TransDate _transDate = transDate)
    {
        transDate = _transDate;
    
        return transDate;
    }

    [DataMemberAttribute('Voucher')]
    public Voucher parmVoucher(Voucher _voucher = voucher)
    {
        voucher = _voucher;
    
        return voucher;
    }

}
 And my service class is 
[
         AifCollectionTypeAttribute("WLKCustomerReceiptStageList",Types::Class, classStr(WLKCustomerReceiptStageConract)),
        AifCollectionTypeAttribute("return",Types::Class, classStr(WLKCustomerReceiptStageConract))
    ]
    
    public List CreateCustomerReceipts(List WLKCustomerReceiptStageList)
    {
        ListIterator    iterator;
        ListEnumerator  enumerator;
        ListIterator    literator;
        WLKCustomerReceiptStageTable  wlkCustomerReceiptStageTable;
        #OCCRetryCount
        wlkCustomerReceiptStageConract       wlkCustomerReceiptStageConract;
    
        autoPostJournal = true;
    
        enumerator = WLKCustomerReceiptStageList.getEnumerator();
    
        try
        {
            ttsBegin;
            while(enumerator.moveNext())
            {
                wlkCustomerReceiptStageConract  = enumerator.current();
    
                if (wlkCustomerReceiptStageConract != null)
                {
                    wlkCustomerReceiptStageTable = this.createCustomerReceiptStage(wlkCustomerReceiptStageConract);
                    wlkCustomerReceiptStageConract.parmStatus(wlkCustomerReceiptStageTable.Status);
                    wlkCustomerReceiptStageConract.parmLog(wlkCustomerReceiptStageTable.Log);
                }
            }
    
    
           
    
    
            ttsCommit;
        }
         catch (Exception::Deadlock)
        {
            if (xSession::currentRetryCount() >= #RetryNum)
            {
                throw Exception::Deadlock;
            }
            else
            {
                retry;
            }
        }
        catch (Exception::UpdateConflict)
        {
            // try to resolve update conflict
            if (appl.ttsLevel() == 0)
            {
                if (xSession::currentRetryCount() >= #RetryNum)
                {
                    throw Exception::UpdateConflictNotRecovered;
                }
                else
                {
                    retry;
                }
            }
            else
            {
                throw Exception::UpdateConflict;
            }
        }
        catch(Exception::DuplicateKeyException)
        {
            // retry in case of an duplicate key conflict
            if (appl.ttsLevel() == 0)
            {
                if (xSession::currentRetryCount() >= #RetryNum)
                {
                    throw Exception::DuplicateKeyExceptionNotRecovered;
                }
                else
                {
                    retry;
                }
            }
            else
            {
                throw Exception::DuplicateKeyException;
            }
        }
    
        return WLKCustomerReceiptStageList;
    }
my JSON is,
{
    "WLKCustomerReceiptStageList":[
        {
            "BankCode":"Test",
            "BankName":"Test BAnk",
            "ChequeDate":"",
			"CollectionCenter":"",
            "Currency":"AED",
            "CustomerCode":"CA028007",
            "Description":"Testing Invoice Payment Integration",
            "ExchangeRate":2,
            "InvoiceNo":"INV103401/28",
            "Location":"HOC1 Cash",
			"Log":"",
            "MethodOfPayment":"Cash",
            "PaymReference":"",
            "ReceiptAmount":"100.0",
			"Status":"",
            "Date":"2023-04-13T12:00:00Z",
            "Voucher":"FHO011999/22"
           
        }
    ]
}
I have the same question (0)
  • Suggested answer
    huijij Profile Picture
    19,811 on at

    Hi Anoop B,

    You must correctly specify the AifCollectionTypeAttribute attribute to use an X collection as a parameter to a service operation or as a return value. Please note the use of '' rather than "".

    [
             AifCollectionTypeAttribute('WLKCustomerReceiptStageList',Types::Class, classStr(WLKCustomerReceiptStageConract)),
            AifCollectionTypeAttribute('return',Types::Class, classStr(WLKCustomerReceiptStageConract))
        ]

  • huijij Profile Picture
    19,811 on at

    Hi Anoop B,

    If you have any other questions, please let us know.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 512 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 386

#3
Adis Profile Picture

Adis 259 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans