EPPClient (EPP RTK Java API Documentation)
Keywords: com.tucows.oxrs.epp02.rtk.EPPClient class

### com.tucows.oxrs.epp02.rtk

# Class EPPClient

- `org.omg.CORBA.portable.ObjectImpl`
- - `com.tucows.oxrs.epp02.rtk.RTKBase`
  - - `com.tucows.oxrs.epp02.rtk.EPPClient`

Implemented Interfaces:
  epp_Session, epp_SessionOperations, org.omg.CORBA.portable.IDLEntity, org.omg.CORBA.Object

`public class EPPClient`
`extends RTKBase`
`implements epp_Session`

EPP Client -- encapsulates all the connection and communication with the EPP Server.

Version:
  $Revision: 1.3 $ $Date: 2003/09/09 16:33:22 $

Author:
  Daniel Manley

See Also:
  `DomainExample`, `ContactExample`, `HostExample`

  ## Field Summary
  `static int` | `DEFAULT_EPP_TIMEOUT` The default timeout in waiting for server responses.
  `static String` | `DEFAULT_LANG` The default language/locale: "en_US".
  `static int` | `PROTOCOL_BXXP` The indicator for using BXXP.
  `static int` | `PROTOCOL_TCP` The indicator for using only TCP streaming socket connection.
  `static int` | `PROTOCOL_TCP_TLS` The indicator for using TCP streaming socket connection with SSL/TLS.
  `static String` | `VERSION` The current EPP version.

  ### Fields inherited from class com.tucows.oxrs.epp02.rtk.RTKBase
  `CRLF`, `DATE_FMT`, `DEBUG_LEVEL_ONE`, `DEBUG_LEVEL_THREE`, `DEBUG_LEVEL_TWO`, `DEBUG_NONE`, `RTK_VERSION`, `UTC_FMT`

  ### Fields inherited from interface org.openrtk.idl.epp02.epp_Session
  `EPP_AUTHENTICATION_FAILURE`, `EPP_AUTHORIZATION_FAILURE`, `EPP_BILLING_FAILURE`, `EPP_COMMAND_COMPLETED_SUCCESSFULLY`, `EPP_COMMAND_COMPLETED_SUCCESSFULLY_ENDING_SESSION`, `EPP_COMMAND_COMPLETED_SUCCESSFULLY_MESSAGE_PRESENT`, `EPP_COMMAND_COMPLETED_SUCCESSFULLY_NOTHING_DONE`, `EPP_COMMAND_COMPLETED_SUCCESSFULLY_NO_MESSAGES`, `EPP_COMMAND_FAILED`, `EPP_COMMAND_FAILED_SERVER_ENDING_SESSION`, `EPP_COMMAND_SYNTAX_ERROR`, `EPP_COMMAND_USE_ERROR`, `EPP_DATA_MANAGEMENT_POLICY_VIOLATION`, `EPP_INVALID_AUTHORIZATION_IDENTIFIER`, `EPP_OBJECT_ASSOCIATION_PROHIBITS_OPERATION`, `EPP_OBJECT_DOES_NOT_EXIST`, `EPP_OBJECT_EXISTS`, `EPP_OBJECT_IS_NOT_ELIGIBLE_FOR_RENEWAL`, `EPP_OBJECT_IS_NOT_ELIGIBLE_FOR_TRANSFER`, `EPP_OBJECT_NOT_PENDING_TRANSFER`, `EPP_OBJECT_PENDING_TRANSFER`, `EPP_OBJECT_STATUS_PROHIBITS_OPERATION`, `EPP_PARAMETER_VALUE_POLICY_ERROR`, `EPP_PARAMETER_VALUE_RANGE_ERROR`, `EPP_PARAMETER_VALUE_SYNTAX_ERROR`, `EPP_REQUIRED_PARAMETER_MISSING`, `EPP_SESSION_LIMIT_EXCEEDED_SERVER_CLOSING_CONNECTION`, `EPP_TIMEOUT_SERVER_ENDING_SESSION`, `EPP_UNIMPLEMENTED_COMMAND`, `EPP_UNIMPLEMENTED_EXTENSION`, `EPP_UNIMPLEMENTED_OBJECT_SERVICE`, `EPP_UNIMPLEMENTED_OPTION`, `EPP_UNIMPLEMENTED_PROTOCOL_VERSION`, `EPP_UNKNOWN_COMMAND`, `RTK_COMMUNICATIONS_FAILURE`, `RTK_UNEXPECTED_SERVER_DISCONNECT`

  ## Constructor Summary
  `EPPClient()` Default constructor -- uses default version, lang and timeout values.
  `EPPClient(String epp_client_id, String epp_password)` Construtor with client id and password
  `EPPClient(String epp_host_name, int epp_host_port, String epp_client_id, String epp_password)` Constructor with EPP Hostname, EPP Host port, client id and password, in that order.

  ## Method Summary
  `void` | `connect()` Connects to the EPP Server using previously set hostname and port.
  `void` | `connect(String epp_client_id, String epp_password)` Connects to the EPP Server using the given client id and password and using the previously set EPP hostname and port.
  `void` | `connect(String epp_host_name, int epp_host_port)` Connects to the EPP Server using the given hostname and port and using the previously set client id and password.
  `void` | `connect(String epp_host_name, int epp_host_port, String epp_client_id, String epp_password)` Connects to and logs into the EPP Server using the given hostname, port, client id and password It is recommended to use connectAndGetGreeting() to connect and retrieve the EPPGreeting in one single call.
  `epp_Greeting` | `connectAndGetGreeting()` Connects to the EPP Server using previously set hostname and port.
  `void` | `disconnect()` Closes the connection to the EPP Server
  `String` | `getEPPClientID()` Accessor method for the client id.
  `String` | `getEPPHostName()` Accessor method for the EPP Hostname
  `int` | `getEPPHostPort()` Accessor method for the EPP Host port
  `String` | `getEPPPassword()` Accessor method for the password
  `int` | `getEPPTimeout()` Accessor method for the EPP server timeout, in milliseconds
  `epp_Greeting` | `getGreeting()` Retrieves the greeting from the EPP Server and returns it.
  `String` | `getLang()` Accessor method for the lang
  `long` | `getLastNetTransaction()` Accessor method for the time of the last successfull network transaction.
  `int` | `getProtocol()` Accessor method for the protocol indicator
  `String` | `getVersion()` Accessor method for the version
  `epp_Greeting` | `hello()` Issues a hello request to the EPP Server.
  `boolean` | `isValid()` returns if the connections is valid.
  `boolean` | `isVersionSentOnLogin()` Returns whether RTK version number will be send on Login.
  `void` | `login(String client_tr_id)` Logs into the EPP Server using previously set client id and password
  `void` | `login(String client_tr_id, String new_password)` Logs into the EPP Server using the previously set client id, and password If the new password is not null, it is also passed to the server to change your EPP client password. This method also includes domain, host and contact object/XML information in the services section.
  `void` | `login(String client_tr_id, String epp_client_id, String epp_password)` Logs into the EPP Server using the given client id, password
  `void` | `login(String client_tr_id, String client_id, String password, String new_password)` Logs into the EPP Server using the given client id, password and new password.
  `void` | `logout(String client_trid)` Logs out of EPP Server
  `epp_PollRsp` | `poll(String client_tr_id)`
  `epp_PollRsp` | `poll(String client_tr_id, String message_id)`
  `epp_Action` | `processAction(epp_Action request)` Method required by the epp_Action interface.
  `String` | `processXML(String request_xml)` Method required by the epp_Action interface.
  `String` | `readFromServer()` Reads a complete XML message from the EPP Server.
  `void` | `setEPPClientID(String value)` Accessor method for the client id.
  `void` | `setEPPHostName(String value)` Accessor method for the EPP Hostname
  `void` | `setEPPHostPort(int value)` Accessor method for the EPP Host port
  `void` | `setEPPPassword(String value)` Accessor method for the password
  `void` | `setEPPTimeout(int value)` Accessor method for the EPP server timeout, in milliseconds
  `void` | `setLang(String value)` Accessor method for the lang
  `void` | `setProtocol(int value)` Accessor method for the protocol indicator
  `void` | `setSocketToEPPServer(Socket value)` Bypass to the EPPClient's connect() methods.
  `void` | `setVersion(String value)` Accessor method for the version
  `void` | `setVersionSentOnLogin(boolean send)` Set whether to send RTK version number on Login.
  `void` | `writeToServer(String outbound_xml)` Sends an XML string to the EPP Server

  ### Methods inherited from class com.tucows.oxrs.epp02.rtk.RTKBase
  `_ids`, `debug`, `debug`, `getDebugLevel`, `getRTKProperties`, `setDebugLevel`

## Field Details

### DEFAULT_EPP_TIMEOUT

    public static final int DEFAULT_EPP_TIMEOUT

> The default timeout in waiting for server responses. Set to 20 seconds.
> Field Value:
>   20000

### DEFAULT_LANG

    public static final String DEFAULT_LANG

> The default language/locale: "en_US". Sent to the EPP Server on login.

### PROTOCOL_BXXP

    public static final int PROTOCOL_BXXP

> The indicator for using BXXP. Not currently supported. Introduced for possible future work.
> Field Value:
>   2

### PROTOCOL_TCP

    public static final int PROTOCOL_TCP

> The indicator for using only TCP streaming socket connection. No SSL/TLS.
> Field Value:
>   0

### PROTOCOL_TCP_TLS

    public static final int PROTOCOL_TCP_TLS

> The indicator for using TCP streaming socket connection with SSL/TLS.
> Field Value:
>   1

### VERSION

    public static final String VERSION

> The current EPP version. Sent to the EPP Server on login.

## Constructor Details

### EPPClient

    public EPPClient()

> Default constructor -- uses default version, lang and timeout values. Also defaults to use TCP/TLS in the connection to the EPP Server.

### EPPClient

    public EPPClient(String epp_client_id,
                     String epp_password)

> Construtor with client id and password
> Parameters:
>   `epp_client_id` - The EPP client id
>   `epp_password` - The password associated with the client id

### EPPClient

    public EPPClient(String epp_host_name,
                     int epp_host_port,
                     String epp_client_id,
                     String epp_password)

> Constructor with EPP Hostname, EPP Host port, client id and password, in that order.
> Parameters:
>   `epp_host_name` - The EPP Hostname (eg. "host.domain.tld")
>   `epp_host_port` - The EPP port
>   `epp_client_id` - The EPP client id
>   `epp_password` - The password associated with the client id

## Method Details

### connect

    public void connect()
                throws epp_Exception,
                       UnknownHostException,
                       SocketException,
                       IOException

> Connects to the EPP Server using previously set hostname and port. It is recommended to use connectAndGetGreeting() to connect and retrieve the EPPGreeting in one single call.
> See Also:
>   `connectAndGetGreeting()`

### connect

    public void connect(String epp_client_id,
                        String epp_password)
                throws epp_Exception,
                       UnknownHostException,
                       SocketException,
                       IOException

> Connects to the EPP Server using the given client id and password and using the previously set EPP hostname and port. It is recommended to use connectAndGetGreeting() to connect and retrieve the EPPGreeting in one single call.
> Parameters:
>   `epp_client_id` - The EPP client id
>   `epp_password` - The password associated with the client id
> See Also:
>   `connectAndGetGreeting()`

### connect

    public void connect(String epp_host_name,
                        int epp_host_port)
                throws epp_Exception,
                       UnknownHostException,
                       SocketException,
                       IOException

> Connects to the EPP Server using the given hostname and port and using the previously set client id and password. It is recommended to use connectAndGetGreeting() to connect and retrieve the EPPGreeting in one single call.
> Parameters:
>   `epp_host_name` - The EPP Hostname (eg. "host.domain.tld")
>   `epp_host_port` - The EPP port
> See Also:
>   `connectAndGetGreeting()`

### connect

    public void connect(String epp_host_name,
                        int epp_host_port,
                        String epp_client_id,
                        String epp_password)
                throws epp_Exception,
                       UnknownHostException,
                       SocketException,
                       IOException

> Connects to and logs into the EPP Server using the given hostname, port, client id and password It is recommended to use connectAndGetGreeting() to connect and retrieve the EPPGreeting in one single call.
> Parameters:
>   `epp_host_name` - The EPP Hostname (eg. "host.domain.tld")
>   `epp_host_port` - The EPP port
>   `epp_client_id` - The EPP client id
>   `epp_password` - The password associated with the client id
> See Also:
>   `connectAndGetGreeting()`

### connectAndGetGreeting

    public epp_Greeting connectAndGetGreeting()
                throws epp_Exception,
                       IOException,
                       epp_XMLException

> Connects to the EPP Server using previously set hostname and port. It also reads the epp_Greeting from the server and returns it
> Returns:
>   org.openrtk.idl.epp02.epp_Greeting the greeting from the EPP Server
> Throws:
>   `epp_XMLException` - if the server's greeting is not parsable

### disconnect

    public void disconnect()
                throws IOException

> Closes the connection to the EPP Server

### getEPPClientID

    public String getEPPClientID()

> Accessor method for the client id. This value is also used in the creation of the default EPPTransID

### getEPPHostName

    public String getEPPHostName()

> Accessor method for the EPP Hostname
> Returns:
>   The EPP host name String

### getEPPHostPort

    public int getEPPHostPort()

> Accessor method for the EPP Host port

### getEPPPassword

    public String getEPPPassword()

> Accessor method for the password

### getEPPTimeout

    public int getEPPTimeout()

> Accessor method for the EPP server timeout, in milliseconds

### getGreeting

    public epp_Greeting getGreeting()
                throws epp_Exception,
                       epp_XMLException

> Retrieves the greeting from the EPP Server and returns it. This method is useful if a new connection is provided to the EPPClient (eg. in the case of an SSL connection not using the JSSE standard) and the greeting must be read separately.
> Returns:
>   org.openrtk.idl.epp02.epp_Greeting the greeting from the EPP Server
> Throws:
>   `epp_Exception` - if the server greeting is not present
>   `epp_XMLException` - if the server's greeting is not parsable

### getLang

    public String getLang()

> Accessor method for the lang
> Returns:
>   String lang

### getLastNetTransaction

    public long getLastNetTransaction()

> Accessor method for the time of the last successfull network transaction. useful for tracking when a keepAlive (poll) transaction needs to be sent.

### getProtocol

    public int getProtocol()

> Accessor method for the protocol indicator
> Returns:
>   int protocol indicator

### getVersion

    public String getVersion()

> Accessor method for the version
> Returns:
>   String the version

### hello

    public epp_Greeting hello()
                throws epp_Exception,
                       epp_XMLException

> Issues a hello request to the EPP Server. This forces the server to respond with an epp_Greeting, which is otherwise only sent on initial connections to the EPP Server.
> Returns:
>   org.openrtk.idl.epp02.epp_Greeting the greeting from the EPP Server
> Throws:
>   `epp_Exception` - if the server greeting is not present
>   `epp_XMLException` - if the server's greeting is not parsable

### isValid

    public boolean isValid()

> returns if the connections is valid. A connection is valid if the following are true
> - a coonection has been established to the server
> - an I/O Error has not been thrown
> - a login has been successfully completed

### isVersionSentOnLogin

    public boolean isVersionSentOnLogin()

> Returns whether RTK version number will be send on Login.
> Returns:
>   true in case RTK version number will be send on Login, else false

### login

    public void login(String client_tr_id)
                throws epp_XMLException,
                       epp_Exception

> Logs into the EPP Server using previously set client id and password
> Parameters:
> Throws:
>   `epp_XMLException` - if the request XML could not be built or if the response XML could not be parsed.
>   `epp_Exception` - if the EPP Server responded with an error code

### login

    public void login(String client_tr_id,
                      String new_password)
                throws epp_XMLException,
                       epp_Exception

> Logs into the EPP Server using the previously set client id, and password If the new password is not null, it is also passed to the server to change your EPP client password.
> This method also includes domain, host and contact object/XML information in the services section. If you wish to omit one of the standard EPP objects (or add any based on registry extensions to EPP), then you'll have to populate the EPPLogin command manually and call processAction() yourself.
> Parameters:
>   `new_password` - The password associated with the client id. Use null if you do not want to change the password
> Throws:
>   `epp_XMLException` - if the request XML could not be built or if the response XML could not be parsed.
>   `epp_Exception` - if the EPP Server responded with an error code

### login

    public void login(String client_tr_id,
                      String epp_client_id,
                      String epp_password)
                throws epp_XMLException,
                       epp_Exception

> Logs into the EPP Server using the given client id, password
> Parameters:
> Throws:
>   `epp_XMLException` - if the request XML could not be built or if the response XML could not be parsed.
>   `epp_Exception` - if the EPP Server responded with an error code

### login

    public void login(String client_tr_id,
                      String client_id,
                      String password,
                      String new_password)
                throws epp_XMLException,
                       epp_Exception

> Logs into the EPP Server using the given client id, password and new password. Use this method if you want to change your EPP client password in the server.
> Parameters:
>   `client_id` - The EPP client id
>   `password` - The password associated with the client id
>   `new_password` - The password associated with the client id, use null if you do not want to change the password
> Throws:
>   `epp_XMLException` - if the request XML could not be built or if the response XML could not be parsed.
>   `epp_Exception` - if the EPP Server responded with an error code

### logout

    public void logout(String client_trid)
                throws epp_XMLException,
                       epp_Exception

> Logs out of EPP Server
> Parameters:
> Throws:
>   `epp_XMLException` - if the request XML could not be built or if the response XML could not be parsed.
>   `epp_Exception` - if the EPP Server responded with an error code

### poll

    public epp_PollRsp poll(String client_tr_id)
                throws epp_XMLException,
                       epp_Exception

> Throws:
>   `epp_XMLException` - if the request XML could not be built or if the response XML could not be parsed.
>   `epp_Exception` - if the EPP Server responded with an error code

### poll

    public epp_PollRsp poll(String client_tr_id,
                            String message_id)
                throws epp_XMLException,
                       epp_Exception

> Parameters:
>   `message_id` - The id of the message to ACK. If null, the Poll op will be REQ.
> Throws:
>   `epp_XMLException` - if the request XML could not be built or if the response XML could not be parsed.
>   `epp_Exception` - if the EPP Server responded with an error code

### processAction

    public epp_Action processAction(epp_Action request)
                throws epp_XMLException,
                       epp_Exception

> Method required by the epp_Action interface. Sends raw XML to the server and returns the XML response.
> Specified by:
>   processAction in interface epp_SessionOperations
> Throws:
>   `epp_XMLException` - if any request data or response data is missing
>   `epp_Exception` - if a communication error occurs or if the server returns an error code

### processXML

    public String processXML(String request_xml)
                throws epp_Exception

> Method required by the epp_Action interface. Sends raw XML to the server and returns the XML response.
> Specified by:
>   processXML in interface epp_SessionOperations
> Throws:
>   `epp_Exception` - if a communication error occurs

### readFromServer

    public String readFromServer()
                throws epp_Exception

> Reads a complete XML message from the EPP Server. You would normally then use this XML string in an epp_Action.fromXML().
> Returns:
>   Full XML String
> Throws:
>   `epp_Exception` - if there was a socket error in reading from the EPP Server

### setEPPClientID

    public void setEPPClientID(String value)

> Accessor method for the client id. This value is also used in the creation of the default EPPTransID
> Parameters:
>   `value` - The client is String

### setEPPHostName

    public void setEPPHostName(String value)

> Accessor method for the EPP Hostname
> Parameters:
>   `value` - The hostname string (eg. "host.domain.tld" or "100.101.200.201")

### setEPPHostPort

    public void setEPPHostPort(int value)

> Accessor method for the EPP Host port
> Parameters:
>   `value` - The int port value

### setEPPPassword

    public void setEPPPassword(String value)

> Accessor method for the password
> Parameters:
>   `value` - The password String

### setEPPTimeout

    public void setEPPTimeout(int value)

> Accessor method for the EPP server timeout, in milliseconds
> Parameters:
>   `value` - The int timeout value, in milliseconds

### setLang

    public void setLang(String value)

> Accessor method for the lang
> Parameters:
>   `value` - The lang/locale String (eg. "fr_CA")

### setProtocol

    public void setProtocol(int value)

> Accessor method for the protocol indicator
> Parameters:
>   `value` - int protocol indicator

### setSocketToEPPServer

    public void setSocketToEPPServer(Socket value)
                throws epp_Exception,
                       UnknownHostException,
                       SocketException,
                       IOException

> Bypass to the EPPClient's connect() methods. Allows a connection to be established externally. Mostly useful if opting to not use JSSE in favour of another SSL package. This method also sets the SO Timeout to the value from getEPPTimeout().
> Parameters:
>   `value` - The Socket to the EPP Server
> See Also:
>   `getEPPTimeout()`

### setVersion

    public void setVersion(String value)

> Accessor method for the version
> Parameters:
>   `value` - The version string

### setVersionSentOnLogin

    public void setVersionSentOnLogin(boolean send)

> Set whether to send RTK version number on Login.
> Parameters:
>   `send` - if true RTK version number will be send in unspec section on Login

### writeToServer

    public void writeToServer(String outbound_xml)
                throws epp_Exception

> Sends an XML string to the EPP Server
> Throws:
>   `epp_Exception` - if there was a socket error in writing to the EPP Server. The epp_Exception will contain a result with the cope epp_Session.RTK_COMMUNICATIONS_FAILURE

Copyright © 2001-2002 - Tucows, Inc., 2003 - LibertyRMS