Source for file webservices.inc.php
Documentation is available at webservices.inc.php
* This file is part of the VCL for PHP project
* Copyright (c) 2004-2007 qadram software <support@qadram.com>
* Checkout AUTHORS file for more information on the developers
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
require_once("vcl/vcl.inc.php");
* Specifies if the webservice is active or not, if it's true, the component will fire the events
* to get the functions to register and any complex type required and will publish the WSDL and process
function getActive() { return $this->_active; }
function setActive($value) { $this->_active = $value; }
function defaultActive() { return false; }
* Specifies the Name of the service you want to create
function setServiceName($value) { $this->_servicename = $value; }
function defaultServiceName() { return "VCL"; }
* Specifies the Name Space for the WSDL
function getNameSpace() { return $this->_namespace; }
function setNameSpace($value) { $this->_namespace = $value; }
function defaultNameSpace() { return false; }
* Specifies the Target Name Space for the WSDL
function defaultSchemaTargetNamespace() { return ""; }
* Fired when the service needs to register the functions to be published by the service, see also register method
function defaultOnRegisterServices() { return null; }
* Fired when the service needs to register complex types, see also addComplexType
function defaultOnAddComplexTypes() { return null; }
//If the webservice is active, create the nusoap object
$this->_server = new soap_server();
$this->callEvent('onaddcomplextypes', array());
$this->callEvent('onregisterservices', array());
global $HTTP_RAW_POST_DATA;
$HTTP_RAW_POST_DATA = isset ($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA: '';
$this->_server->service($HTTP_RAW_POST_DATA);
if(isset ($log) and $log != '')
harness('nusoap_r2_base_server', $this->_server->headers['User-Agent'], $this->_server->methodname, $this->_server->request, $this->_server->response, $this->_server->result);
//Calls inherited constructor
* register a service function with the server
* @param string $name the name of the PHP function, class.method or class..method
* @param array $in assoc array of input values: key = param name, value = param type
* @param array $out assoc array of output values: key = param name, value = param type
* @param mixed $namespace the element namespace for the method or false
* @param mixed $soapaction the soapaction for the method or false
* @param mixed $style optional (rpc|document) or false Note: when 'document' is specified, parameter and return wrappers are created for you automatically
* @param mixed $use optional (encoded|literal) or false
* @param string $documentation optional Description to include in WSDL
* @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded)
function register($name,$in= array(),$out= array(),$namespace= false,$soapaction= false,$style= false,$use= false,$documentation= '',$encodingStyle= '')
if ($namespace== false) $namespace= $this->_namespace;
$this->_server->register($name,$in,$out,$namespace,$soapaction,$style,$use,$documentation,$encodingStyle);
* adds a complex type to the schema
* array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'string[]'),
* example: PHP associative array ( SOAP Struct )
* array('myVar'=> array('name'=>'myVar','type'=>'string')
* @param typeClass (complexType|simpleType|attribute)
* @param phpType: currently supported are array and struct (php assoc array)
* @param compositor (all|sequence|choice)
* @param restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
* @param elements = array ( name = array(name=>'',type=>'') )
* 'ref' => "http://schemas.xmlsoap.org/soap/encoding/:arrayType",
* "http://schemas.xmlsoap.org/wsdl/:arrayType" => "string[]"
* @param arrayType: namespace:name (http://www.w3.org/2001/XMLSchema:string)
function addComplexType($name,$typeClass= 'complexType',$phpType= 'array',$compositor= '',$restrictionBase= '',$elements= array(),$attrs= array(),$arrayType= '')
$this->_server->wsdl->addComplexType($name,$typeClass, $phpType,$compositor,$restrictionBase,$elements,$attrs,$arrayType);
|