471,119 Members | 1,368 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,119 software developers and data experts.

Re: XML RPC Problem....

Usman Ajmal wrote:
And i also fount that a typical system.auth call will look like:

POST /xmlrpc/clarens_server.py HTTP/1.0
Host: localhost
User-Agent: xmlrpclib.py/0.9.9 (by www.pythonware.com <http://www.pythonware.com>)

Content-Type: text/xml
Content-Length: 105
AUTHORIZATION: Basic MkhVTm9VazYxbXArVEZLS0dCY2tIRlA3bjVzPQo6RnJvbSBi
<?xml version='1.0'?>
<methodCall>
<methodName>system.auth</methodName>

<params>
</params>
</methodCall>
Problem is that i don't know how do i generate above xml system.auth
call. Can anyone please tell me how do call a function, setting the
header of the call too?
you need to plugin a custom transport. see this page for an example:

http://www.python.org/doc/lib/xmlrpc...t-example.html

in your case, it should be sufficient to override send_request, e.g.
(untested):

class SecureTransport(xmlrpclib.Transport):

def set_authorization(self, ustring, text_ucert):
self.authoriation = encodestring(
"%s:%s" % (ustring,text_ucert)
)

def send_request(self, connection, handler, request_body):
connection.putrequest("POST", handler)
connection.putheader("Authorization",
"Basic %s" % self.authorization
)

and instantiate the transport by doing

t = SecureTransport()
t.set_authorization(ustring, text_ucert)

before passing to the server proxy.

</F>

Sep 11 '08 #1
0 1069

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Kostatus | last post: by
117 posts views Thread by Peter Olcott | last post: by
18 posts views Thread by Ian Stanley | last post: by
28 posts views Thread by Jon Davis | last post: by
6 posts views Thread by Ammar | last post: by
2 posts views Thread by Mike Collins | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.