metaregistrar / php-epp-client

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

Error 2001: Command syntax error (Exactly one node must be given.) #162

Closed joelunge closed 5 years ago

joelunge commented 5 years ago

Hi!

I'm trying to register a domain. But I get this error code: Error 2001: Command syntax error (Exactly one node must be given.)

Here is the code I'm trying to execute. It fails in the line with $contactid = $this->createcontact.

    $domainname = 'mynewdomain.se';

    echo "Registering $domainname\n";
    try {
    // Please enter your own settings file here under before using this example
        if ($conn = eppConnection::create(config_path('settings.ini'))) {
    // Connect to the EPP server
            if ($conn->login()) {
                if (!$this->checkhosts($conn, array('ns1.metaregistrar.nl'))) {
                    $this->createhost($conn, 'ns1.metaregistrar.nl');
                }
                if (!$this->checkhosts($conn, array('ns2.metaregistrar.nl'))) {
                    $this->createhost($conn, 'ns2.metaregistrar.nl');
                }
                $nameservers = array('ns1.metaregistrar.nl','ns2.metaregistrar.nl');

                $email = 'myemail@example.com';
                $phone =    '+46.700000000';
                $name = 'George Hanson';
                $organization = null;
                $address = 'Streetname 1';
                $postcode = '12345';
                $city = 'Stockholm';
                $country = 'SE';

                $contactid = $this->createcontact($conn, $email, $phone, $name, $organization, $address, $postcode, $city, $country);
                if ($contactid) {
                    // $this->createdomain($conn, $domainname, $contactid, $contactid, $contactid,  
                    $contactid, $nameservers);
                }
                $conn->logout();
            }
        }
    } catch (eppException $e) {
        echo $e->getMessage();
    }

Any ideas what causes the issue?

This code is straight from the registerdomain example code.

Other examples such as checkdomain is working properly.

Thanks in advance, Joel

metaregistrar commented 5 years ago

Hi Joel,

The error does not ring a bell for me. Can you please list the whole error message. If you use $conn = eppConnection::create(config_path('settings.ini'),true) then logging is enabled and you can see exactly what the problem is with the command.

joelunge commented 5 years ago

Hi!

Thanks for the fast response.

Here is the complete error message:

Registering mynewdomain.se 

Error 2001: Command syntax error (Exactly one node must be given.)

==== LOG ====

-----CONNECT-----
2018-10-16 10:44:08-----
Connection made
-----END-----

2018-10-16 10:44:08-----

-----WRITE-----
2018-10-16 10:44:08-----
XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 1.0 en urn:ietf:params:xml:ns:domain-1.0 urn:ietf:params:xml:ns:contact-1.0 urn:ietf:params:xml:ns:host-1.0 5bc5a4d8abef8
-----END-----

2018-10-16 10:44:08-----
-----READ-----2018-10-16 10:44:08-----
Command completed successfully 5bc5a4d8abef8 133764561
-----END-----2018-10-16 10:44:08-----

-----LOGIN-----2018-10-16 10:44:08-----
Logged in
-----END-----

2018-10-16 10:44:08-----
-----WRITE-----
2018-10-16 10:44:08-----
MRG5bc5a4d8c8022 
George Hanson Streetname 1 Stockholm 12345 SE +46.700000000 myemail@example.com fubar 5bc5a4d8c83e8
-----END-----

2018-10-16 10:44:08-----
-----READ-----
2018-10-16 10:44:08-----
Command syntax error Exactly one node must be given. 5bc5a4d8c83e8 133764562
-----END-----2018-10-16 10:44:08-----

-----WRITE-----
2018-10-16 10:44:08-----
5bc5a4d8db2a2
-----END-----2018-10-16 10:44:08-----

-----READ-----
2018-10-16 10:44:08-----
Command completed successfully; ending session 5bc5a4d8db2a2 133764563
-----END-----

2018-10-16 10:44:08-----
-----LOGOUT-----
2018-10-16 10:44:08-----
Logged out
-----END-----

2018-10-16 10:44:08-----
-----DISCONNECT-----
2018-10-16 10:44:08-----
Disconnected
-----END-----
2018-10-16 10:44:08-----

Any ideas what might be the problem?

Thanks in advance, Joel

metaregistrar commented 5 years ago

Hello Joel,

Your output is not very readable, the XML structure is missing. Can you put it between < code > segments? Like this:

code here

I need only the error command and the error output, login and logout is not needed.

joelunge commented 5 years ago

Hello!

Is this better?

Error 2001: Command syntax error (Exactly one node must be given.)

==== LOG ====
2018-10-16 10:44:08-----
-----WRITE-----
2018-10-16 10:44:08-----
MRG5bc5a4d8c8022 
George Hanson Streetname 1 Stockholm 12345 SE +46.700000000 myemail@example.com fubar 5bc5a4d8c83e8
-----END-----

2018-10-16 10:44:08-----
-----READ-----
2018-10-16 10:44:08-----
Command syntax error Exactly one node must be given. 5bc5a4d8c83e8 133764562
-----END-----2018-10-16 10:44:08-----

Thanks in advance, Joel

metaregistrar commented 5 years ago

If you use the way outlined here to mark your code: https://stackoverflow.com/questions/9751548/how-do-i-correctly-paste-multi-line-xml-snippet-to-github-wiki-when-using-markdo

It will look like this:

  <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
    <command>
      <info>
        <obj:info xmlns:obj="urn:ietf:params:xml:ns:obj">
          <obj:name>example</obj:name>
        </obj:info>
      </info>
      <clTRID>ABC-12345</clTRID>
   </command>
  </epp>
joelunge commented 5 years ago

Oh ok I see, here is the XML:

-----WRITE-----2018-10-16 10:42:37-----
<?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>
    <create>
      <contact:create>
        <contact:id>MRG5bc5a47decb24</contact:id>
        <contact:postalInfo type="loc">
          <contact:name>George Hanson</contact:name>
          <contact:addr>
            <contact:street>Streetname 1</contact:street>
            <contact:city>Stockholm</contact:city>
            <contact:pc>12345</contact:pc>
            <contact:cc>SE</contact:cc>
          </contact:addr>
        </contact:postalInfo>
        <contact:voice>+46.700000000</contact:voice>
        <contact:email>myemail@example.com</contact:email>
        <contact:authInfo>
          <contact:pw>fubar</contact:pw>
        </contact:authInfo>
      </contact:create>
    </create>
    <clTRID>5bc5a47decd31</clTRID>
  </command>
</epp>

-----END-----2018-10-16 10:42:37-----

-----READ-----2018-10-16 10:42:38-----
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
    <response>
        <result code="2001">
            <msg>Command syntax error</msg>
            <extValue>
                <value>
                    <iis:orgno xmlns:iis="urn:se:iis:xml:epp:iis-1.2"></iis:orgno>
                </value>
                <reason>Exactly one node must be given.</reason>
            </extValue>
        </result>
        <trID>
            <clTRID>5bc5a47decd31</clTRID>
            <svTRID>133764468</svTRID>
        </trID>
    </response>
</epp>
metaregistrar commented 5 years ago

Ah, that explains things

The IIS system is complaining about iis:orgno

<iis:orgno xmlns:iis="urn:se:iis:xml:epp:iis-1.2"></iis:orgno>

So it seems it is that node that the system is missing.

When creating a new contact, the standard eppCreateContact request will not add this field

What you need is an iisEppCreateContactRequest, and you can use that only if in the settings.ini you specify

interface=iisEppConnection