module CASClient::XmlResponse

Attributes

failure_code[R]
failure_message[R]
parse_datetime[R]
xml[R]

Public Instance Methods

check_and_parse_xml(raw_xml) click to toggle source
# File lib/casclient/responses.rb, line 6
def check_and_parse_xml(raw_xml)
  begin
    doc = REXML::Document.new(raw_xml, :raw => :all)
  rescue REXML::ParseException => e
    raise BadResponseException, 
      "MALFORMED CAS RESPONSE:\n#{raw_xml.inspect}\n\nEXCEPTION:\n#{e}"
  end

  unless doc.elements && doc.elements["cas:serviceResponse"]
    raise BadResponseException, 
      "This does not appear to be a valid CAS response (missing cas:serviceResponse root element)!\nXML DOC:\n#{doc.to_s}"
  end

  return doc.elements["cas:serviceResponse"].elements[1]
end
to_s() click to toggle source
# File lib/casclient/responses.rb, line 22
def to_s
  xml.to_s
end