3

looks like my question is the same as this one: Magento Rest Api Invalid XML but it is not still answered..

I just installed magento 1.9 with sample data on my localhost and trying to test REST API. I setted REST roles and REST attributes to ALL in admin panel. But when I trying to enter in browser the following URL: http://magentohost/api/rest/products?limit=2

I receive the response:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  <script/>
  <SOAP-ENV:Body>
    <SOAP-ENV:Fault>
      <faultcode>Sender</faultcode>
      <faultstring>Invalid XML</faultstring>
    </SOAP-ENV:Fault>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

error_log is empty,

access_log:

GET /magentohost/api/rest/products?limit=2 HTTP/1.1" 500

Looks like I missed something in settings.. Thanks for any help!

1
  • Just incase this helps someone - ensure the API key you've set doesn't include any special characters (along with the steps also mentioned as answers here) Commented Aug 11, 2021 at 14:56

3 Answers 3

5

You will need to edit your .htaccess file. On line 12 of .htaccess uncomment the line "Options -Multiviews".

Sign up to request clarification or add additional context in comments.

2 Comments

Why does the error occur when you don't have that line uncommented? (This solution doesn't work for me, but I want to understand the error better.)
From Apache docs "A Multiviews search (enabled by the Multiviews Options), where the server does an implicit filename pattern match, and choose from amongst the results." Magento needs to be able to search for files by name.
0

In case you are having a problem with getting the wsdl, make sure you have ?wsdl at the end of your url. For example:

https://dev2.mydomain.org/index.php/api/v2_soap/index/

Will say "Invalid XML" but

https://dev2.mydomain.org/index.php/api/v2_soap/index/?wsdl

will work.

Comments

0

In the case of a Magento soap client I generated for .Net Core C# (using this), I just had to create the client using the default constructor rather than providing the endpoint and binding myself. The default constructor sets up many parameters of the client, including the endpoint URL, security mode, allow cookies, etc.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.