Req #65004 [Com]: SoapServer::handle() should return instead of print

2013-09-04 Thread guillaume dot lintot at laposte dot net
Edit report at https://bugs.php.net/bug.php?id=65004edit=1

 ID: 65004
 Comment by: guillaume dot lintot at laposte dot net
 Reported by:kjarli at gmail dot com
 Summary:SoapServer::handle() should return instead of print
 Status: Open
 Type:   Feature/Change Request
 Package:SOAP related
 Operating System:   *
 PHP Version:5.3.26
 Block user comment: N
 Private report: N

 New Comment:

You can do it this way

?php
   class \SoapServer2 extends \SoapServer{
  public function handle($soap_request = null){
 ob_start();
 parent::handle($soap_request);
 $output = ob_get_contents();
 ob_end_clean();
 return $output;
  }
   }

   $server = new \SoapServer2(
  __DIR__ . '/../Resources/config/Notification.wsdl',
  array('classmap' = $this-classmap));
   // ...


Previous Comments:

[2013-06-10 12:42:29] kjarli at gmail dot com

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?rooterrorNo 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 this bug report at https://bugs.php.net/bug.php?id=65004edit=1


[PHP-BUG] Req #65494 [NEW]: Return multiple SoapVar in SoapServer

2013-08-21 Thread guillaume dot lintot at laposte dot net
From: guillaume dot lintot at laposte dot net
Operating system: Windows
PHP version:  5.5.2
Package:  SOAP related
Bug Type: Feature/Change Request
Bug description:Return multiple SoapVar in SoapServer

Description:

Hi, i want to return multiple value to a SOAP request.
The only solution i find was to generate a random XML and send it back...

Test script:
---
?php

class Test{
public function Method(){
$var1 = new SoapVar('value1', XSD_STRING);
$var2 = new SoapVar('value2', XSD_STRING);
return $var1 + $var2;
}
}

$input =
'?xml version=1.0?'.PHP_EOL.
'SOAP-ENV:Envelope
xmlns:SOAP-ENV=http://schemas.xmlsoap.org/soap/envelope/;
xmlns:ns1=namespace1'.
' xmlns:SOAP-ENC=http://schemas.xmlsoap.org/soap/encoding/;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;'.
' xmlns:xsd=http://www.w3.org/2001/XMLSchema;SOAP-ENV:Header 
/'.
'SOAP-ENV:Bodyns1:Method 
//SOAP-ENV:Body/SOAP-ENV:Envelope';

$soap = new SoapServer(null, array('uri' = '127.0.0.1'));
$soap-setClass('Test'); $soap-handle($input);

Expected result:

ns1:MethodResponse
var1 xsi:type=xsd:stringvalue1/var1
var2 xsi:type=xsd:stringvalue2/var2
/ns1:MethodResponse

Actual result:
--
ns1:MethodResponse
return xsi:type=xsd:int2/return
/ns1:MethodResponse

-- 
Edit bug report at https://bugs.php.net/bug.php?id=65494edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=65494r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=65494r=trysnapshot53
Try a snapshot (trunk): 
https://bugs.php.net/fix.php?id=65494r=trysnapshottrunk
Fixed in SVN:   https://bugs.php.net/fix.php?id=65494r=fixed
Fixed in release:   https://bugs.php.net/fix.php?id=65494r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=65494r=needtrace
Need Reproduce Script:  https://bugs.php.net/fix.php?id=65494r=needscript
Try newer version:  https://bugs.php.net/fix.php?id=65494r=oldversion
Not developer issue:https://bugs.php.net/fix.php?id=65494r=support
Expected behavior:  https://bugs.php.net/fix.php?id=65494r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=65494r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=65494r=submittedtwice
register_globals:   https://bugs.php.net/fix.php?id=65494r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65494r=php4
Daylight Savings:   https://bugs.php.net/fix.php?id=65494r=dst
IIS Stability:  https://bugs.php.net/fix.php?id=65494r=isapi
Install GNU Sed:https://bugs.php.net/fix.php?id=65494r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65494r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=65494r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=65494r=mysqlcfg



[PHP-BUG] Bug #65018 [NEW]: SoapHeader problems with SoapServer

2013-06-12 Thread guillaume dot lintot at laposte dot net
From: guillaume dot lintot at laposte dot net
Operating system: 
PHP version:  Irrelevant
Package:  SOAP related
Bug Type: Bug
Bug description:SoapHeader problems with SoapServer

Description:

SoapHeader::mustUnderstand are ignore in SoapServer context

Test script:
---
?php
class Tool{
public function TOKEN($id){
return new SoapHeader('namespace1', 'TOKEN', $id, true);
}
public function Method(){}
}

$input = $input =
'?xml version=1.0?'.PHP_EOL.
'SOAP-ENV:Envelope
xmlns:SOAP-ENV=http://schemas.xmlsoap.org/soap/envelope/;
xmlns:ns1=namespace1'.
' xmlns:SOAP-ENC=http://schemas.xmlsoap.org/soap/encoding/;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;'.
' xmlns:xsd=http://www.w3.org/2001/XMLSchema;'.
'SOAP-ENV:Headerns1:TOKEN
soapenv:mustUnderstand=1abc/ns1:TOKEN/SOAP-ENV:Header'.
'SOAP-ENV:Bodyns1:Method 
//SOAP-ENV:Body/SOAP-ENV:Envelope';

$soap = new SoapServer(null, array('uri' = '127.0.0.1'));
$soap-setClass('Tool'); $soap-handle($input);
$out = ob_get_contents(); ob_end_clean();

echo $out;
?

Expected result:

ns1:TOKEN soapenv:mustUnderstand=1abc/ns1:TOKEN

Actual result:
--
ns1:TOKENabc/ns1:TOKEN

-- 
Edit bug report at https://bugs.php.net/bug.php?id=65018edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=65018r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=65018r=trysnapshot53
Try a snapshot (trunk): 
https://bugs.php.net/fix.php?id=65018r=trysnapshottrunk
Fixed in SVN:   https://bugs.php.net/fix.php?id=65018r=fixed
Fixed in release:   https://bugs.php.net/fix.php?id=65018r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=65018r=needtrace
Need Reproduce Script:  https://bugs.php.net/fix.php?id=65018r=needscript
Try newer version:  https://bugs.php.net/fix.php?id=65018r=oldversion
Not developer issue:https://bugs.php.net/fix.php?id=65018r=support
Expected behavior:  https://bugs.php.net/fix.php?id=65018r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=65018r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=65018r=submittedtwice
register_globals:   https://bugs.php.net/fix.php?id=65018r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65018r=php4
Daylight Savings:   https://bugs.php.net/fix.php?id=65018r=dst
IIS Stability:  https://bugs.php.net/fix.php?id=65018r=isapi
Install GNU Sed:https://bugs.php.net/fix.php?id=65018r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65018r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=65018r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=65018r=mysqlcfg