public function testRemoveUsersCapabilities() { $a = array('RequestMethod' => 'RemoveUserCapabilities', 'OwnerID' => 'efb00dbb-d4ab-46dc-aebc-4ba83288c3c0'); $r = new HttpRequest($this->server_url, HttpRequest::METH_POST); $r->addPostFields($a); $r->send(); echo $r->getRawRequestMessage(); echo "\n"; echo $r->getRawResponseMessage(); echo "\n"; $this->assertEquals(200, $r->getResponseCode()); }
//set the soap message for the request $xmlSoapMessage = '<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <GetWeather xmlns="http://www.webserviceX.NET"> <CityName>singapore</CityName> <CountryName>singapore</CountryName> </GetWeather> </soap:Body> </soap:Envelope>'; $r->setBody($xmlSoapMessage); try { $r->send(); echo '<h2>Request Header</h2>'; echo '<pre>'; print_r($r->getRawRequestMessage()); echo '</pre>'; $responseCode = $r->getResponseCode(); $responseHeader = $r->getResponseHeader(); $responseBody = $r->getResponseBody(); echo '--------------------------------------------------------------------------------------------<br/>'; echo '<h2>Rseponse Code</h2>'; echo "resonse code " . $responseCode . "<br/>"; // echo "resonse header" . $responseHeader["location"] . "<br/>"; echo '<h2>Rseponse Header</h2>'; echo '<pre>'; print_r($responseHeader); echo '</pre>'; echo '<h2>Rseponse Body</h2>'; echo '<pre>'; print_r($responseBody);
$response->send(); exit; } // Header handling foreach (array('Content-Type') as $name) { $content = $response->getHeader($name); if ($content) { header("{$name}: {$content}"); } } $debug = 0; // debugging if ($debug) { echo "DEBUGGING CALL TO <a href='{$url}'>{$url}</a>:\n<br>"; echo 'Seen by pecl extension as:' . $request->getUrl(); echo '<h2>Request</h2> <pre>' . $request->getRawRequestMessage() . '</pre>'; echo '<h2>Response</h2> <pre>' . $request->getRawResponseMessage() . '</pre>'; echo '<h2>Output headers</h2> <pre>'; print_r(headers_list()); print '</pre>'; echo '<h2>Content</h2>'; echo $response->getBody(); exit; } // well, that's our body $contents = $response->getBody(); // Take a short look if we got HTML (important for rewrite engine) $is_html = stripos($response->getHeader('Content-Type'), 'html') !== false; // rewrite the page... $db->driver->rewrite_page($url, $contents, $is_html); // and print it out.