I am facing an issue in the deserialization of java generated protobufs from 
protobuf_for_node nodejs library. 


*Steps to reproduce the problem?*
1. Serialize the proto-buffers using Java and store it as byte string
2. Read the byte string from NodeJS
3. Deserialize the byte String using the Feed.parse() method. Feed is given 
with the required schema assigned with the corresponding descriptor file 
compiled from the proto files. 
*sample code snippet:*
var Schema = require('protobuf').Schema;
var schema = new Schema(fs.readFileSync('example/test_proto.desc'));
var Feed = schema['proto.root1.root2'];
....
datanode.get("key", function(err, reply) {
   Buffer.prototype.toByteArray = function () {
       return Array.prototype.slice.call(this, 0)
    }

    console.log(reply);
    var buffer = new Buffer(new Buffer(reply).toByteArray()) ;
    aFeed = Feed.parse(buffer);   << error thrown here..
While attempting to deserialize from the nodejs using Feed.parse() method, I am 
facing the following issue
Error: Malformed message
    at Function.parse (<anonymous>:1:70)
    at ..node_modules/npm/node_modules/protobuf/example/test.js:44:18
    at try_callback (..node_modules/npm/node_modules/redis/index.js:532:9)
    at RedisClient.return_reply 
(..node_modules/npm/node_modules/redis/index.js:614:13)
    at ReplyParser.<anonymous> 
(..node_modules/npm/node_modules/redis/index.js:266:14)
    at ReplyParser.EventEmitter.emit (events.js:95:17)
    at ReplyParser.send_reply 
(..node_modules/npm/node_modules/redis/lib/parser/javascript.js:300:10)
    at ReplyParser.execute 
(..node_modules/npm/node_modules/redis/lib/parser/javascript.js:203:22)
    at RedisClient.on_data 
(..node_modules/npm/node_modules/redis/index.js:488:27)
    at Socket.<anonymous> (..node_modules/npm/node_modules/redis/index.js:82:14)

*Environment:*
OS : RHEL 5.4
Protobuf version : 2.5.0
protobuf-for-node : 0.8.6
NodeJS version : v0.10.7

Is anyone having the similar issue ? let me know if I am doing anything 
incorrectly here.. 

Thanks
SM


-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to