<?
/*
* test_http_date_soap.html
*
* @(#) $Header: /cvsroot/PHPlibrary/test_http_date_soap.html,v 1.1 2001/06/06 17:06:20 mlemos Exp $
*
*/
?><HTML>
<HEAD>
<TITLE>Test for Manuel Lemos's PHP HTTP class making a request to da date SOAP server</TITLE>
</HEAD>
<BODY>
<H1><CENTER>Test for Manuel Lemos's PHP HTTP class making a request to da date SOAP server</CENTER></H1>
<HR>
<?
require("http.php");
set_time_limit(0);
$http_connection=new http_class;
$error=$http_connection->Open(array(
"HostName"=>"localhost",
"HostPort"=>80
));
if($error=="")
{
$error=$http_connection->SendRequest(array(
"RequestMethod"=>"POST",
"RequestURI"=>"/date.soap",
"Headers"=>array(
"Host"=>"localhost",
"User-Agent"=>"Manuel Lemos HTTP class SOAP test script",
"Pragma"=>"no-cache",
"SoapAction"=>"",
"EndPointURL"=>"http://localhost:80/date.soap",
"Content-Type"=>"text/xml; charset=\"utf-8\""
),
"Body"=>
"<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/1999/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/1999/XMLSchema\">
<SOAP-ENV:Body>
<m:getdate>
<time>1</time>
<utc>1</utc>
</m:getdate>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>"
));
if($error=="")
{
$headers=array();
$error=$http_connection->ReadReplyHeaders(&$headers);
if($error=="")
{
echo "<UL>\n<H2>Headers:</H2>\n<PRE>\n";
for(Reset($headers),$header=0;$header<count($headers);Next($headers),$header++)
{
$header_name=Key($headers);
if(GetType($headers[$header_name])=="array")
{
for($header_value=0;$header_value<count($headers[$header_name]);$header_value++)
echo $header_name.": ".$headers[$header_name][$header_value],"\r\n";
}
else
echo $header_name.": ".$headers[$header_name],"\r\n";
}
echo "</PRE>\n<H2>Body:</H2>\n<PRE>\n";
for(;;)
{
$error=$http_connection->ReadReplyBody(&$body,1000);
if($error!=""
|| strlen($body)==0)
break;
echo HtmlSpecialChars($body);
}
echo "</PRE>\n</UL>\n";
}
}
$http_connection->Close();
}
if(strcmp($error,""))
echo "<H2><CENTER>Error: $error</CENTER></H2>\n";
?>
<HR>
</BODY>
</HTML>
|