473,748 Members | 2,227 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XML-RPC server via xinetd

Hi,

I'm trying to figure out how to implement a XML-RPC server that
is called by xinetd i.s.o. listening on a TCP socket itself.

I already have implemented a stand-alone XML-RPC server using
SimpleXMLRPCSer ver, but I now want something similar, that is
started via xinetd (i.e. reading/writing via stdin/stdout).

Any hints or code examples?

Thanks,

--
-- Jos Vos <jo*@xos.nl>
-- X/OS Experts in Open Systems BV | Phone: +31 20 6938364
-- Amsterdam, The Netherlands | Fax: +31 20 6948204
Apr 15 '06 #1
12 3290
Jos Vos wrote:
Hi,

I'm trying to figure out how to implement a XML-RPC server that
is called by xinetd i.s.o. listening on a TCP socket itself.

I already have implemented a stand-alone XML-RPC server using
SimpleXMLRPCSer ver, but I now want something similar, that is
started via xinetd (i.e. reading/writing via stdin/stdout).

Any hints or code examples?

Thanks,


Isn't this just a standard daemon functionality?
So if you could wrap up your program in a daemon like fashion (e.g.
http://homepage.hispeed.ch/py430/python/daemon.py) and then point the
xinetd configuration to the right script, it should just work?

Beware that I didn't try this myself yet ;-) though should do in the
near future so if you could give a head ups on your progress I would
appreciate it.

--
mph
Apr 16 '06 #2
On Sun, Apr 16, 2006 at 10:13:19PM +0200, Martin P. Hellwig wrote:
Isn't this just a standard daemon functionality?
What is "a standard daemon"? :-)
So if you could wrap up your program in a daemon like fashion (e.g.
http://homepage.hispeed.ch/py430/python/daemon.py) and then point the
xinetd configuration to the right script, it should just work?


In fact, the standard use *is* a daemon (that is, accepting connections
on a certain port) and I want it to be *not* a daemon. For the daemon
method I use something similar to "daemonize" , but now I want it to
*not* do the binds etc. to listen on a port.

The problem is that the server initialization *requires* a server
address (host, port pair), but I don't see how to tell it to use
the stdin socket (and I'm afraid this is not possible, but I'm not
sure).

--
-- Jos Vos <jo*@xos.nl>
-- X/OS Experts in Open Systems BV | Phone: +31 20 6938364
-- Amsterdam, The Netherlands | Fax: +31 20 6948204
Apr 16 '06 #3
Jos Vos wrote:
<cut>

The problem is that the server initialization *requires* a server
address (host, port pair), but I don't see how to tell it to use
the stdin socket (and I'm afraid this is not possible, but I'm not
sure).


If I understood it correctly you want the python server bind be
depending on whatever is configured in xinetd.conf and not be defined in
the your program itself?

I tested a bit around with my FreeBSD machine but indeed the OS
environment gives me nothing interesting back, leaving that option out
but I do can specify command line arguments so you could pick them up
with sys.argv.

I looked up how you can specify arguments in xinetd and according to
various resources I filtered out (gotta over these gnu type
documentation.. .) that you can use "server_arg s" in the per service
configuration to specify arguments.

Although not really elegant it is doable to do an on the fly port binding.

Now I just hope I understood your problem :-)

--
mph
Apr 17 '06 #4
Jos Vos <jo*@xos.nl> wrote:
I'm trying to figure out how to implement a XML-RPC server that
is called by xinetd i.s.o. listening on a TCP socket itself.

I already have implemented a stand-alone XML-RPC server using
SimpleXMLRPCSer ver, but I now want something similar, that is
started via xinetd (i.e. reading/writing via stdin/stdout).

Any hints or code examples?


UTSL ;-)

Look at /usr/lib/python2.4/SimpleXMLRPCSer ver.py (adjust as per your
distro) and in particular the definition of the CGIXMLRPCReques tHandler class.

That looks as thought it almost, or maybe completely, does what you
want, ie an XMLRPC subclass which reads from stdin and writes to
stdout.

--
Nick Craig-Wood <ni**@craig-wood.com> -- http://www.craig-wood.com/nick
Apr 17 '06 #5
On Mon, Apr 17, 2006 at 02:07:37AM +0200, Martin P. Hellwig wrote:
If I understood it correctly you want the python server bind be
depending on whatever is configured in xinetd.conf and not be defined in
the your program itself?

I tested a bit around with my FreeBSD machine but indeed the OS
environment gives me nothing interesting back, leaving that option out
but I do can specify command line arguments so you could pick them up
with sys.argv.

I looked up how you can specify arguments in xinetd and according to
various resources I filtered out (gotta over these gnu type
documentation.. .) that you can use "server_arg s" in the per service
configuration to specify arguments.

Although not really elegant it is doable to do an on the fly port binding.

Now I just hope I understood your problem :-)


No, you didn't :-). I could add these options or even write an
xinetd-only program, that's all fine with me.

The problem is that I do not see how to let an SimpleXMLRPCSer ver
instance *not* bind to a port or what other class I can use to just
build a XML-RPC request handler reading/writing from stdin/stdout,
i.s.o. carrying all the server class stuff with it.

--
-- Jos Vos <jo*@xos.nl>
-- X/OS Experts in Open Systems BV | Phone: +31 20 6938364
-- Amsterdam, The Netherlands | Fax: +31 20 6948204
Apr 17 '06 #6
Jos Vos wrote:
The problem is that I do not see how to let an SimpleXMLRPCSer ver
instance *not* bind to a port or what other class I can use to just
build a XML-RPC request handler reading/writing from stdin/stdout,
i.s.o. carrying all the server class stuff with it.


I think that the problem here is that we are confusing transport with
request handling.

If you take a look at CGIXMLRPCReques tHandler
(http://docs.python.org/lib/node564.html), you will see an example of
how to write an XMLRPCRequestHa ndler without HTTP.

Cheers,
Brian
Apr 17 '06 #7
On Mon, Apr 17, 2006 at 12:10:15PM +0200, Brian Quinlan wrote:
If you take a look at CGIXMLRPCReques tHandler
(http://docs.python.org/lib/node564.html), you will see an example of
how to write an XMLRPCRequestHa ndler without HTTP.


Thanks, this might work for me, will try it.

--
-- Jos Vos <jo*@xos.nl>
-- X/OS Experts in Open Systems BV | Phone: +31 20 6938364
-- Amsterdam, The Netherlands | Fax: +31 20 6948204
Apr 17 '06 #8
On Mon, Apr 17, 2006 at 03:30:04AM -0500, Nick Craig-Wood wrote:
UTSL ;-)

Look at /usr/lib/python2.4/SimpleXMLRPCSer ver.py (adjust as per your
distro) and in particular the definition of the CGIXMLRPCReques tHandler class.
I did this before posting my question, in fact, but I did not look
good enough maybe, as at first sight I thought tghe CGI... class
would be too CGI-specific (it looks for environment variables etc.
given by the HTTP server), but maybe it's good enough.
That looks as thought it almost, or maybe completely, does what you
want, ie an XMLRPC subclass which reads from stdin and writes to
stdout.


Will try...

--
-- Jos Vos <jo*@xos.nl>
-- X/OS Experts in Open Systems BV | Phone: +31 20 6938364
-- Amsterdam, The Netherlands | Fax: +31 20 6948204
Apr 17 '06 #9
Jos Vos wrote:
On Mon, Apr 17, 2006 at 03:30:04AM -0500, Nick Craig-Wood wrote:
UTSL ;-)

Look at /usr/lib/python2.4/SimpleXMLRPCSer ver.py (adjust as per your
distro) and in particular the definition of the CGIXMLRPCReques tHandler class.


I did this before posting my question, in fact, but I did not look
good enough maybe, as at first sight I thought tghe CGI... class
would be too CGI-specific (it looks for environment variables etc.
given by the HTTP server), but maybe it's good enough.


I don't know exactly what your usage pattern is, but you might be able
to use SimpleXMLRPCDis patcher directly e.g.
s = SimpleXMLRPCDis patcher()
s.register_func tion(pow)
s._marshaled_di spatch('<?xml version="1.0".. .)

'<?xml version="1.0".. .

Cheers,
Brian
Apr 17 '06 #10

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

Similar topics

0
2265
by: Phil Powell | last post by:
// PROCESS XML CONTENT INTO DYNAMICALLY-NAMED ARRAYS foreach (array('mime', 'state', 'country') as $val) { $parser = xml_parser_create(); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); xml_parse_into_struct($parser, ${$val . 'XML'}, ${$val . 'XMLArray'}, $tags); xml_parser_free($parser); $myXMLArray = ${$val . 'XMLArray'}; for ($i = 1; $i < @sizeof($myXMLArray) - 1; $i++) { if ($myXMLArray) {
2
2767
by: Simon Strandgaard | last post by:
I am trying to understand how to create a 'catalog.xml' file for my docbook-xml documents. If I understand correct a local catalog.xml file can both avoid hardcoding in makefiles (portability), plus speed up if the stylesheet+dtds is located on the local machine. Question #1: How do I create a catagory.xml file, which works?
6
6786
by: yzzzzz | last post by:
Hi, In which cases is the <?xml version="1.0" encoding="UTF-8"?> processing instruction required at the beginning of an XML document, for the document to be valid? e.g. does it depend on the encoding used in the document, of the version of XML being used... Thanks.
0
1433
by: MarionEll | last post by:
XML 2003 Exposition Draws Leading XML Vendors Trade Show, Presentations Allow Companies to Showcase Cutting-edge Solutions Alexandria, Va. - Dec. 1, 2003 - XML 2003, the world's largest XML conference and exposition, will feature a trade show floor filled with key XML vendors including Adobe Systems, Inc. (NASDAQ: ADBE), ArborText, BEA Systems, Inc. (NASDAQ: BEAS), Document Management Solutions, Inc. (DMSI), Microsoft (NASDAQ: MSFT),...
0
1757
by: Stylus Studio | last post by:
World's Most Advanced XML Schema Editor Adds Support for IBM AlphaWorks XML Schema Quality Checker to Improve XML Schema Style and Quality BEDFORD, MA -- 09/13/2005 -- Stylus Studio (http://www.stylusstudio.com), the industry-leading provider of XML development tools for advanced data integration, today announced new support for IBM's alphaWorks XML Schema Quality Checker, furthering solidifying its position as the provider of the...
5
2732
by: Kurt Bauer | last post by:
I have an ASP group calendar application which pulls calendar data from Exchange via webdav into an XML string. I then loop the XML nodes to populate a collection of appointments. Finally I use the appointment collection to populate the calendar control. The performance getting the XML data is fine, but loading the data into the collection is slow. My question/problem is should I be using the collection, a dataset, or something else to...
5
4210
by: laks | last post by:
Hi I have the following xsl stmt. <xsl:for-each select="JOB_POSTINGS/JOB_POSTING \"> <xsl:sort select="JOB_TITLE" order="ascending"/> This works fine when I use it. But when using multiple values in the where clause as below
0
2792
by: jts2077 | last post by:
I am trying to create a large nested XML object using E4X methods. The problem is the, the XML I am trying to create can only have xmlns set at the top 2 element levels. Such as: <store xmlns="http://www.store.com/xml/1.1.0.0/impex/catalog"> <product sku="10050-1653" xmlns="http://www.store.com/xml/1.1.0.0/impex/catalog"> <sku>10050-1653</sku> <name xml:lang="x-default">shop's Foie Gras</name> <online>1</online> ...
0
2240
by: UncleRic | last post by:
Environment: Mac OS X (10.4.10) on MacBook Pro I'm a Perl Neophyte. I've downloaded the XML::Parser module and am attempting to install it in my working directory (referenced via PERL5LIB env): PERL5LIB=/Users/Ric/Library/Perl/ ls XML-Parser-2.34/ XML-Parser-2.34.tar
9
2481
by: Lie | last post by:
Why this generates AttributeError, then not? Python 2.5.2 (r252:60911, Apr 21 2008, 11:17:30) on linux2 Type "help", "copyright", "credits" or "license" for more information. Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'module' object has no attribute 'dom' <module 'xml.dom' from '/usr/lib/python2.5/xml/dom/__init__.pyc'>
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8831
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9552
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9249
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8245
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4607
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4877
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3315
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.