Hi all,

I was wondering if anyone had run across the same issue.

The issue is the following. I have a bunch of protocl buffers that I
use for the communnication between client and server, the client is in
C++ the server in java. It was all running fine until I made the
following refactoring in the code:


I went from having something along the lines of

message PbApplicationMessage {
  optional PbApplicationOP1Request operation1 = 1;
  optional PbApplicationOP2Request operation2 = 2;
}

to more generic solution using extensions
Framework proto file

message PbFrameworkMessage {
  required PbApplication Message appMessage = 1;
}

message PbApplicationMesasge{
   extensions 1 to 18999;
}

and in my application proto file
#import "framework.proto"

extend PbApplicationMessage {
  optional PbApplicationOP1Request operation1 = 1;
  oprional PbApplicationOP2Request operation2 = 2;
}

I refactored all the code for what could be required. I compile the
protocol buffers protofile
so that both generated files are available on the same package for
both client and server.

The framework.proto is compile only once to be part of a library that
is statically linked to the client version.

Now the problem that I have is teh following.
I serialize in C++  the Framework Message after I have put the
extension in it by using the

request->mutable_appmessge().MutableExtenstion(operation1)

Just before calling the request->SerializeToString(string) I check
with
request->appmessage().HasExtension(operation1) and that returns true.

Until here all is fine. I then dump that to the wire
and when on the java side I pick up the protocolbuffer I do the
following

PbFrameworkMessage request = PbFrameworkMessage.parseFrom
(networkBuffer);
I then do a request.getAppMessage().hasExtension
(Application.operation1) which returns false

The network code that puts things to and from the wire has been
running without the extensions sending portocol buffers around with
absolutely no problems.

Am I missing something obvious that I ought to do before the serialize
to String on the client, whic is required by the enxtensions and is
not in the nromal version?

I am running  protobuf 2.0.0beta on both sides.

Any help or pointer will be much appreciated.

Kind regards.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to