Open bch36 opened 4 years ago
@bch36 : Thanks for code suggestions. We will test this change and provide an update.
@bch36 : We can tweak the setFaultHandler()
under IntuitResponse.php class to check if the response content type is text/xml
:
if($this->getResponseContentType() != null && (strcasecmp($this->getResponseContentType(), CoreConstants::CONTENTTYPE_APPLICATIONXML) == 0 ||
strcasecmp($this->getResponseContentType(), CoreConstants::CONTENTTYPE_TEXTXML) == 0))
I am not sure how this fix will help you. If your program wants to differentiate the error calls, you might need to pass throwonExcpetion as false
so that the latest error is captured in the DateService object as shown here
Ref : Customer Query
That fix will work great. The problem was that 401 responses from QuickBooks weren't being parsed because they used a different response content type than other errors, and this will fix that. I don't care about differentiating error calls, I just want all error responses to be consistently handled. Your fix will satisfy that. Thanks for looking into this!
On Tue, Sep 1, 2020 at 1:14 AM abisalehalliprasan notifications@github.com wrote:
@bch36 https://github.com/bch36 : We can tweak the setFaultHandler() under IntuitResponse.php class to check if the response content type is text/xml:
if($this->getResponseContentType() != null && (strcasecmp($this->getResponseContentType(), CoreConstants::CONTENTTYPE_APPLICATIONXML) == 0 || strcasecmp($this->getResponseContentType(), CoreConstants::CONTENTTYPE_TEXTXML) == 0))
I am not sure how this fix will help you. If your program wants to differentiate the error calls, you might need to pass throwonExcpetion as false so that the latest error is captured in the DateService object as shown here https://intuit.github.io/QuickBooks-V3-PHP-SDK/handle-error.html
Ref : Customer Query https://github.com/intuit/QuickBooks-V3-PHP-SDK/blob/master/src/_Samples/CustomerQuery.php
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/intuit/QuickBooks-V3-PHP-SDK/issues/351#issuecomment-684417978, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHSN7I4HOBNGI6CVMLOFSLTSDSGKXANCNFSM4QMJACXA .
Opening up our SDK for hacktoberfest contributions.
What is it? Hacktoberfest is underway right now and we would love for you to contribute 🚀 . More information on #hacktoberfest is here
In IntuitResponse.php, a fault response isn't parsed unless the content-type is "application/xml". However, for a 401 response, the content type is "text/xml." This results in the response not being parsed.
It seems like either the check should be updated in IntuitResponse.php::147, or responses should be sent using the content-type of "application/xml".
Current code:
if($this->getResponseContentType() != null && strcasecmp($this->getResponseContentType(), CoreConstants::CONTENTTYPE_APPLICATIONXML) == 0)
Example response with the unexpected content-type of text/xml:
My own workaround: