Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8211393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:24:49+00:00 2026-06-07T10:24:49+00:00

I’m working on a Rails project that requires using an XMLRPC protocol to access

  • 0

I’m working on a Rails project that requires using an XMLRPC protocol to access a Trac database.

Everything had been working fine until I needed to make a request with a XMLRPC::DateTime parameter. Now when I go to load the page, I get the error message:

Wrong content-type (received 'application/xml' but expected 'text/xml')

I have tried formatting the date parameter in a bunch of different ways (listed below), but nothing seems to be working.

I’ve tried:

    - @date = Time.now #=> (Tue Jul 10 10:18:01 -0700 2012)
    - @date = DateTime.now #=> (2012-07-10T10:17:37-07:00)
    - @date = Time.now.to_datetime #=> (2012-07-10T10:19:24-07:00)
    - @date = XMLRPC::Convert.dateTime(Time.now.to_datetime.to_s) #=> 
      #<XMLRPC::DateTime:0x1276aa068> 
      (The above hex number changes each time the page is refreshed)

Do you know what could be going wrong here?

UPDATE: The code where I make the call is pasted below (I’m using the trac4r ruby gem to actually make calls to the API):

def foo  
   date = DateTime.now.to_s  
   tickets = trac.tickets.query(:max => 1000, :created_at => date)  
   return tickets.size  
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T10:24:50+00:00Added an answer on June 7, 2026 at 10:24 am

    The gem you’re using hasn’t been updated in more than 2 years. I mention this because with age like that it is possible that some features of the gem no longer work due to changes that may have occurred in Ruby’s XMLRPC since (I will have to dig more to find proof of this).

    What I don’t like is this args_to_trac_args method.

    > args_to_trac_args({:max => 1000, :created_at => DateTime.now.to_s})
      => "max=1000&created_at=2012-07-10T13:58:13-04:00"
    

    This string is then passed to an XMLRPC::Client instance’s call method.

    In the XMLRPC::Client‘s call method, the above string is passed to methodCall in XMLRPC::Create. If you view the source of that method, you’ll see it tries to generate valid XML elements for each parameter passed.

    parameter = params.collect do |param|
        @writer.ele("param", conv2value(param))
    end
    

    This is generating a single <param> element like

    <param>
      <value>
        <string>max=1000&amp;created_at=2012-07-10T13:58:13-04:00</string>
      </value>
    </param>
    

    If I generate a full document by hand using the "max=1000&created_at=2012-07-10T13:58:13-04:00" string as the gem will

    require "xmlrpc/client"
    
    writer = XMLRPC::Create.new
    writer.methodCall('ticket.query', "max=1000&created_at=2012-07-10T13:58:13-04:00")
    

    the XML generated is invalid due to the &created_at=...

    <?xml version="1.0" ?>
    <methodCall>
        <methodName>ticket.query</methodName>
        <params>
            <param>
                <value>
                    <string>max=1000&amp;created_at=2012-07-10T13:58:13-04:00</string>
                </value>
            </param>
        </params>
    </methodCall>
    

    To me it seems the intended response is something more like

    <?xml version="1.0" ?>
    <methodCall>
        <methodName>ticket.query</methodName>
        <params>
            <param>
                <value>
                    <string>max=1000</string>
                </value>
            </param>
            <param>
                <value>
                    <string>created_at=2012-07-10T13:58:13-04:00</string>
                </value>
            </param>
        </params>
    </methodCall>
    

    but I don’t know enough about what Trac is expecting as request paramaters, or how the gem was intending for Ruby’s XMLRPC client to work 2+ years ago.

    I would verify the expected request format (one XML <param> containing a querystring of arguments, or multiple <param> elements), fork the Github repo, and make the necessary changes to args_to_trac_args (to me that seems to be the source of the problem).

    If the params are not joined into a single string and left as an array like ["max=1000", "created_at=2012-08-10T13:58:13-04:00"],methodCall` will generate the valid XML in the 2nd document shown above

    writer = XMLRPC::Create.new
    writer.methodCall('ticket.query', "max=1000", "created_at=2012-07-10T13:58:13-04:00")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.