473,851 Members | 1,918 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

xmlrpc: no content-length in response

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 the header.
Since the XML-RPC specification requires this header to be present in
the server response, some libraries (notably: libxmlrpc++) choke on
this. For clarity, here's a (simple) server (slightly altered from:
http://www.devshed.com/c/a/PHP/Using...-with-PHP/4/):

--- xmlrpc-server.php ---
<?php

function checkVersion_fu nc( $method_name, $params, $app_data ) {
return 0.12;
}

xmlrpc_server_r egister_method( $xmlrpc_server, "checkVersi on",
"checkVersion_f unc");

/*
* When an XML-RPC request is sent to this script, it
* can be found in the raw post data.
*/
$HTTP_RAW_POST_ DATA = isset($HTTP_RAW _POST_DATA) ? $HTTP_RAW_POST_ DATA
: "";

$request_xml = $HTTP_RAW_POST_ DATA;
/*
* The xmlrpc_server_c all_method() sends a request to
* the server and returns the response XML. In this case,
* it sends the raw post data we got before. It requires
* 3 arguments:
* The first is the handle of a server created with
* xmlrpc_server_c reate(), the second is a string containing
* an XML-RPC request, and the third is for application data.
* Whatever is passed into the third parameter of this function
* is passed as the third paramater of the PHP function that the
* request is asking for.
*/
$response = xmlrpc_server_c all_method($xml rpc_server, $request_xml,
'');

// Now we print the response for the client to read.
print $response;

xmlrpc_server_d estroy($xmlrpc_ server);

?>
--- end ---

Now, if we call 'checkVersion' with an RPC client, the output from
ngrep is this:

--- ngrep ---
####
T xxxxx:52266 -> xxxxx:80 [AP]
POST /~xxxxx/pb/xmlrpc-server.php HTTP/1.1.
User-Agent: XMLRPCCocoa.
Host: xxxxxx
Pragma: no-cache.
Accept: */*.
Content-Type: text/xml.
Content-Length: 110.
..
<?xml version="1.0"?>
<methodCall>
..<methodName>c heckVersion</methodName>
..<params>
...</params>
..</methodCall>
##
T xxxxx:80 -> xxxxx:52266 [AP]
HTTP/1.1 200 OK.
Date: Tue, 14 Feb 2006 17:20:21 GMT.
Server: Apache/1.3.34 (Ubuntu) PHP/4.4.2-1.
X-Powered-By: PHP/4.4.2-1.
Transfer-Encoding: chunked.
Content-Type: text/html; charset=iso-8859-1.
..
a7 .
<?xml version="1.0" encoding="iso-8859-1"?>
<methodResponse >
<params>
<param>
<value>
<double>0.12000 0</double>
</value>
</param>
</params>
</methodResponse>

--- end ---

As you can see, there is no "Content-Length" in the response. Am I
doing something wrong here, or could this be a bug in php? Btw. I tried
this on different servers, with the same results.

Server version info:
Platform: Linux (ubuntu)
Apache: 1.3.34
PHP: 4.4.2-1
XMLRPC: xmlrpc-epi v. 0.51

Thanks for any help,
Emiel.

Feb 14 '06 #1
1 3221
On 2006-02-14, em*****@yahoo.c o.uk <em*****@yahoo. co.uk> wrote:
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 the header.
Since the XML-RPC specification requires this header to be present in
the server response, some libraries (notably: libxmlrpc++) choke on
this. For clarity, here's a (simple) server (slightly altered from:
http://www.devshed.com/c/a/PHP/Using...-with-PHP/4/):
use output buffering ob_start(). measure the length of the output,
make the header, emit the buffered output.
HTTP/1.1 200 OK.
Date: Tue, 14 Feb 2006 17:20:21 GMT.
Server: Apache/1.3.34 (Ubuntu) PHP/4.4.2-1.
X-Powered-By: PHP/4.4.2-1.
Transfer-Encoding: chunked.
Content-Type: text/html; charset=iso-8859-1.
.
a7 . As you can see, there is no "Content-Length" in the response. Am I
doing something wrong here,
No. it's using chunks instead.
or could this be a bug in php? Btw. I tried
this on different servers, with the same results.


"Transfer-Encoding: chunked." is a valid alternative to "Content-Length:..."
if XMLRPC doesn't support it it's lying where it claims HTTP/1.1

Bye.
Jasen
Feb 15 '06 #2

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

Similar topics

1
2293
by: Roger Keays | last post by:
Can anybody recommend the best xmlrpc library for php? My observations so far are that: * the PEAR XML_RPC package is undocumented * the php xmlrpc extensions are undocumented and require downloading extra code for the client functions * the usefulinc (http://xmlrpc.usefulinc.com/) is not supported by the php team Thanks in advance,
0
1745
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 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
6
5371
by: Michael Urman | last post by:
Hi. I'm a user of python for about 3 years now. I've written a client-server application that uses SimpleXMLRPCServer and xmlrpclib.ServerProxy to communicate. It's intended to be used by a single-person as a backend and GUI frontend. I've got it running great. Much stabler than my custom RPC I'd tried before. I've used the default support available by these classes. Thus it will run on a potentially public TCP/IP port. As the...
4
3675
by: dcrespo | last post by:
....If the answer is Yes, can you give me an example either in the server side and the client side? I googled a lot, but I can't find nothing regarding this. A lot of thanks. Daniel
3
5866
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. On the client side, threads are used to wait on the results of requests to the server. So the question is: how thread-safe is python xmlrpc? If the client makes a request of the server by calling:
4
8196
by: elyob | last post by:
Hi, I've got --with-xmlrpc option in my php.ini and can see on my phpinfo page. Now, how do I include this in some code? So far I've been downloading xmlrpc into a folder and just calling it from there, but if it's already installed what do I change to get this version working? Currently, I am calling ... require("../xmlrpc/lib/xmlrpc.inc"); I tried ... require("xmlrpc.inc"); ... but with no luck. Thanks
3
2848
by: Manuel | last post by:
Hello I need a xmlrpc lib for c++. I know two: xmlrpc++ and xmlrpc-c. But i don't know that it is best for me. I am developing an application in c++. I read that the xmlrpc-c lib is in C and wrap the functions to use in c++. Well, i think that it is more difficult to use than xmlrpc++ that it is made in c++. The trouble is that the xmlrpc++ is stopped from 2003 and i think that it has got a lot of bugs unresolved but it is more simple...
1
2391
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 xmlrpc client and it calls the python server. But I can't figure out what type to cast the result (of type Object) to. The Java xmlrpc call is basically this: Object result = client.execute("MyFunction", params);
0
2755
by: Benjamin Grieshaber | last post by:
Hi, I´m on SuSE 9.3 with xmlrpc-c and xmlrpc-c-devel installed (ver. 0.9.10) I tried to compile php with xmlrpc support and got the following errors: ext/xmlrpc/.libs/xmlrpc-epi-php.o(.text+0x359): In function `set_zval_xmlrpc_type': /php-5.2.5/ext/xmlrpc/xmlrpc-epi-php.c:1313: undefined reference to `XMLRPC_CreateValueDateTime_ISO8601'
4
3947
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
0
10670
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10735
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10356
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
9506
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
7073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5736
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
5934
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4549
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
4143
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.