metaregistrar / php-epp-client

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

Command syntax error in ficora #62

Closed mazanax closed 7 years ago

mazanax commented 7 years ago

I'm trying to get info of domain registered thru ficora but it returns syntax error. What I'm doing wrong?

        $info = new eppInfoDomainRequest(new eppDomain($domain));
        if ($response = $this->conn->request($info)) { // throws exception with syntax error
            /** @var \Metaregistrar\EPP\eppInfoDomainResponse $response */
            $data = $response->getDomain();
            foreach ($data->getContacts() as $contact) {
                /** @var eppContactHandle $contact */
                echo $contact->getContactType() . ': ' . $contact->getContactHandle() . PHP_EOL;
            }
        }

$this->conn:

        $conn = new \Metaregistrar\EPP\ficoraEppConnection();
        $conn->setHostname($host);
        $conn->setPort($port);
        $conn->setUsername($username);
        $conn->setPassword($password);

        if (null === $conn) {
            throw new RuntimeException('Cannot create connect to ficora');
        }
        $conn->enableCertification($key, $keyPassword, false);
        $this->conn = $conn;
        $this->conn->login();
vincentdecarpigny commented 7 years ago

Hi Alexander,

as far as I know you cannot use the eppInfoDomainRequest directly, you need to extend it like this :

<?php namespace Metaregistrar\EPP;

class ficoraEppInfoDomainRequest extends eppInfoDomainRequest {

/*

<?xml version="1.0" encoding="UTF-8"?>

mydummydomainname.fi LoloL 5809c755b90a5

*/

function construct($infodomain, $hosts = null, $namespacesinroot = true){ parent::construct($infodomain, $hosts = null, $namespacesinroot = true); $this->addFICORAExtension(); $this->addSessionId(); //tprint(htmlentities($this->saveXML())); }

public function addFICORAExtension(){ $this->domainobject->setAttribute('xmlns:domain','urn:ietf:params:xml:ns:domain-1.0'); } }

Best, Vincent

2016-11-29 15:05 GMT+01:00 Alexander notifications@github.com:

I'm trying to get info of domain registered thru ficora but it returns syntax error. What I'm doing wrong?

$info = new eppInfoDomainRequest(new eppDomain($domain)); if ($response = $this->conn->request($info)) { // throws exception with syntax error /* @var \Metaregistrar\EPP\eppInfoDomainResponse $response / $data = $response->getDomain(); foreach ($data->getContacts() as $contact) { /* @var eppContactHandle $contact / echo $contact->getContactType() . ': ' . $contact->getContactHandle() . PHP_EOL; } }

$this->conn: `/* @var https://github.com/var \Metaregistrar\EPP\ficoraEppConnection $conn / $conn = new \Metaregistrar\EPP\ficoraEppConnection(); $conn->setHostname($host); $conn->setPort($port); $conn->setUsername($username); $conn->setPassword($password);

if (null === $conn) {
    throw new RuntimeException('Cannot create connect to ficora');
}
$conn->enableCertification($key, $keyPassword, false);
$this->conn = $conn;
$this->conn->login();

`

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/metaregistrar/php-epp-client/issues/62, or mute the thread https://github.com/notifications/unsubscribe-auth/AHF94olEK_OVL7qhbmO5c-iqDExLg-mnks5rDDEdgaJpZM4K_Agj .

aksl commented 7 years ago

It would be enough to just use false parameter for $namespacesinroot argument of the request constructor. This applies atleast to the following classes when communicating with Ficora:

Example request with namespacesinroot set to false:

<?xml version="1.0" encoding="UTF-8"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1" xmlns:ficora="http://www.ficora.fi/epp/ficora">
  <command>
    <info>
      <domain:info xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
        <domain:name hosts="all">DOMAIN</domain:name>
        <domain:authInfo>
          <domain:pw></domain:pw>
        </domain:authInfo>
      </domain:info>
    </info>
    <clTRID>....</clTRID>
  </command>
</epp>

As you can see from eppDomainRequest, setting it to false does exactly the same as adding a special method for it:

if (!$this->rootNamespaces()) {
    $this->domainobject->setAttribute('xmlns:domain','urn:ietf:params:xml:ns:domain-1.0');
}

Removing the addFicoraExtension() -method and replacing it with different default value for $namespacesinroot might be a lighter approach.