Couple of things here:
1. respond_to is Rails 2 way of doing things, it's more convenient to use respond_with in Rails 3
2. If you want to send back xml, then you should ideally be sending in a xml request instead on html request
If you want to stick with respond_to call and always render xml from this method... then you can use this block:
respond_to do |format|
format.xml { render :xml => e }
end
Otherwise if you change the request to a xml request instead of normal html request, then you can use this:
class ServicesController < ApplicationController
respond_to :html, :xml
def method_name
s=Service.new
s.authenticate('mylogin','mypassword')
@cal=Calendar.find(s,{:title=>"Public"}).first
@events = @cal.events
e...@events.first
respond_with(e)
end
end