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

  • SEARCH
  • Home
  • 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 9001805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:29:07+00:00 2026-06-16T00:29:07+00:00

It is well understood that forking a process for running Python, as CGI does,

  • 0

It is well understood that forking a process for running Python, as CGI does, is slower than embedding Python, as WSGI does. I would like to implement an XML-RPC interface using the SimpleXMLRPCServer included in the standard Python library and I already have an implementation that works via CGI. I believe there should be a faster way. I’d like to try WSGI but first I need a request handler for WSGI and there does not appear to be one in SimpleXMLRPCServer already. Am I all wet or is there no equivalent of this in the standard library under Python 2.6, 2.7, 3.x?

Here is my initial implementation of a WSGI replacement for CGIXMLRPCRequestHandler:

from xmlrpclib import SimpleXMLRPCDispatcher


class WSGIXMLRPCRequestHandler(SimpleXMLRPCDispatcher):
  """Simple handler for XML-RPC data passed through WSGI."""

  def __init__(self, allow_none = False, encoding = None):
    SimpleXMLRPCDispatcher.__init__(self, allow_none, encoding)


  def __call__(self, environ, start_response):
    """Parse and handle a single XML-RPC request"""
    result  = []
    method  = environ['REQUEST_METHOD']
    headers = [('Content-type', 'text/html')]

    if method != 'POST':
      # Default implementation indicates an error because XML-RPC uses the POST method.
      code             = 400
      message, explain = BaseHTTPServer.BaseHTTPRequestHandler.responses[code]

      status = '%d %s' % (code, message)

      if method == 'HEAD':
        response = ''
      else:
        response = BaseHTTPServer.DEFAULT_ERROR_MESSAGE % {'code' : code, 'message' : message, 'explain' : explain}
    else:
      # Dispatch XML-RPC to implementation
      status   = '200 OK'
      request  = environ['wsgi.input'].read(int(environ['CONTENT_LENGTH']))
      response = self._marshaled_dispatch(request)

    length = len(response)

    if length > 0:
      result = [response]

    headers.append(('Content-length', str(length)))
    start_response(status, headers)

    return result
  • 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-16T00:29:08+00:00Added an answer on June 16, 2026 at 12:29 am

    Take a look at this Hope it’ll help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It strikes me that regular expressions are not understood well by the majority of
I understood that iOS 4.2 is for iPad as well. The code below is
First of all I just want to say that I never understood so well
I understand that a zombie is created when a process doesn't clean-up well (its
as a not Perl programmer, i would like to be sure i had well
So if I understand well, Garbage collection automatically deallocates objects that are not used
I hope I can explain this well enough so that you can understand the
Setting default values for System Configuration fields is well understood (via Chapagain and blog
I just want to check if I understood well the way asynchronous Http request
I want to write a system call interposition by using Utrace. I understood that

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.