Thursday, May 30, 2019

AX 2012 VAT HMRC integration error "HMRC service returned error code 406"

When we try to retrieve VAT obligations we will end up with an error "HMRC service returned error code 406".

We need to change the below code.

Add the below code in RetailCommonWebAPI class

        if (strLen(_request.parmAcceptEncoding()) > 0)
        {
            headers.Add(_request.parmAcceptEncoding());
        }

        if (strLen(_request.parmAccept()) > 0)
        {
            request.set_Accept(_request.parmAccept());
        }

and 
        this.initRequestClientCertificates(_request.parmClientCertificates(), request);