Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging a SOAP service using xDebug

Tags:

php

soap

xdebug

Is there a way to debug a SOAP service that we publish ideally with integration into an IDE allowing me to step through the code.

like image 525
Rob Forrest Avatar asked Dec 06 '13 11:12

Rob Forrest


People also ask

How do I debug a SOAP Web service in Salesforce?

Debug Web service callouts with SOAP UIDownload the WSDL of the external system, make the call with all the required parameters and see if you get a valid response, if so then it might some issue with Salesforce making callout, else the problem is with a external system.

How do I debug SOAP API?

Use the cookie format defined in Set a Browser Cookie to Enable Debug Logging for Guest Users and the SOAP UI Request header functionality at the bottom of the request window. Show activity on this post. You can try to set debug logs from Setup->Debug Logs .


1 Answers

With a bit of inspiration from this article I've come up with a solution that allows me to call the service from SoapUI and step through the code in my IDE (PhpStorm).

The key is to alter a part of the WSDL that gets generated, in particular the <soap:address> node. This has a location attribute to which I append ?XDEBUG_SESSION_START=netbeans-xdebug. Clearly the netbeans-xdebug needs to be whatever IDE Key you have set up with you debugging environment.

I do this by capturing the WSDL before it is rendered and performing a preg_replace().

$wsdl = preg_replace('|soap:address location="(.*?)"|','soap:address location="$1' . $ide_key . '"', $wsdl );
like image 111
Rob Forrest Avatar answered Sep 28 '22 07:09

Rob Forrest