metaregistrar / php-epp-client

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

Error 2001: Command syntax error #90

Closed MartVisser closed 7 years ago

MartVisser commented 7 years ago

Hi, by every request I get Error 2001, what I'm doing wrong?

# php infodomain.php "test.nl"
Retrieving info on test.nl
ERROR: Error 2001: Command syntax error

==== LOG ====
-----CONNECT-----2017-02-23 13:12:44-----
Connection made
-----END-----2017-02-23 13:12:44-----

-----WRITE-----2017-02-23 13:12:44-----
<?xml version="1.0" encoding="UTF-8"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xmlns:contact="urn:ietf:params:xml:ns:contact-1.0" xmlns:host="urn:ietf:params:xml:ns:host-1.0">
  <command>
    <login>
      <clID>XXX</clID>
      <pw><![CDATA[XXX]]></pw>
      <options>
        <version>1.0</version>
        <lang>en</lang>
      </options>
      <svcs>
        <objURI>urn:ietf:params:xml:ns:domain-1.0</objURI>
        <objURI>urn:ietf:params:xml:ns:contact-1.0</objURI>
        <objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
      </svcs>
    </login>
    <clTRID>XXX</clTRID>
  </command>
</epp>

-----END-----2017-02-23 13:12:44-----

-----READ-----2017-02-23 13:12:44-----
<?xml version="1.0" encoding="UTF-8"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  <response>
    <result code="2001">
      <msg>Command syntax error</msg>
    </result>
    <trID>
      <clTRID>XXX</clTRID>
      <svTRID>SIDN</svTRID>
    </trID>
  </response>
</epp>

-----END-----2017-02-23 13:12:44-----

-----DISCONNECT-----2017-02-23 13:12:44-----
Disconnected
-----END-----2017-02-23 13:12:44-----

infodomain.php (only changed/added the following from example):

[...]
new Metaregistrar\EPP\sidnEppConnection();
[...]
$conn = eppConnection::create('settings.ini', true)
[...]

settings.ini:

interface=eppConnection
hostname=ssl://drs.domain-registry.nl
port=700
userid=XXX
password=XXX
metaregistrar commented 7 years ago

Hoi Mart,

Please try to create a sidnEppConnection, since that connection contains the login command that SIDN expects.

MartVisser commented 7 years ago

Changed eppConnection::create to sidnEppConnection::create but still getting the same error:

# php infodomain.php test.nl
Retrieving info on test.nl
ERROR: Error 2001: Command syntax error

==== LOG ====
-----CONNECT-----2017-02-23 13:45:58-----
Connection made
-----END-----2017-02-23 13:45:58-----

-----WRITE-----2017-02-23 13:45:58-----
<?xml version="1.0" encoding="UTF-8"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xmlns:contact="urn:ietf:params:xml:ns:contact-1.0" xmlns:host="urn:ietf:params:xml:ns:host-1.0" xmlns:sidn-ext-epp="http://rxsd.domain-registry.nl/sidn-ext-epp-1.0" xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
  <command>
    <login>
      <clID>XXX</clID>
      <pw><![CDATA[XXX]]></pw>
      <options>
        <version>1.0</version>
        <lang>en</lang>
      </options>
      <svcs>
        <objURI>urn:ietf:params:xml:ns:domain-1.0</objURI>
        <objURI>urn:ietf:params:xml:ns:contact-1.0</objURI>
        <objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
        <svcExtension>
          <extURI>http://rxsd.domain-registry.nl/sidn-ext-epp-1.0</extURI>
          <extURI>urn:ietf:params:xml:ns:secDNS-1.1</extURI>
        </svcExtension>
      </svcs>
    </login>
    <clTRID>XXX</clTRID>
  </command>
</epp>

-----END-----2017-02-23 13:45:58-----

-----READ-----2017-02-23 13:45:58-----
<?xml version="1.0" encoding="UTF-8"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  <response>
    <result code="2001">
      <msg>Command syntax error</msg>
    </result>
    <trID>
      <clTRID>XXX</clTRID>
      <svTRID>SIDN</svTRID>
    </trID>
  </response>
</epp>

-----END-----2017-02-23 13:45:58-----

-----DISCONNECT-----2017-02-23 13:45:58-----
Disconnected
-----END-----2017-02-23 13:45:58-----
metaregistrar commented 7 years ago

That is strange, i can connect to SIDN without a problem.

Are you sure you are using the latest version of php-epp-client? The log hereunder is made with the most recent version.

-----CONNECT-----2017-02-23 13:57:56-----
Connection made
-----END-----2017-02-23 13:57:56-----

-----WRITE-----2017-02-23 13:57:56-----
<?xml version="1.0" encoding="UTF-8"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xmlns:contact="urn:ietf:params:xml:ns:contact-1.0" xmlns:host="urn:ietf:params:xml:ns:host-1.0" xmlns:sidn-ext-epp="http://rxsd.domain-registry.nl/sidn-ext-epp-1.0" xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
  <command>
    <login>
      <clID>XXXXXX</clID>
      <pw><![CDATA[XXXXXXXXXX]]></pw>
      <options>
        <version>1.0</version>
        <lang>en</lang>
      </options>
      <svcs>
        <objURI>urn:ietf:params:xml:ns:domain-1.0</objURI>
        <objURI>urn:ietf:params:xml:ns:contact-1.0</objURI>
        <objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
        <svcExtension>
          <extURI>http://rxsd.domain-registry.nl/sidn-ext-epp-1.0</extURI>
          <extURI>urn:ietf:params:xml:ns:secDNS-1.1</extURI>
        </svcExtension>
      </svcs>
    </login>
    <clTRID>58aedc5459149</clTRID>
  </command>
</epp>

-----END-----2017-02-23 13:57:56-----

-----READ-----2017-02-23 13:57:58-----
<?xml version="1.0" encoding="UTF-8"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  <response>
    <result code="1000">
      <msg>The transaction was completed successfully.</msg>
    </result>
    <trID>
      <clTRID>58aedc5459149</clTRID>
      <svTRID>BEC737BF-FD4B-A4F3-8CFB-39CB8AD6D0ED</svTRID>
    </trID>
  </response>
</epp>

-----END-----2017-02-23 13:57:58-----
MartVisser commented 7 years ago

Yes, I'm on MASTER. Just tested it on another server but still 'ERROR: Error 2001: Command syntax error'.

Steps I did:

infodomain.php:

<?php
require('../autoloader.php');

use Metaregistrar\EPP\eppConnection;
use Metaregistrar\EPP\sidnEppConnection;
use Metaregistrar\EPP\eppException;
use Metaregistrar\EPP\eppDomain;
use Metaregistrar\EPP\eppInfoDomainRequest;
use Metaregistrar\EPP\eppContactHandle;
use Metaregistrar\EPP\eppHost;

/*
 * This script retrieves all information for a specific domain name
 */

if ($argc <= 1) {
    echo "Usage: infodomain.php <domainname>\n";
    echo "Please enter a domain name retrieve\n\n";
    die();
}
$domainname = $argv[1];

echo "Retrieving info on " . $domainname . "\n";
try {
    // Please enter your own settings file here under before using this example
    if ($conn = sidnEppConnection::create('settings.ini')) {
        // Connect to the EPP server
        if ($conn->login()) {
            $result = infodomain($conn, $domainname);
            $conn->logout();
        }
    }
} catch (eppException $e) {
    echo "ERROR: " . $e->getMessage() . "\n\n";
}

/**
 * @param $conn Metaregistrar\EPP\eppConnection
 * @param $domainname string
 * @return string
 */
function infodomain($conn, $domainname) {
    try {
        $info = new eppInfoDomainRequest(new eppDomain($domainname));
        if ($response = $conn->request($info)) {
            /* @var $response Metaregistrar\EPP\eppInfoDomainResponse */
            $d = $response->getDomain();
            echo "Info domain for " . $d->getDomainname() . ":\n";
            echo "Created on " . $response->getDomainCreateDate() . "\n";
            echo "Last update on ".$response->getDomainUpdateDate()."\n";
            echo "Registrant " . $d->getRegistrant() . "\n";
            echo "Contact info:\n";
            foreach ($d->getContacts() as $contact) {
                /* @var $contact eppContactHandle */
                echo "  " . $contact->getContactType() . ": " . $contact->getContactHandle() . "\n";
            }
            echo "Nameserver info:\n";
            foreach ($d->getHosts() as $nameserver) {
                /* @var $nameserver eppHost */
                echo "  " . $nameserver->getHostname() . "\n";
            }
        } else {
            echo "ERROR2\n";
        }
    } catch (eppException $e) {
        return $e->getMessage();
    }
    return null;
}

settings.ini:

interface=sidnEppConnection
hostname=ssl://drs.domain-registry.nl
port=700
userid=XXX
password=XXX
metaregistrar commented 7 years ago

Hi,

The only thing i see 'wrong' in your script, is that in our original infodomain.php example the code is like this: if ($conn = eppConnection::create('settings.ini')) {

where you have: if ($conn = sidnEppConnection::create('settings.ini')) {

But this should not make any difference.

Are you able to connect to the test service of SIDN?

Your code looks absolutely correct, maybe you can reach out to SIDN and ask them what is wrong about the command you have sent?

MartVisser commented 7 years ago

Send the command to Sidn and they answered the following:

Wanneer je het login-commando uit onze EPP-handleiding gebruikt, moet je als het goed wel kunnen inloggen. Het inlog-commando vind je op pagina 54 van onze EPP-handleiding: https://registrars.sidn.nl/downloads/system-information/DRS_Handleiding_EPP_NL_v2.8.pdf Het login-commando in de handleiding heeft een andere header zo te zien.

So they're probably talking about:

<?xml version="1.0" encoding="UTF-8"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xmlns:contact="urn:ietf:params:xml:ns:contact-1.0" xmlns:host="urn:ietf:params:xml:ns:host-1.0" xmlns:sidn-ext-epp="http://rxsd.domain-registry.nl/sidn-ext-epp-1.0" xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">

And the doc says:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
metaregistrar commented 7 years ago

Well, that is strange, since we are using the same command as you and it works out fine.

Could you try checking out this branch: https://github.com/metaregistrar/php-epp-client/tree/namespaces-in-root-or-not

This is a branch where i have experimented removing the namespaces from the root and placing them only in the specific commands where they are used.

martijn commented 7 years ago

I was facing the same issue but it turned out the cause was an incorrect password. Maybe some day SIDN is going to fix the password reset forms in the DRS web interface.. resetting the DRS password an additional time fixed it for me.