473,406 Members | 2,352 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,406 software developers and data experts.

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_func( $method_name, $params, $app_data ) {
return 0.12;
}

xmlrpc_server_register_method($xmlrpc_server, "checkVersion",
"checkVersion_func");

/*
* 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_call_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_create(), 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_call_method($xmlrpc_server, $request_xml,
'');

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

xmlrpc_server_destroy($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>checkVersion</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.120000</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 3183
On 2006-02-14, em*****@yahoo.co.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
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...
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...
6
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...
4
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
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....
4
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...
3
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...
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...
0
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: ...
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
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...
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
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
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...
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
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.