Skip to content

Instantly share code, notes, and snippets.

@ryaan-anthony
Created December 17, 2015 15:20
Show Gist options
  • Save ryaan-anthony/9d1d98fcf14078b77e96 to your computer and use it in GitHub Desktop.
Save ryaan-anthony/9d1d98fcf14078b77e96 to your computer and use it in GitHub Desktop.
Using CURL to make SOAP requests with Magento 1.x
$ cat login.xml
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<MAGE:login xmlns:MAGE="http://xxxxxx/api/v2_soap/?wsdl=1">
<MAGE:username>xxxxxx</MAGE:username>
<MAGE:apiKey>xxxxxx</MAGE:apiKey>
</MAGE:login>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
$ curl --data @login.xml http://xxxxxx/api/v2_soap
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:Magento" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:loginResponse>
<loginReturn xsi:type="xsd:string">xxxxxx</loginReturn>
</ns1:loginResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
@ryaan-anthony
Copy link
Author

Use the session id provided in loginReturn to formulate your requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment