Drupal 7, XML-RPC and Sessions

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
lhridley's picture

I'm in the process of developing a Drupal site that will make heavy use of XML-RPC for smartphone clients. I would like to develop this site in Drupal 7, but had already started in Drupal 6. My question specifically relates to using sessions with XML-RPC requests.

How do you indicate in Drupal 7 that an XML-RPC method requires a valid session -- this is pretty straightforward in Drupal 6 with the Services module installed once you find the right documentation.

If there's documentation on this, please point me in the right direction, as I haven't found it yet for Drupal 7.

Thanks!

Comments

that's actually quite easy in

rolf vreijdenberger's picture

that's actually quite easy in D7. Some libraries that worked with xml-rpc in D6 could not handle session authentication properly. This is fixed in D7, so it works out of the box with sessions in the normal way that drupal uses them: sessionId's are stored in cookies and the value is sent with every request, thereby drupal is able to handle authentication. Use the xml-rpc server in D7 services and you'll be fine as far as I know.

Kind regards,

Rolf Vreijdenberger

drupal and flash: http://www.dpdk.nl/opensource/drupalproxy-as-a-bridge-between-flash-as3-...

Hmmmm.....not working for me

lhridley's picture

OK, then I need some pointers, because either the Services module does not work in Drupal 7, or I've done something wrong.

I installed the Services module for Drupal 7, release candidate 2, and turned on Services, and turned on the XMLRPC server.

Trying to call the service using http://www.example.com/services/xmlrpc returns an HTML page not found. This work fine in Drupal 6.

Trying to call the service using http://www.example.com/xmlrpc.php returns a fatal error: Call to undefined function services_get_server_info() in ...../site/allmodules/services/servers.xmlrpc_server/smlrpc_server.module on line 42.

I tried the same thing for services 7.x-3.x-dev, with the same result.

So, I'm either missing something critical, or the XML-RPC server for the sevices module for Drupal 7 does not work currently.

Make sure you create an end point

check_writer's picture

Make sure you create an endpoint in Admin > Structures ... then your URL would be http://myserver/drupal/?q=yourendpoint/

hope that helps.

Did you get this to work? I'm

Maybelle's picture

Did you get this to work? I'm having the same problem... very frustrating to try to figure this out! I have no idea how to create an "endpoint" ...

Admin > Structures >

kylebrowning's picture

Admin > Structures > Services, Add Endpoint

Should that end-point be

baroque's picture

Should that end-point be defined in the module code as well? In my module, I have both {module}_xmlrpc() and {module}_menu() functions defined. Will any of these be the right place to define the end-point? What's not clear to me is how the Services XML-RPC server knows which module to route the request to. Any help is much appreciated. Thanks.

Apply the patch

baroque's picture

I was told about this known issue and the patch that can be applied until Services 3.1 release is made. It helped my situation, and if you are still struggling with this issue you might give it a try:

Missing xmlrpc callbacks from server endpoints