28 const TNS =
'http://wcmf.sourceforge.net';
30 private $_application = null;
32 private static $_logger = null;
38 if (self::$_logger == null) {
42 $endpoint = dirname($scriptURL).
'/soap';
43 $this->configureWSDL(
'SOAPService', self::TNS, $endpoint,
'document');
44 $this->wsdl->schemaTargetNamespace = self::TNS;
47 $this->wsdl->addComplexType(
55 array(
'ref' =>
'SOAP-ENC:arrayType',
'wsdl:arrayType' =>
'xsd:string[]')
60 $this->wsdl->addComplexType(
68 array(
'ref' =>
'SOAP-ENC:arrayType',
'wsdl:arrayType' =>
'tns:SearchResultItem[]')
70 'tns:SearchResultItem'
73 $this->wsdl->addComplexType(
'SearchResultItem',
'complexType',
'struct',
'sequence',
'',
75 'type' => array(
'name' =>
'type',
'type' =>
'xsd:string'),
76 'oid' => array(
'name' =>
'oid',
'type' =>
'xsd:string'),
77 'displayValue' => array(
'name' =>
'displayValue',
'type' =>
'xsd:string'),
78 'summary' => array(
'name' =>
'summary',
'type' =>
'xsd:string')
85 $this->_application->initialize();
88 $this->handleException($ex);
96 if (self::$_logger->isDebugEnabled()) {
97 self::$_logger->debug($data);
100 $oldErrorReporting = error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);
101 parent::service($data);
102 error_reporting($oldErrorReporting);
105 $this->handleException($ex);
124 public function doCall($action, $params) {
125 if (self::$_logger->isDebugEnabled()) {
126 self::$_logger->debug(
"SoapServer action: ".$action);
127 self::$_logger->debug($params);
129 $authHeader = $this->requestHeader[
'Security'][
'UsernameToken'];
132 $request->setAction(
'actionSet');
133 $request->setFormat(
'soap');
134 $request->setResponseFormat(
'null');
135 $request->setValues(array(
140 'user' => $authHeader[
'Username'],
141 'password' => $authHeader[
'Password'][
'!']
156 $actionResponse->setFinal();
158 $response = $this->_application->run($request);
159 if ($response->hasErrors()) {
160 $errors = $response->getErrors();
164 $responseData = $response->getValue(
'data');
165 $data = $responseData[
'action2'];
166 $actionResponse->setSender($data[
'controller']);
167 $actionResponse->setContext($data[
'context']);
168 $actionResponse->setAction($data[
'action']);
169 $actionResponse->setFormat(
'soap');
170 $actionResponse->setValues($data);
172 $formatter->serialize($actionResponse);
173 if (self::$_logger->isDebugEnabled()) {
174 self::$_logger->debug($actionResponse->__toString());
179 $this->handleException($ex);
181 return $actionResponse;
188 private function handleException($ex) {
189 self::$_logger->error($ex->getMessage().
"\n".$ex->getTraceAsString());
190 $this->fault(
'SOAP-ENV:SERVER', $ex->getMessage(),
'',
'');
Application is the main application class, that does all the initialization.
ObjectId is the unique identifier of an object.
static getLogger($name)
Get the logger with the given name.
static getInstance($name, $dynamicConfiguration=array())
Service related interfaces and classes.
SoapServer extends nusoap server to actually process requests inside the application context...
__construct()
Constructor.
getDummyOid($type)
Get a dummy object id to be used in a request.
doCall($action, $params)
Process a soap call.
ApplicationException signals a general application exception.