[phpxmlrpc] Detecting XML-RPC request

Gaetano Giunta giunta.gaetano at sea-aeroportimilano.it
Wed Oct 11 12:42:23 UTC 2006


You're in both luck, as I have tackled this problem before, and quite out of luck, as there is no clear-cut answer, really.

XML-RPC: the spec mandates POST as http verb and "text/xml" as content-type (but you can assume to receive some charset encoding too, so "text/xml; charset=foo" can be considered valid). It mandates a content-lenght too, but omitting to control it in php is usually safe, as long as the underlying webserver does its job (the spec also mentions Host and User-agent http headers, too, btw).

SOAP:
version 1.2 (http://www.w3.org/TR/2003/REC-soap12-part0-20030624, http://www.w3.org/TR/2003/REC-soap12-part2-20030624) says that both GET and POST are ok.
With post 'the HTTP Content-type header must be chosen as "application/soap+xml"', while GET should have an 'Accept: application/soap+xml' header. take care that the spec is lengthy and complex, so I might have gotten something wrong here

version 1.1 (http://www.w3.org/TR/2000/NOTE-SOAP-20000508) is different: it uses text/xml as content type, has a 'soapaction' mandatory http header and is valid only within POST

JSON: unfortunately, there is no consensus on this. Afaicr, the formal json specification has been proposed to w3c/iso/iana/ecma/??? only very recently, and toolkit implementors had varying ideas about the content-type http header that best fit

If you're coding a multi-platform server, you could also provide self-generated html documentation about existing services when receiving a plain GET request or do something different when receiving a POST sent from an html form (content-type: application/x-www-form-urlencoded) 

Bye
Gaetano

> -----Original Message-----
> From: phpxmlrpc-bounces at lists.usefulinc.com
> [mailto:phpxmlrpc-bounces at lists.usefulinc.com]On Behalf Of Marcus
> Lunzenauer
> Sent: Wednesday, October 11, 2006 2:12 PM
> To: phpxmlrpc at lists.usefulinc.com
> Subject: [phpxmlrpc] Detecting XML-RPC request
> 
> 
> Hi,
> 
> I need some help with incoming HTTP requests. What is needed 
> to identify
> this request as a XML-RPC request? I want to be able to tell SOAP,
> XML-RPC and JSON requests apart to auto-dispatch them.
> 
> Bye, Marcus
> 
> _______________________________________________
> phpxmlrpc mailing list
> phpxmlrpc at lists.usefulinc.com
> http://lists.usefulinc.com/cgi-bin/mailman/listinfo/phpxmlrpc
> 


More information about the phpxmlrpc mailing list