1

getList method for SOAP API XML response has data but returning incorrect content type:

Content-Type: application/json; charset=UTF-8

I can see all the data fine if I print $searchResults on return Error: Parse Error: Expected HTTP after investigating I can see Content-Type: application/json; charset=UTF-8. It seem that is set content-type wrong not sure how to set content type for XML application/soap+xml; charset=utf-8 or magento does automatically ?

Same call for rest it's ok but need to change the return type for xml!

Thanks.

1 Answer 1

0

Found out what caused the return type to be json. Basically this only seem to happened for getList searchCriteria on SOAP only and all other methods had no issue for SOAP and REST.

It was getter and setter not matching the database field, I had my getter and setter as E.G:

getDescriptions()
setDescriptions($description)

For some reason for this specific SOAP call on getList searchCriteria is expected the setter and getter to match the DB field name :

const DESCRIPTION           = 'description';

So once I modified to:

getDescription()
setDescription(description)

Take notice the letter S previously and this was the problem.

But it's only an issue for this specific SOAP request!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.