1

We use a 3rd party REST web service which defines their json API using piqi schemas. Our current architecture needs this data to be read through a java client and transferred to a c++ binary. Ideally, I would like all of the POJOs and c++ structs, as well as the data translation (json->java, java->c++) logic to be generated. I've been investigating different combinations of protobuf, protostuff, and thrift, but there are still gaps in the flow. Anyone have suggestions?

Ajay
  • 763
  • 5
  • 17
  • Why not just send the JSON to C++? – fge Jan 10 '13 at 22:55
  • That was my first thought also, but for reasons beyond my control, that is not an option. This data also needs to be persisted and retrieved by a key. (no complex queries needed) One option is just to use serialization and store it in a key/value store type db from java. – Ajay Jan 11 '13 at 04:14

1 Answers1

0

Piqi author here. Most likely the third-party API provider exposes the JSON over HTTP API using piqi-rpc. Assuming you have the up-to-date .piqi definitions of the service there's a chance you can get output and/or send input data in Protocol Buffers format instead of JSON. Dealing with Protobuf in both Java and C++ is a lot easier and more reliable than dealing with JSON.

Unless the API provider explicitly disables use of Protocol Buffers as input/output format, you should be able to use this format by setting Accept header (and Content-Type for input parameters) to application/x-protobuf as described here. I would just try that and see if it works. If it doesn't you can ask the provider to turn it on.

alavrik
  • 2,151
  • 12
  • 16