I'm getting a SOAP error (v2, WS-I Compliant) that I'm having trouble debugging. I'm getting a "Receiver, Unknown Error", which the header shows to be a 500 Server Error and appears as such in my nginx logs:
127.0.0.1 - - [02/Jan/2015:18:20:18 +0000] "GET /index.php/api/v2_soap/index/?wsdl=1 HTTP/1.1" 200 354035 "-" "-"
12.123.1.12 - - [02/Jan/2015:18:20:18 +0000] "POST /index.php/api/v2_soap/index/ HTTP/1.1" 500 273 "-" "PHP"
I can do other calls, for instance a salesOrderInfo request will work, but this salesOrderCreateInvoice fails.
Any suggestions on how to debug something so vague?
LAST REQUEST HEADERS:
POST /index.php/api/v2_soap/index/ HTTP/1.1
Host: shop.example.com
Connection: Keep-Alive
User-Agent: PHP
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
Content-Length: 489
Cookie: PHPSESSID=q2fsubqee1r43kdoa1v3o3eai0;CUSTOMER=deleted;CUSTOMER_INFO=deleted;CUSTOMER_AUTH=deleted;
LAST REQUEST:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:Magento">
<SOAP-ENV:Body>
<ns1:salesOrderInvoiceCreateRequestParam>
<sessionId>2cb4af977b083e51b64e1a2f156136fa</sessionId>
<invoiceIncrementId>200000255</invoiceIncrementId>
<itemsQty>
<complexObjectArray>
<order_item_id>985</order_item_id>
<qty>1</qty>
</complexObjectArray>
</itemsQty>
</ns1:salesOrderInvoiceCreateRequestParam>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
LAST RESPONSE HEADERS:
HTTP/1.1 500 Internal Service Error
Server: nginx/1.6.2
Date: Fri, 02 Jan 2015 16:33:05 GMT
Content-Type: text/xml; charset=utf-8
Content-Length: 273
Connection: keep-alive
X-Powered-By: PHP/5.4.33
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: PHPSESSID=q2fsubqee1r43kdoa1v3o3eai0; expires=Fri, 02-Jan-2015 16:48:04 GMT; path=/; domain=shop.example.com; secure; httponly
Set-Cookie: CUSTOMER=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/; domain=shop.example.com; secure; httponly
Set-Cookie: CUSTOMER_INFO=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/; domain=shop.example.com; secure; httponly
Set-Cookie: CUSTOMER_AUTH=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/; domain=shop.example.com; secure; httponly
LAST RESPONSE:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>Receiver</faultcode>
<faultstring>Unknown error</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Best Answer
My tips for debugging SOAP calls:
Disable WSDL Cache
Under System > Configuration > Magento Core API set Enable WSDL Cache to "No".
Write a basic PHP script for your calls
Debug SOAP request/response
You can debug with
$client->__getLastRequest()
or$client->__getLastResponse()
Check your logs for any error messages/notices
Check if there are any SOAP call error messages in your logs that might help tracing down the problem.
Debug
If nothing helps, check what data is received by the API. Check out the
Api.php
and/orApi/V2.php
files of the specific modules.