Tuesday, February 28, 2012

Zend Debugger with HTTP Post and SOAP

In previous blogs, I have discussed methods for doing remote debugging vi SSH and Zend built-in tunneling as well as for debugging CLI driven functions with Zend Debugger by setting environment variables.  But there sometimes comes the case that you need to debug a SOAP or HTTP post initiated transaction.

The way to do this is by putting cookies in the header of the incoming http transaction that tell Zend to trigger the debug session.  I generally do most of my system development on an AWS instance.  So I also use remote debugging in conjunction with this.   The other day, I did a writeup on how to get SSH tunneling setup.  This is the same method you would use to remotely debug here.  So if you need to get an SSH tunnel setup for remote debugging, please refer to my other blog post here and get your tunnel working before proceeding.

Assuming you have your remote debug environment setup or are working locally, we now want to proceed to debug an HTTP post or SOAP initiated transaction.  Generally, I use CURL to setup my transactions.   So I would produce code something like the following:


$debug_cookie = "start_debug=1; debug_fastfile=1; debug_host=127.0.0.1; use_remote=1; debug_port=10137; original_url=http://test-server; debug_stop=1; debug_session_id=1005;";

curl_setopt($ch, CURLOPT_COOKIE, $debug_cookie);

and inject it into my curl creation flow.  if you use some other method of setting up your transactions, that's fine.  At the end of the day, you need to produce a line in your headers that looks something like:

Cookie: start_debug=1; debug_fastfile=1; debug_host=127.0.0.1; use_remote=1; debug_port=10137; original_url=http://test-server; debug_stop=1; debug_session_id=1005;

And however you go about doing it is fine as long as the header actually gets passed in with the cookie in it.  

I defined a PHP server for "http://test-server", setup appropriate path mapping, and set it as the default server.  I am not 100% sure how Zend goes about resolving path mapping as to whether this is necessary or not, but it worked correctly.  So if you are having path mapping problems, it's worth a shot to try that and see if it helps.  

1 comment:

  1. The King Casino | Review of Casino | RTP - Joker
    The king casino review - worrione.com everything poormansguidetocasinogambling.com you need to know 토토사이트 about this หาเงินออนไลน์ popular casino. It's https://jancasino.com/review/merit-casino/ all about quality and quantity.

    ReplyDelete