使用 xDebug 调试 SOAP 服务 [英] Debugging a SOAP service using xDebug
问题描述
有没有一种方法可以调试我们发布的 SOAP 服务,并将其集成到 IDE 中,从而允许我逐步执行代码.
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.
推荐答案
从 这篇文章 我想出了一个解决方案,允许我从 SoapUI 并在我的 IDE 中逐步执行代码 (PhpStorm).
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).
关键是更改生成的 WSDL 的一部分,特别是
节点.这有一个 location
属性,我将 ?XDEBUG_SESSION_START=netbeans-xdebug
附加到该属性.显然,netbeans-xdebug
需要是您在调试环境中设置的任何 IDE 密钥.
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.
我通过在呈现 WSDL 之前捕获它并执行 preg_replace() 来做到这一点.
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 );
这篇关于使用 xDebug 调试 SOAP 服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!