Maybe it's silly question, but anyway - applying routing rules solved
problem with connecting via http client. But what if I would like to
connect  with RPC client (to http-socket = :9090) directly to uwsgi RPC
server, ie like this

s = xmlrpclib.ServerProxy('http://hostname:9090')
print s.hello()

Above example will generate error:
--- no python application found, check your startup logs for errors ---
[pid: 19553|app: -1|req: -1/9] IP-ADDR () {32 vars in 529 bytes} [Wed May
15 16:10:26 2013] GET /favicon.ico => generated 21 bytes in 0 msecs
(HTTP/1.1 500) 1 headers in 57 bytes (0 switches on core 0)

And on client side will be raised xmlrpclib.ProtocolError

Is it because of routing rules we've setted above (but removing routes with
rpc calls to http uri doesn't solve this problem) ? Should I create binding
to another port for RPC calls in RPC layer?

Thanks.

T.



On Wed, May 15, 2013 at 12:30 PM, dráček mráček <[email protected]> wrote:

> Hi,
>
> thank you for the routing rules, now it works from the http client.
>
> Tom
>
>
> On Wed, May 15, 2013 at 7:16 AM, Roberto De Ioris <[email protected]>wrote:
>
>>
>> > Hi,
>> >
>> > I'm trying to create JSON RPC server based on uWSGI 1.9.1. It listens on
>> > http-socket and everything seems to be working fine until the client
>> > request come. Then 500 Internal Server Error will raise. I don't know
>> > what's wrong. I went through the basics about uWSGI including
>> > http://uwsgi-docs.readthedocs.org/en/latest/RPC.html. But maybe I
>> > overlooked something.
>> >
>> > My ini config is simple:
>> > [uwsgi]
>> >
>> >
>> > master = true
>> > http-socket = :9658
>> > workers = 3
>> > plugin_dir = /usr/lib/uwsgi/plugins
>> >
>> >
>> > RPC interface is also simple:
>> > import uwsgi
>> >
>> >
>> > import json
>> >
>> > def hello():
>> >     print 'got a call'
>> >     return json.dumps({'test_param': "test"})
>> > #enddef
>> >
>> > uwsgi.register_rpc("hello", hello)
>> >
>> >
>> > And server will start with:
>> > uwsgi --ini ./config.ini --import rpcinterface.py --enable-threads
>> --stats
>> > :1717
>> >
>> > detected binary path: /usr/local/src/uwsgi/uwsgi-1.9.1/uwsgi
>> > your processes number limit is 3883
>> > your memory page size is 4096 bytes
>> > detected max file descriptor number: 1024
>> > lock engine: pthread robust mutexes
>> > uwsgi socket 0 bound to TCP address :9658 fd 3
>> > Python version: 2.7.3 (default, Jan  2 2013, 14:09:21)  [GCC 4.7.2]
>> > Python main interpreter initialized at 0x25288d0
>> > python threads support enabled
>> > your server socket listen backlog is limited to 100 connections
>> > your mercy for graceful operations on workers is 60 seconds
>> > mapped 290528 bytes (283 KB) for 3 cores
>> > *** Operational MODE: preforking ***
>> > registered shared/inherited RPC function "hello"
>> > *** no app loaded. going in full dynamic mode ***
>> > spawned uWSGI master process (pid: 14563)
>> > spawned uWSGI worker 1 (pid: 14565, cores: 1)
>> > spawned uWSGI worker 2 (pid: 14566, cores: 1)
>> > spawned uWSGI worker 3 (pid: 14567, cores: 1)
>> > *** Stats server enabled on :1717 fd: 15 ***
>> >
>> > When I do a request like this: curl 127.0.0.1:9658/hello
>> >
>> > Error server message will be: --- no python application found, check
>> your
>> > startup logs for errors ---
>> >
>> > Thank you for any help :)
>> >
>> > Tom
>> > _______________________________________________
>> > uWSGI mailing list
>> > [email protected]
>> > http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
>> >
>>
>> RPC subsystem works at lower level than HTTP so you cannot directly call
>> it from an http client.
>>
>> You have to map rpc calls to http uri using the interna routing system:
>>
>> [uwsgi]
>> http-socket = :9090
>> import = rpcinterface.py
>>
>> route = ^/hello rpc:hello
>> route = ^/hello/(.+)/(.+) rpc:hello $1 $2
>> route = foobar/$ rpc:test ${REQUEST_URI}
>>
>> and so on...
>>
>>
>>
>>
>> --
>> Roberto De Ioris
>> http://unbit.it
>> _______________________________________________
>> uWSGI mailing list
>> [email protected]
>> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
>>
>
>
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to