Skip to content
This repository has been archived by the owner on Jun 9, 2019. It is now read-only.

Latest commit

 

History

History
39 lines (26 loc) · 1.66 KB

README.md

File metadata and controls

39 lines (26 loc) · 1.66 KB

ProtoRPC generators

Requirements

Well, of course, libprotobuf. If you install through MacPorts, then this should be enough:

$ sudo port install protobuf-cpp protobuf-pythonVERSION # protobuf-python25, protobuf-python26 or protobuf-python27

You should avoid installing the protobuf library for the same version of Python as your Google App Engine development server uses, as it will conflict with another protobuf package bundled in the latter. I use Python 2.7 system wide and let GAE be the only thing that still uses old Python 2.5.

Note that the installation seems broken, so google.protobuf.compiler cannot be imported because of a missing file. You can create it with this command:

$ sudo python -c 'import os, google.protobuf; open("%s/compiler/__init__.py"%google.protobuf.__path__[0], "w");'

How to generate the example service

Running the following:

$ cd example && ../bin/proto2rpc hello.proto

...will create these source files:

gen_rpc_client_cpp:
    hello.pb.cc  hello.pb.h

gen_rpc_client_objc:
    hello.rpc.h  hello.rpc.mm

gen_rpc_services:
    __init__.py  hello.py

Testing the example service

Assuming you running app.yaml on port 8081,

$ echo "my_name:'$USER'" | \
    protoc --encode=hello.HelloRequest hello.proto | \
    curl 2>/dev/null -H 'content-type:application/x-google-protobuf' \
        --data-binary @- http://localhost:8081/rpc/HelloService.hello | \
    protoc --decode=hello.HelloResponse hello.proto
hello: "Hey, hello jcayzac!"