<div dir="ltr">Hello,<div><br></div><div>I am trying to use z3c.jsonrpc to write an endpoint in GroupServer (<a href="http://groupserver.org/">http://groupserver.org/</a>), an listserv/web forum hybrid built on Zope 2. However, it seems that the JSON server is not handling application/json requests, and I can not figure out why. </div>
<div><br></div><div>You can see the code for my attempted implementation at <a href="https://source.iopen.net/groupserver/gs.group.member.invite.json/files/48e83035eee1a485e641a3290a295ed4d6355c58/gs/group/member/invite/json/">https://source.iopen.net/groupserver/gs.group.member.invite.json/files/48e83035eee1a485e641a3290a295ed4d6355c58/gs/group/member/invite/json/</a>. Don't worry if you encounter an SSL certificate warning, that's pretty normal.</div>
<div><br></div><div>api_rpc_test.py in particular contains the class that is my attempt to implement a JSON-RPC endpoint. It started off as a zope.formlib form, so there's still vestigial methods form that; invite is the only real method of interest.</div>
<div><br></div><div>I'm able to start GroupServer with the gs.group.member.invite.json as it is above. However, when I attempt to invoke the invite method via JSON-RPC:</div><div><br></div><div><div>curl -i -X POST -H "Content-Type: application/json" -H "Accept: application/json'" -d '{"jsonrpc": "2.0", "method": "invite", "params": {"foo": "bar"}, "id": 1}' <a href="http://localhost/groups/example_group/">http://localhost/groups/example_group/</a></div>
</div><div><br></div><div>the response I receive is the HTML I would receive from a standard request to that address (note: /groups/example_group/ implements gs.group.base.interfaces.IGSGroupMarker).</div><div><br></div><div>
I've attempted to use zope.testbrowser as described at <a href="https://pypi.python.org/pypi/z3c.jsonrpc/#testing">https://pypi.python.org/pypi/z3c.jsonrpc/#testing</a> with slight variations:<br></div><div><br></div>
<div><span style="font-weight:bold;color:rgb(32,74,135)"> </span>>>> from zope.testbrowser.testing import Browser<br>>>> browser = Browser()<br>>>> siteURL = '<a href="http://samus/groups/example_group'">http://samus/groups/example_group'</a><br>
>>> browser.post(siteURL + '/content', "{'method':'hello', 'id':1}", content_type='application/json')<br><br>The result of this is :zope.configuration.exceptions.ConfigurationError: No registered publisher found for (POST/application/json)<br>
</div><div><br></div><div>api_rpc_test.py is definitely being read during the launch of GroupServer, and the whole application is able to load. I'm also able to execute all of the code in the section at <a href="https://pypi.python.org/pypi/z3c.jsonrpc/#jsonrpc-proxy">https://pypi.python.org/pypi/z3c.jsonrpc/#jsonrpc-proxy</a>.</div>
<div><br></div><div>I'm not sure what else to do, nor am I entirely sure what is wrong. I'd appreciate any help anybody can offer on this.</div><div><br></div><div>Thanks,</div><div>Bill</div></div>