/** * Parses the session reponse element. Please see file * <code>SessionResponse.dtd</code> for the corresponding DTD of the * SessionResponse. * * @return a <code>SessionResponse</code> object. */ public function parseXML() { if ($this->document == null) { return null; } // get document element $elem = $this->document->documentElement; $this->sessionResponse = new SessionResponse(null, null); // set session response attribute $temp = $elem->getAttribute("vers"); $this->sessionResponse->setResponseVersion($temp); // set session reqid $temp = $elem->getAttribute("reqid"); $this->sessionResponse->setRequestID($temp); // check GetSession element $nodelist = $elem->getElementsByTagname("GetSession"); if ($nodelist != null && $nodelist->length != 0) { $this->sessionResponse->setMethodID(SessionRequest::GetSession); } // check GetActiveSessions element $nodelist = $elem->getElementsByTagname("GetActiveSessions"); if ($nodelist != null && $nodelist->length != 0) { $this->sessionResponse->setMethodID(SessionRequest::GetValidSessions); } // check DestroySession element $nodelist = $elem->getElementsByTagname("DestroySession"); if ($nodelist != null && $nodelist->length != 0) { $this->sessionResponse->setMethodID(SessionRequest::DestroySession); } // check Logout element $nodelist = $elem->getElementsByTagname("Logout"); if ($nodelist != null && $nodelist->length != 0) { $this->sessionResponse->setMethodID(SessionRequest::Logout); } // check AddSessionListener element $nodelist = $elem->getElementsByTagname("AddSessionListener"); if ($nodelist != null && $nodelist->length != 0) { $this->sessionResponse->setMethodID(SessionRequest::AddSessionListener); } // check AddSessionListenerOnAllSessions element $nodelist = $elem->getElementsByTagname("AddSessionListenerOnAllSessions"); if ($nodelist != null && $nodelist->length != 0) { $this->sessionResponse->setMethodID(SessionRequest::AddSessionListenerOnAllSessions); } // check SetProperty element $nodelist = $elem->getElementsByTagname("SetProperty"); if ($nodelist != null && $nodelist->length != 0) { $this->sessionResponse->setMethodID(SessionRequest::SetProperty); } // check GetSessionCount element $nodelist = $elem->getElementsByTagname("GetSessionCount"); if ($nodelist != null && $nodelist->length != 0) { $this->sessionResponse->setMethodID(SessionRequest::GetSessionCount); } // check COUNT element $nodelist = $elem->getElementsByTagname("SessionExpirationTimeInfo"); if ($nodelist != null && $nodelist->length != 0) { SessionResponseParser::parseAllSessionsGivenUUIDElements($nodelist); } // check Session element $nodelist = $elem->getElementsByTagname("Session"); if ($nodelist != null && $nodelist->length != 0) { SessionResponseParser::parseSessionElements($nodelist); } // check OK element $nodelist = $elem->getElementsByTagname("OK"); if ($nodelist != null && $nodelist->length != 0) { $this->sessionResponse->setBooleanFlag(true); } // check Exception element $nodelist = $elem->getElementsByTagname("Exception"); if ($nodelist != null && $nodelist->length != 0) { $this->sessionResponse->setException(SessionRequestParser::parseCDATA($nodelist->item(0))); } // check Status element $nodelist = $elem->getElementsByTagname("Status"); if ($nodelist != null && $nodelist->length != 0) { $this->sessionResponse->setStatus(SessionRequestParser::parseCDATA($nodelist->item(0))); } // return session reponse return $this->sessionResponse; }