<?php require_once 'php-wsdl-2.3/class.phpwsdl.php'; PhpWsdl::RunQuickMode('ServiceFunctions.php');
<?php // A quick and dirty SOAP server example ini_set('soap.wsdl_cache_enabled', 0); // Disable caching in PHP $PhpWsdlAutoRun = true; // With this global variable PhpWsdl will autorun in quick mode, too require_once 'class.phpwsdl.php'; // When autorun is enabled, any line after loading PhpWsdl won't be executed! // In quick mode you can specify the class filename(s) of your webservice // optional parameter, if required. The next line will only be executed when // not using autorun. PhpWsdl::RunQuickMode(); // -> Don't waste my time - just run! class SoapDemo { /** * Say hello to... * * @param string $name A name * @return string Response */ public function SayHello($name) { $name = utf8_decode($name); if ($name == '') { $name = 'unknown'; } return utf8_encode('Hello ' . $name . '!'); } }
<?php // This demonstrates the usage of the NuSOAP adapter. It requires the // PhpWsdl framework files to be in the same folder as this file. // // Note: The NuSOAP adapter won't work with the PhpWsdlProxy! // Load NoSOAP require_once 'nusoap.php'; // Change this to the location of your NuSOAP installation // Load PhpWsdl require_once 'class.phpwsdl.php'; // Load the NuSOAP extension, if PhpWsdl could not do it // (because the "glob" function may be disabled in your PHP installation) // If "glob" is working, you don't need the following two lines: if (!class_exists('PhpWsdlNuSOAP')) { require_once 'class.phpwsdl.nusoap.php'; } // Run the SOAP server in quick mode $soap = PhpWsdl::RunQuickMode(array('class.soapdemo.php', 'class.complextypedemo.php')); // I was able to use this webservice with SoapUI. But with Visual Studio 2010 // I didn't receive the response. I think the problem may be the dot in the // response XML tag names that are produced by NuSOAP when registering a // method of a class. But without the dot NuSOAP won't find the method. There // is no way to change the class->method delimiter in NuSOAP (or you need to // touch their code). So I'm sorry, but this may not work with .NET clients... // // A solution for this problem would be to use only global methods. Then // Visual Studio would be able to consume the webservice.
<?php require_once 'GeneradorWSDL/class.phpwsdl.php'; //incluimos el archivo del paquete que utilizaremos para generar el wsdl PhpWsdl::RunQuickMode("Operaciones.php"); //referenciamos el archivo (clase) a partir del cual crearemos el wsdl, registrando en él las operaciones, tipos de datos, etc
<?php ini_set("soap.wsdl_cache_enabled", "0"); require_once 'phpwsdl/class.phpwsdl.php'; include_once 'class.book.php'; include_once 'class.myservice.php'; PhpWsdl::RunQuickMode(array('class.myservice.php', 'class.book.php')); /* $soap=PhpWsdl::CreateInstance( null, // PhpWsdl will determine a good namespace null, // Change this to your SOAP endpoint URI (or keep it NULL and PhpWsdl will determine it) './cache', // Change this to a folder with write access Array( // All files with WSDL definitions in comments 'class.myservice.php', 'class.book.php' ), null, // The name of the class that serves the webservice will be determined by PhpWsdl null, // This demo contains all method definitions in comments null, // This demo contains all complex types in comments false, // Don't send WSDL right now false); // Don't start the SOAP server right now // Disable caching for demonstration ini_set('soap.wsdl_cache_enabled',0); // Disable caching in PHP PhpWsdl::$CacheTime=0; // Disable caching in PhpWsdl // Run the SOAP server if($soap->IsWsdlRequested()) // WSDL requested by the client? $soap->Optimize=false; // Don't optimize WSDL to send it human readable to the browser //$soap->ParseDocs=false; // Uncomment this line to disable the whole documentation features //$soap->IncludeDocs=false; // Uncomment this line to disable writing the documentation in WSDL XML
<?php require_once '../php-wsdl/class.phpwsdl.php'; //require_once ('ControllerSoap.php'); //require_once ('../controller/ControllerDataStruct.php'); PhpWsdl::RunQuickMode(array('ControllerSoap.php', '../controller/ControllerDataStruct.php'));
<?php // This is an example specially for the REST server // Load PhpWsdl require_once 'class.phpwsdl.php'; // Load the servers extension, if PhpWsdl could not do it // (because the "glob" function may be disabled in your PHP installation) // If "glob" is working, you don't need those lines: if (!class_exists('PhpWsdlServers')) { require_once 'class.phpwsdl.servers.php'; } if (!class_exists('PhpWsdlJavaScriptPacker')) { require_once 'class.phpwsdl.servers-jspacker.php'; } // This disables response compression (some servers don't support that) PhpWsdlServers::$EnableCompression = false; // Run the PhpWsdl server in quick mode /*PhpWsdl::$Debugging=true; PhpWsdl::$DebugFile=PhpWsdl::$CacheFolder.'/debug.log';*/ PhpWsdl::RunQuickMode('class.restdemo.php');