$server->_auto_translation = true; /* This is a simple example of implementing a custom call handler. If you do this, the soap server will ignore objects or functions added to it, and will call your handler for **ALL** soap calls the server receives, wether the call is defined in your WSDL or not. The handler receives two arguments, the method name being called, and the arguments sent for that call. */ function myCallHandler($methodname, $args) { global $soapclass; return @call_user_func_array(array($soapclass, $methodname), $args); } $server->setCallHandler('myCallHandler', false); require_once 'example_server.php'; $soapclass = new SOAP_Example_Server(); $server->addObjectMap($soapclass, 'urn:SOAP_Example_Server'); if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') { $server->service($HTTP_RAW_POST_DATA); } else { require_once 'SOAP/Disco.php'; $disco = new SOAP_DISCO_Server($server, 'ServerExample'); header("Content-type: text/xml"); if (isset($_SERVER['QUERY_STRING']) && strcasecmp($_SERVER['QUERY_STRING'], 'wsdl') == 0) { echo $disco->getWSDL(); } else { echo $disco->getDISCO(); } exit; }
// $Id: server_Round3GroupD.php 7 2010-01-22 18:14:51Z acio $ // require_once 'SOAP/Server.php'; require_once 'interop_Round3GroupD.php'; // http://www.whitemesa.com/r3/interop3.html // http://www.whitemesa.com/r3/plan.html $groupd = new SOAP_Interop_GroupD(); $server = new SOAP_Server; $server->_auto_translation = true; $server->addObjectMap($groupd, 'http://soapinterop/'); $server->addObjectMap($groupd, 'http://soapinterop.org/xsd'); $server->service(isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : NULL); $test = '<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns4="http://soapinterop.org/xsd" > <SOAP-ENV:Body> <ns4:x_Document>Test Document Here</ns4:x_Document> </SOAP-ENV:Body> </SOAP-ENV:Envelope>'; #$server->service($test,'',TRUE);
$ra[] = $inputStructArray[$i]->__to_soap('item'); } } return $ra; } } // http://www.whitemesa.com/r3/interop3.html // http://www.whitemesa.com/r3/plan.html $groupd = new SOAP_Interop_GroupDImport3(); $server = new SOAP_Server(); $server->_auto_translation = true; $server->addObjectMap($groupd, 'http://soapinterop/'); $server->addObjectMap($groupd, 'http://soapinterop.org/xsd'); $server->bind('http://localhost/soap_interop/wsdl/import3.wsdl.php'); if (isset($_SERVER['SERVER_NAME'])) { $server->service(isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : null); } else { // allows command line testing of specific request $test = '<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns4="http://soapinterop.org/xsd" xmlns:ns5="http://soapinterop/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <ns5:echoStructArray> <inputArray xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="ns4:SOAPStruct[3]" SOAP-ENC:offset="[0]">
} return new SOAP_Value('echoStringArrayReturn', null, $ra); } function echoStruct($inputStruct) { if (is_object($inputStruct) && strtolower(get_class($inputStruct)) == 'soapstruct') { return $inputStruct->__to_soap('return'); } else { if (is_object($inputStruct)) { $inputStruct = get_object_vars($inputStruct); } $struct = new SOAPStruct($inputStruct['varString'], $inputStruct['varInt'], $inputStruct['varFloat']); return $struct->__to_soap('return'); } } function echoVoid() { return null; } } // http://www.whitemesa.com/r3/interop3.html // http://www.whitemesa.com/r3/plan.html $groupd = new SOAP_Interop_GroupDRpcEnc(); $server = new SOAP_Server(); $server->_auto_translation = true; $server->addObjectMap($groupd, 'http://soapinterop/'); $server->addObjectMap($groupd, 'http://soapinterop.org/xsd'); $server->addObjectMap($groupd, 'http://soapinterop.org/WSDLInteropTestRpcEnc'); $server->bind('http://localhost/soap_interop/wsdl/InteropTestRpcEnc.wsdl.php'); $server->service(isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : null);
<? // handles remote queries with soap /* *** REQUIREMENTS FOR USING the version of PEAR:SOAP that this code uses: *** SOAP-0.9.3 HTTP_Request >= 1.3.0 Net_URL >= 1.0.14 */ if (!defined('DILPS_SOAP_QUERY')) define('DILPS_SOAP_QUERY', 1); error_reporting(0); // suppress warnings related to unfound (and unnecessary) soap include files require_once('./config.inc.php'); require_once("{$config['includepath']}dilpsSoapServer.class.php"); require_once('SOAP/Server.php'); // Create the SOAP server $soapServer = new SOAP_Server(); $dilpsSoap = new DilpsSoapServer(!$config['utf8']); $soapServer->addObjectMap($dilpsSoap, 'urn:DILPSQuery'); // Service the request $status = $soapServer->service($GLOBALS['HTTP_RAW_POST_DATA']); if (is_a($status, 'SOAP_Fault')) { $fault = $response->getFault(); //mail('*****@*****.**', 'soapserverFault', var_export($fault)); } ?>
return new SOAP_Fault($errorMsg, 'Client'); } else { $monthname = date('F Y', $Month->getTimeStamp()); $days = array(); $Month->build(); while ($Day =& $Month->fetch()) { $day = array('isFirst' => (int) $Day->isFirst(), 'isLast' => (int) $Day->isLast(), 'isEmpty' => (int) $Day->isEmpty(), 'day' => (int) $Day->thisDay()); $days[] = $day; } return array('monthname' => $monthname, 'days' => $days); } } } $server = new SOAP_Server(); $server->_auto_translation = true; $calendar = new Calendar_Server(); $server->addObjectMap($calendar, 'urn:PEAR_SOAP_Calendar'); if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') { $server->service($GLOBALS['HTTP_RAW_POST_DATA']); } else { require_once 'SOAP' . DIRECTORY_SEPARATOR . 'Disco.php'; $disco = new SOAP_DISCO_Server($server, "PEAR_SOAP_Calendar"); if (isset($_SERVER['QUERY_STRING']) && strcasecmp($_SERVER['QUERY_STRING'], 'wsdl') == 0) { header("Content-type: text/xml"); echo $disco->getWSDL(); } else { echo 'This is a PEAR::SOAP Calendar Server. For client try <a href="8.php">here</a><br />'; echo 'For WSDL try <a href="?wsdl">here</a>'; } exit; }
class ServerHandler_Round2Base implements SOAP_Service { public static function getSOAPServiceNamespace() { return 'http://soapinterop.org/'; } public static function getSOAPServiceName() { return 'ExampleService'; } public static function getSOAPServiceDescription() { return 'Just a simple example.'; } public static function getWSDLURI() { return 'http://localhost/soap/tests/interop.wsdl'; } public function echoString($inputString) { return array('return' => (string) $inputString); } } $server = new SOAP_Server(); require_once 'ServerHandler_Round2Base.php'; $soapclass = new ServerHandler_Round2Base(); $server->addService($soapclass); if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') { $server->service('php://input'); }
/** * This runs the web service * * @static * @access public */ function run() { if (defined('JSON_WEBSERVICE')) { $this->runJSON(); return; } ob_start(); $server = new SOAP_Server(); $server->addObjectMap($this, 'http://schemas.xmlsoap.org/soap/envelope/'); $request = 'Not Set'; if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') { $request = file_get_contents("php://input"); $server->service($request); } else { // Create the DISCO server $disco = new SOAP_DISCO_Server($server, $this->namespace); header("Content-type: text/xml"); if (isset($_SERVER['QUERY_STRING']) && strcasecmp($_SERVER['QUERY_STRING'], 'wsdl') == 0) { echo $disco->getWSDL(); } else { echo $disco->getDISCO(); } } $capture = ob_get_flush(); $this->debug($request, 'request', 5); $this->debug($capture, 'response', 5); global $_KT_starttime; $time = number_format(KTUtil::getBenchmarkTime() - $_KT_starttime, 2); $this->debug($time, 'time from start', 4); }