Proper XML Response ( PHP Web Service )
Posted: Fri Sep 26, 2008 9:41 am
I created a web service which returns a success answer to the client:
The problems is that the clients seems unable to get the message! When i run the page from a browser it seems as a correct xml response but when i tried wireshark it displayed that there is no HTTP/xml protocol for transmission...It sends a Frame with my headers (HTTP protocol - HTTP 1.1 200 OK) and then it sends another frame with the actual xml message (HTTP Protocol - Continuation or non-HTTP traffic)
any ideas how to send the xml response to the client it reaches me correctly?
Code: Select all
$xmlText='<?xml version="1.0" encoding="utf-16"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><LoginResponse><Message>Success</Message></LoginResponse></soap:Body></soap:Envelope>';
header("Content-Length:".strlen($xmlText));
header("Cache-Control:private, max-age=0");
header("Content-Type:text/xml; charset=utf-8");
$time = time() - 60;
header("Date:".gmdate('D, d M Y H:i:s', $time).' GMT');
header("X-Powered-By:PHP");
echo $xmlText;any ideas how to send the xml response to the client it reaches me correctly?