Hello everyone,

I'm absolutely new to probuf. So this is my issue.

We have implemented a proxy that receives a protobuf message as a byte 
array in a post message, and we only have to bypass this proto to the 
backend, receive the response (also in protobuf) and return it to the 
origin. That works.

The point is that I need to convert this received proto message to 
a com.google.protobuf.Message because I need to get a couple of values.

The point is when I convert the byte array proto to a Message object, the 
field I need ('Meta') is missing.

Attached the .proto file. I can't get the 'Meta' field, instead I get a:
"fields {
  key: ""
  value {
  }
}"

message Request {
   Meta Meta = 1;
   repeated int32 Hotels = 2 [packed = false];
   Country Market = 3;
   repeated Room Rooms = 4;
   .bcl.DateTime CheckIn = 5;
   .bcl.DateTime CheckOut = 6;
   OptionalCriteria OptionalCriteria = 7;
}
message Meta {
   int32 Client = 1;
   int32 Brand = 2;
   bool UseCache = 3;
   .bcl.TimeSpan CutOffTime = 4;
   bool B2C = 5;
   Language Language = 6;
   Currency Currency = 7;
   bool IncludeProviderAudit = 8;
   SalesChannel SalesChannel = 9;
}

When I try to get the message in this way:
public static Message fromByteArrayToMessage(byte[] body) throws 
IOException {
return Struct.newBuilder().mergeFrom(body).build();
}

I get the following, where everything is right except the 'Meta':
fields {
  key: ""
  value {
  }
}
2: 9836
2: 320488
2: 487215
3: 724
4: {
  1: {
    1: 30
  }
  1: {
    1: 30
  }
}
5: {
  1: 38994
}
6: {
  1: 38998
}
7: {
  4: 1
}

Any help will be really appreciated.

Joan.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/2a8fe909-51fc-4550-a14c-a358148d68c9n%40googlegroups.com.

Attachment: date_time.proto
Description: Binary data

Attachment: file.proto
Description: Binary data

Reply via email to