metaregistrar / php-epp-client

Object-oriented PHP EPP Client
https://www.metaregistrar.com/docs/
MIT License
214 stars 159 forks source link

line:2 column:412: Element not allowed: extension@urn:ietf:params:xml:ns:epp-1.0 in element command@urn:ietf:params:xml:ns:epp-1.0 #274

Closed sayoki closed 4 years ago

sayoki commented 4 years ago

I added the following code to eppCheckDomainRequest.php to add the version 2 check to DNS Belgium:

public function addDnsbeExtension() {
    $this->addExtension('xmlns:dnsbe', 'http://www.dns.be/xml/epp/dnsbe-1.0');
    $ext = $this->createElement('extension');
    $sidnext = $this->createElement('dnsbe:ext');
    $check = $this->createElement('dnsbe:check');
    $infodomain = $this->createElement('dnsbe:domain');
    $infodomain->setAttribute('version', '2.0');
    $check->appendChild($infodomain);
    $sidnext->appendChild($check);
    $ext->appendChild($sidnext);
    $this->getCommand()->appendChild($ext);
}

And use the following code to create a check request.

$check_request = new eppCheckDomainRequest(array($domainname)); $check_request->addDnsbeExtension();

Sadly it does not work and I get the following error: line:2 column:412: Element not allowed: extension@urn:ietf:params:xml:ns:epp-1.0 in element command@urn:ietf:params:xml:ns:epp-1.0

I tried several thing but can;t make it work.

metaregistrar commented 4 years ago

When creating an extension, the DomDocument processor always places it at the end of the XML structure.

However, EPP expects a different element at the bottom of the structure: The Server and Client transaction ID's.

To end the EPP structure with the correct session information, you must always issue this command at the bottom of your DomDocument additions:

$this->addSessionId();

This command will remove the current session ID information, and insert it again at the bottom of the XML structure, so that the EPP server does not get confused with a different order of commands.

sayoki commented 4 years ago

Thanks