metaregistrar / php-epp-client

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

Norid epp transfer request parse error #202

Closed joveice closed 5 years ago

joveice commented 5 years ago

Request:

-----WRITE-----2019-06-14 10:00:31-----
<?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:secDNS="urn:ietf:params:xml:ns:secDNS-1.1" xmlns:no-ext-epp="http://www.norid.no/xsd/no-ext-epp-1.0" xmlns:no-ext-result="http://www.norid.no/xsd/no-ext-result-1.0" xmlns:no-ext-domain="http://www.norid.no/xsd/no-ext-domain-1.1" xmlns:no-ext-contact="http://www.norid.no/xsd/no-ext-contact-1.0" xmlns:no-ext-host="http://www.norid.no/xsd/no-ext-host-1.0">
  <extension>
    <command xmlns="http://www.norid.no/xsd/no-ext-epp-1.0">
      <clTRID>***</clTRID>
    </command>
  </extension>
</epp>

-----END-----2019-06-14 10:00:31-----

Response:

-----READ-----2019-06-14 10:00:31-----
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:ietf:params:xml:ns:epp-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
  <response>
    <result code="2001">
      <msg>Command syntax error</msg>
    </result>
    <extension>
      <conditions xmlns="http://www.norid.no/xsd/no-ext-result-1.0" xsi:schemaLocation="http://www.norid.no/xsd/no-ext-result-1.0 no-ext-result-1.0.xsd">
        <condition code="EC000015" severity="error">
          <msg>EPP parse error</msg>
          <details>Parse error at line [2], column [1871]: Element '{http://www.norid.no/xsd/no-ext-epp-1.0}clTRID': This element is not expected. Expected is one of ( {http://www.norid.no/xsd/no-ext-epp-1.0}transfer, {http://www.norid.no/xsd/no-ext-epp-1.0}withdraw ).
</details>
        </condition>
      </conditions>
    </extension>
    <trID>
      <svTRID>***</svTRID>
    </trID>
  </response>
</epp>

-----END-----2019-06-14 10:00:31-----

Code:

$domain = new noridEppDomain($domain);
$domain->setAuthorisationCode($code);
$transfer = new noridEppTransferRequest(eppTransferRequest::OPERATION_REQUEST, $domain);
$this->conn->request($transfer);

I'm not sure what is wrong or if I'm missing something, the request looks quite empty. Due to https://github.com/metaregistrar/php-epp-client/commit/551d3c06b1e2c5f147ca161ea38473bbb96da8ae I'm gonna guess it has worked / is working but I do it wrong. @alexrsagen mind taking a look?

alexrsagen commented 5 years ago

I assume that you want to execute a domain transfer and not request a Norid transfer token here, because you call setAuthorisationCode.

eppTransferRequest::OPERATION_REQUEST is wrong for Norid transfers where an authInfo code or Norid transfer token is known... You must specify noridEppTransferRequest::OPERATION_EXECUTE if you wish to execute a domain transfer with a known authInfo code or Norid transfer token. This is Norid-specific. See the Norid EPP documentation page 27.

However if you want to request a Norid transfer token in a case where authInfo code is not known, you can specify eppTransferRequest::OPERATION_REQUEST and ensure notify email is set on the noridEppDomain object. This seems to currently be broken, I will fix that now.

joveice commented 5 years ago

Okey, yes I believe that would be correct since I know the code. Now this did return an exception:

ErrorException (E_USER_NOTICE)
Operation parameter should be QUERY, REQUEST, CANCEL, APPROVE or REJECT on eppTransferRequest, ignore this if you are using a custom transfer operation

Now it says I can ignore this, but I don't see how I can ignore an exception thrown by the function call. Thanks for the quick response!

alexrsagen commented 5 years ago

That is an E_USER_NOTICE. It does not interrupt code execution at all, your code will function normally. To suppress the notice, you may prepend an @ to the command which causes the notice.

Example:

@$this->conn->request($transfer);

To elaborate on this specific notice, this was originally an error which did interrupt code execution, which would make the Norid transfer request not work. So a long while ago i changed this to a notice so that people are still informed if they use an invalid transfer operation, while allowing for Norid's custom transfer operation "execute". (which is why it contains ignore this if you are using a custom transfer operation)

joveice commented 5 years ago

Thanks a lot @alexrsagen. It's working. the @ had to be placed at the new noridEppTransferRequest since that was what threw the exception, confused me too first as I thought it was the conn->request :P