From: kjarli at gmail dot com
Operating system: *
PHP version: 5.3.26
Package: SOAP related
Bug Type: Feature/Change Request
Bug description:SoapServer::handle() should return instead of print
Description:
------------
Case: I'm using a framework with MVC, symfony2. I'm using SOAP for 1 part
of the
system to receive notifications by an external party. Using
SoapServer::handle()
requires me to hack/cheat on the MVC pattern.
Say I want to use the normal route in any framework, thus assign my
SoapServer::handle() to a variable in the output, that's impossible because
it's
send to the browser straight away. This breaks several things:
- The framework using Output Buffering
- PHPUnit using Output Buffering.
Soap feels like php 4.0 and it's time to update it. My feature request:
Have
SoapServer::handle() return the string instead or make a new method that
does
this.
Test script:
---------------
$classmap = array(...);
$server = new \SoapServer(
__DIR__ . '/../Resources/config/Notification.wsdl',
array('classmap' => $this->classmap)
);
$server->setObject($this->get('mysoap.methods'));
$response = new Response();
$response->headers->set('Content-Type', 'text/xml; charset=ISO-8859-1');
// Sadly handle() prints the output rather than returning it -.-
ob_start();
$server->handle();
$content = ob_get_length() > 0
? ob_get_clean()
: '<?xml version="1.0" encoding="UTF-8"?><root><error>No soap response
generated</error></root>';
$response->setContent($content);
Expected result:
----------------
.
Actual result:
--------------
Would be so much easier if I could just do:
[...]
$response = new Response();
$response->headers->set('Content-Type', 'text/xml; charset=ISO-8859-1');
$response->setContent($server->handle());
--
Edit bug report at https://bugs.php.net/bug.php?id=65004&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=65004&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=65004&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=65004&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=65004&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=65004&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=65004&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=65004&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=65004&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=65004&r=support
Expected behavior: https://bugs.php.net/fix.php?id=65004&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=65004&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=65004&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=65004&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65004&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=65004&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=65004&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=65004&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65004&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=65004&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=65004&r=mysqlcfg