473,394 Members | 1,734 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,394 software developers and data experts.

XML-RPC server-client communication

Hi all,

I try to implement a python xml-rpc server and call it from a php
client. If the server and the client are on the same machine
(localhost) the communication between them is just fine. When I start
the server on a different host I don't get an answer.
What is missing there?? I tried also to set username and password,
cause I thought there is an authenticate issue but it didn't work
either.
Here is my code:

python server:
<code>
import SimpleXMLRPCServer
from re import *
import string

#The server object
class myFunctions:
def myTest(self, code):
mya = findall('#include.+',code)
stringo = string.join(mya,', ')
return stringo

calendar_object = myFunctions()
server = SimpleXMLRPCServer.SimpleXMLRPCServer(("xxx.xxx.xx x.xxx",
22999))
server.register_instance(calendar_object)

#Go into the main listener loop
print "Listening on port 22999"
server.serve_forever()
</code>

php client:
<code>
<?
require_once("XML/RPC.php");

$code = '#include<iostream>
#include<cmath>';

$function = "myTest";

$param = new XML_RPC_Value(htmlspecialchars($code), "string");
$params = array($param);
$message = new XML_RPC_Message($function, $params);
$client = new XML_RPC_Client("/new2.py","xxx.xxx.xxx.xxx",22999);

print_r($client);
$result = $client->send($message);
print_r($result);

$value = $result->value();
$number = $value->scalarval();
echo "<p><b>Return Value:</b$number </p>";

echo "<p>Headers are: $number </p>";
?>
</code>

Thanx in advance :)

Jul 5 '06 #1
4 2324
Stefka írta:
Hi all,

I try to implement a python xml-rpc server and call it from a php
client. If the server and the client are on the same machine
(localhost) the communication between them is just fine. When I start
the server on a different host I don't get an answer.
Please go to the machine where you php program resides, and check if the
server is not blocked by firewall rules. For example, do

telnet xxx.xxx.xxx.xxx 22999

If it does not connect, then the problem is with your network or
firewall settings. (I thought this is the most probable...)

Best,

Laszlo
What is missing there?? I tried also to set username and password,
cause I thought there is an authenticate issue but it didn't work
either.
Jul 5 '06 #2
Hi,

thanx for the hint :)! I ran a port scan and it turned out, that the
port was realy closed.
Thanx again!

greetz,
Stefka

Laszlo Nagy wrote:
Please go to the machine where you php program resides, and check if the
server is not blocked by firewall rules. For example, do

telnet xxx.xxx.xxx.xxx 22999

If it does not connect, then the problem is with your network or
firewall settings. (I thought this is the most probable...)

Best,

Laszlo
Jul 5 '06 #3
server = SimpleXMLRPCServer.SimpleXMLRPCServer(("xxx.xxx.xx x.xxx",
22999))
Could it be that xxx.xxx.xxx.xxx stands for '127.0.0.1'? If so... rename
it to 'localhost'. If you bind a port to 127.0.0.1 it will be found only
on the same machine.
Greetings,
Marco

Jul 6 '06 #4
no, its an extern IP adress. For my needs the server and the client
must be on different machines. But I opened the port and it worked.
Thanks anyway :)

Greetz,
Stefka

Marco Aschwanden wrote:
server = SimpleXMLRPCServer.SimpleXMLRPCServer(("xxx.xxx.xx x.xxx",
22999))

Could it be that xxx.xxx.xxx.xxx stands for '127.0.0.1'? If so... rename
it to 'localhost'. If you bind a port to 127.0.0.1 it will be found only
on the same machine.
Greetings,
Marco
Jul 6 '06 #5

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

Similar topics

0
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...
5
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...
5
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...
5
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...
9
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...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.