473,383 Members | 1,805 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Automation wrapped xmlrpc Server

Hello all,

I'm trying to create a COM Server with an embedded xmlrpc server.

Here is way it must work:
- The client application (programmed with a COM capable language)
instantiates my COM server (programmed with python).
- The COM server must have a connect interface in order to let the
client application process the xmlrpc request.
- After executing a "serveforever" method on the COM server it begins
to listen on a configured port for xmlrpc requests.
- When the COM server receives a xmlrpc request it passes this request
to the client application event (connect interface) in order to
process it.
- The client application processes the request and returns a result to
the COM server. The COM server returns this result to the xmlrpc
requester.

So, I must say that I have programmed some COM servers in python with
the aid of Mark's book, but in this case I have some problems:
- Must I instantiate a new thread for the xmlrpc server?
- If the xmlrpc server is a different thread how can this thread call
the _BroadcastNotify method from the main thread (the COM server)?
- I have successfully called the _BroadcastNotify method from the main
thread, but I become a strange behaviuor calling it from other thread.
- I tryied to pass the calling object reference to the xmlrpc thread,
so the xmlrpc thread has a reference to the _BroadcastNotify method,
but it does not work correctly.

Here is part of my code (I have deleted some parts):

class xmlrpcServer(Thread):
def __init__(self, mainthread, host, port):
Thread.__init__(self)
self.host = host
self.port = port
self.mainthread = mainthread
def run(self):
while 1:
# the following line simulates the reception
# of a xmlrpc request
request = xmlrpcRequest('testmethod', [n, 'parameter2'])
wrapped = wrap(request, useDispatcher=useDispatcher)
self.mainthread._BroadcastNotify(self.mainthread.N otifyCall,
(wrapped,))
class COMServer(ConnectableServer):
_public_methods_ = ['Serve'] + ConnectableServer._public_methods_
_connect_interfaces_ = [IID_IxmlrpcEvents]

def __init__(self):
ConnectableServer.__init__(self)
self.Host = ''
self.Port = None

def Serve(self):
# method Serve
#req = xmlrpcRequest('testmethod', ['parameter1', 23])
#wrapped = wrap(req, useDispatcher=useDispatcher)
#self._BroadcastNotify(self.NotifyCall, (wrapped,))
#req = unwrap(wrapped)
self._s = xmlrpcServer(self)
self._s.start()

def NotifyCall(self, interface, arg):
interface.Invoke(1000, 0, pythoncom.DISPATCH_METHOD, 1, arg)

class xmlrpcRequest:
# wraps a xmlrpc request as a COM object in order to pass it to
# a client event
_public_methods_ = ['Method', 'Parameter', 'Result']

def __init__(self, method, parameters):
self.Result = None
self._method = method
self._parameters = parameters

If I call the _BroadcastNotify method directly from the Serve method,
it works correctly.

Has anybody examples of a similar COM server?
Helps will be appreciated.

Thank you.
Jul 18 '05 #1
0 1710

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: glin | last post by:
Hi I am trying to integrate the xmlrpc server into a class, does anyone know how to get it working? test.html: <html> <head> <title>XMLRPC Test</title> <script src="jsolait/init.js"></script>...
0
by: Juan Carlos CORUÑA | last post by:
Hello all, I'm trying to create a COM Server with an embedded xmlrpc server. Here is way it must work: - The client application (programmed with a COM capable language) instantiates my COM...
1
by: Joxean Koret | last post by:
Hi to all! I'm having troubles to make my XMLRPC application working with non ASCII characters. Example: 1.- In one terminal run the following script: -----------XMLRPC...
15
by: qwweeeit | last post by:
Hi all, Elliot Temple on the 1 June wrote: > How do I make Python press a button on a webpage? I looked at > urllib, but I only see how to open a URL with that. I searched > google but no...
1
by: emielvl | last post by:
Hello, I'm developing a client/server architecture based on the XML-RPC implementation in php4. All works pretty well, except that in the response from the server there is no "Content-Length" in...
3
by: David Hirschfield | last post by:
An xmlrpc client/server app I'm writing used to be super-simple, but now threading has gotten into the mix. On the server side, threads are used to process requests from a queue as they come in....
1
by: fortepianissimo | last post by:
I have a simple xmlrpc server/client written in Python, and the client throws a list of lists to the server and gets back a list of lists. This runs without a problem. I then wrote a simple Java...
6
by: half.italian | last post by:
Hi, I'm trying to serve up a simple XMLRPC server as a windows service. I got it to run properly, I'm just not sure how to stop it properly. Most of the documentation/examples I found for this...
4
by: care02 | last post by:
I have implemented a simple Python XMLRPC server and need to call it from a C/C++ client. What is the simplest way to do this? I need to pass numerical arrays from C/C++ to Python. Yours, Carl
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

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.