문제

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.

도움이 되었습니까?

해결책

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 );

다른 팁

I've done debugging with Eclipse IDE, Zend Debugger and soapUI but I guess this will work with XDebug as well.

Select your soap server endpoint in Eclipse IDE and then "Debug As" | "PHP Web Application". For me the endpoint is soapserver.php. This will start your default web browser with debugging parameters added to URL. So the URL will be something like

http://localhost/myproject/soapserver.php?debug_host=127.0.0.1&debug_fastfile=1&start_debug=1&debug_port=10137&use_remote=1&original_url=http%3A%2F%2Flocalhost%2Fmyproject%2Fsoapserver.php&ZRayDisable=1&send_sess_end=1&debug_stop=1&debug_start_session=1&debug_no_cache=1621452020087&debug_session_id=1000

Now copy the URL from browser to soapUI's request. Start the request and debugger will stop the execution of php code at the first line of soapserver.php. You may set other breakpoints too.

The only downside of this approach is that the debugger is alive only as long as the request is alive. When timeout happens the debugger will stop too. I've tried to change the request timeout in soapUI with no luck. Probably one needs to change timeout of php's soapserver but I've no idea how to do it.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top