Welcome Guest, Not a member yet? Register   Sign In
xml-rpc: blogger api question
#1

[eluser]gerben[/eluser]
I'd like to add an xml-rpc interface to my system, using the blogger api. There isn't much documentation or discussion about this, but I thought I'd give it a try.

I debug the code using xml-rpc client Ecto on osx, and when I connect the client sends a request for blogger.getUsersBlogs, and my server returns the expected response.

Normally though, after that a request is sent for blogger.getRecentPosts and blogger.getUserInfo, but the client doesn't do this in my case. The progress bar just keeps on spinning forever, but in the console I can see that no further request to the server is sent.

My guess would be that either: something in the first response doesn't meet the client's "expectations", or somethings's wrong with my blogger.getRecentPosts method handling.

Below is my code, based on the example in the CI manual. For testing purposes I've commented out the user-authentication part, and added some dummy-data. any thoughts on what the problem could be are very welcome, because I feel it must be something small and silly.


Code:
function index()
    {
    
    
        $this->load->library('xmlrpc');
        $this->load->library('xmlrpcs');
        
        
        $config['functions']['blogger.getUsersBlogs'] = array('function' => 'Server.getUserBlogs');
        $config['functions']['blogger.getRecentPosts'] = array('function' => 'Server.getRecentPosts');
        $config['functions']['blogger.getUserInfo'] = array('function' => 'Server.getUserInfo');
        
        
        $this->xmlrpcs->initialize($config);
        $this->xmlrpcs->serve();
    }
    
  
    
    
    function getUserInfo($request)
    {
    
            $username = 'smitty';
            $password = 'smitty';
    
            $this->load->library('xmlrpc');
        
            $parameters = $request->output_parameters();
      
            
        
            $response = array(array('nickname'  => array('Smitty','string'),
                                    'userid'    => array('99','int'),
                                    'url'       => array('http://yoursite.com','string'),
                                    'email'     => array('[email protected]','string'),
                                    'lastname'  => array('Smith','string'),
                                    'firstname' => array('John','string')
                                    ),
                             'struct');
    
            return $this->xmlrpc->send_response($response);
            
        

    }
    
    
    function getUserBlogs($request)
    {
    
            $username = 'smitty';
            $password = 'smitty';
    
            $this->load->library('xmlrpc');
        
        
            $response = array(array(
            'isAdmin' => array('1', 'int'),
            'url'  => array('http://yoursite.com','string'),
                                    'blogName'    => array('My Blog','string'),
                                    'blogid'       => array('1','int'),
                                    'xmlrpc' => array('http://www.zomp.nl/server','string')
                                    
                                    ),
                             'struct');
    
            return $this->xmlrpc->send_response($response);
            
        

    }
    
    
    function getRecentPosts($request)
    {
    
            $username = 'smitty';
            $password = 'smitty';
    
            $this->load->library('xmlrpc');
        
        
            $parameters = $request->output_parameters();
        
        
            $response = array(array('link'  => array('http://yoursite.com','string'),
                                    'permaLink'    => array('http://zomp.nl/zomplog','string'),
                                    'userid'       => array('123','int'),
                                    'mt_allow_pings'     => array('0','int'),
                                    'mt_allow_comments'     => array('1','int'),
                                    'description'    => array('bla bla','string'),
                                    'mt_convert_breaks'    => array('__default__','string'),
                                    'postid'    => array('1234','int'),
                                    'mt_excerpt'    => array('lala','string'),
                                    'mt_keywords'    => array('lala','string'),
                                    'title'    => array('This is my post','string'),
                                    'mt_text_more'    => array('lalili','string'),
                                    'dateCreated'  => array('2005-12-13T01:35:00Z','dateTime.iso8601')
                                    ),
                             'struct');
    
            return $this->xmlrpc->send_response($response);
            
        

    }


Messages In This Thread
xml-rpc: blogger api question - by El Forum - 10-12-2007, 03:49 AM
xml-rpc: blogger api question - by El Forum - 07-09-2010, 01:43 AM



Theme © iAndrew 2016 - Forum software by © MyBB