hasAttributeNS(Constants::NS_SOAP, 'mustUnderstand')) { throw new Exception('Missing SOAP-ENV:mustUnderstand attribute in .'); } if ($xml->getAttributeNS(Constants::NS_SOAP, 'mustUnderstand') !== '1') { throw new Exception('Invalid value of SOAP-ENV:mustUnderstand attribute in .'); } if (!$xml->hasAttributeNS(Constants::NS_SOAP, 'actor')) { throw new Exception('Missing SOAP-ENV:actor attribute in .'); } if ($xml->getAttributeNS(Constants::NS_SOAP, 'actor') !== 'http://schemas.xmlsoap.org/soap/actor/next') { throw new Exception('Invalid value of SOAP-ENV:actor attribute in .'); } if (!$xml->hasAttribute('AssertionConsumerServiceURL')) { throw new Exception('Missing AssertionConsumerServiceURL attribute in .'); } $this->AssertionConsumerServiceURL = $xml->getAttribute('AssertionConsumerServiceURL'); } /** * Convert this ECP Response to XML. * * @param DOMElement $parent The element we should append this element to. */ public function toXML(DOMElement $parent) { if (!is_string($this->AssertionConsumerServiceURL)) { throw new InvalidArgumentException("AssertionConsumerServiceURL must be a string"); } $doc = $parent->ownerDocument; $response = $doc->createElementNS(Constants::NS_ECP, 'ecp:Response'); $parent->appendChild($response); $response->setAttributeNS(Constants::NS_SOAP, 'SOAP-ENV:mustUnderstand', '1'); $response->setAttributeNS(Constants::NS_SOAP, 'SOAP-ENV:actor', 'http://schemas.xmlsoap.org/soap/actor/next'); $response->setAttribute('AssertionConsumerServiceURL', $this->AssertionConsumerServiceURL); return $response; } }