What steps will reproduce the problem?
1. Create service using byte[] field
2. Call it with HessianPHP 2
What is the expected output? What do you see instead?
Some "binary" data should be returned and not "string" as service will deny
request with such data saying that it wants bytes.
Please provide any additional information below.
For my app I have created not a quite good looking solution:
--------------
class Binary {
var $data;
function __construct($data=null){
$this->data = $data;
}
private static function constructBinary($value) {
$len = strlen($value);
if ($len < 16) {
return pack('c', $len + 0x20) . $value;
} else {
$stream = '';
for ($pos = 0; $pos < $len; $pos += 65535) {
$rest = $len - $pos;
if ( $rest > 65536) {
$stream .= 'b' . pack('CC', 255, 255) . substr($value, $pos, 65535);
} else {
$b1 = intval($rest / 256);
$b0 = $rest % 256;
return $stream . 'B' . pack('CC', $b1, $b0) . substr($value, -$rest);
}
}
}
}
public static function writeBinary(Binary $bin, $writer) {
return new HessianStreamResult(Binary::constructBinary($bin->data));
}
}
class UUID {
var $mId;
function __construct($mId=null){
$this->mId = $mId;
}
public static function parseUUID($uuid) {
$uuid->mId = new Binary($uuid->mId);
return $uuid;
}
}
include_once 'src/HessianClient.php';
$options = new HessianOptions();
$options->displayInfo = true;
$options->typeMap = array('UUID' => 'org.safehaus.uuid.UUID');
$options->parseFilters['@UUID'] = array('UUID','parseUUID');
$options->writeFilters['@Binary'] = array('Binary','writeBinary');
--------------
Original issue reported on code.google.com by qri...@gmail.com on 2 Jul 2010 at 8:42
Original issue reported on code.google.com by
qri...@gmail.com
on 2 Jul 2010 at 8:42