m247 / epp-client Goto Github PK
View Code? Open in Web Editor NEWEPP Client for Ruby
License: MIT License
EPP Client for Ruby
License: MIT License
At the moment I don't think the OpenSSL::SSL::SSLSocket
is configured to verify the SSL connection.
Full text of error:
LibXML::XML::Error: Nodes belong to different documents. You must first import the node by calling XML::Document.import.
from gems/epp-client-2.1.0/lib/epp-client/requests/extension.rb:21:in `<<'
This may be as simple as me not setting namespaces (I've found a few methods called 'set_namespaces') but I'm unable to see exactly how to set these manually.
Below are steps to reproduce.
@domain_update = EPP::Domain::Update.new('example.com',
:add => {:ns => %w(ns1.test.host ns2.test.host)},
:rem => {:ns => %w(ns3.test.host ns4.test.host)},
:chg => {
:registrant => 'UK-2349723',
:auth_info => {:pw => '2381728348'}
})
@update = EPP::Commands::Update.new(@domain_update)
explanation = 'explanation'
method = 'update'
# XML GENERATION
xml = XML::Node.new(method)
xml.namespaces.namespace = ns = XML::Namespace.new(xml, 'auext', 'urn:X-au:params:xml:ns:auext-1.1')
xattr = XML::Attr.new(xml, 'schemaLocation', 'urn:X-au:params:xml:ns:auext-1.1 auext-1.1.xsd')
xattr.namespaces.namespace = XML::Namespace.new(xml, 'xsi', 'http://www.w3.org/2001/XMLSchema-instance')
au_properties = XML::Node.new('auProperties', '', ns)
au_properties << node = XML::Node.new('registrantName', 'Registrant Name', ns)
au_properties << node = XML::Node.new('registrantID', 'Registrant ID', ns)
node['type'] = 'Registrant ID Type'
au_properties << node = XML::Node.new('eligibilityName', 'Elig Name', ns)
au_properties << node = XML::Node.new('eligibilityType', 'Elig Type', ns)
au_properties << node = XML::Node.new('eligibilityID', 'Elig ID', ns)
node['type'] = 'Elig Type'
au_properties << node = XML::Node.new('policyReason', '1', ns)
xml << au_properties
xml << XML::Node.new('explanation', explanation, ns) if explanation
# XML GENERATION
@extension = EPP::Requests::Extension.new(xml)
@command = EPP::Requests::Command.new(SecureRandom.uuid, @update, @extension)
@request = EPP::Request.new(@command)
puts @request.to_xml # => this works
puts @request.to_xml # => this throws LibXML::XML::Error
According to the schemas the "street" element can appear up to a maximum of 3 times. So we need to either accept an array of streets or else split street by comma into multiple elements. In either case we would either only accept the first three elements or else we would raise an exception.
Hello
Im trying to use the examples in the doc and they are not working for me, could you check and let me know if i'm doing something wrong or the docs are outdated/wrong?
If trying either domain:check string payload or domain:check XML::Node payload examples i get the following error.
/usr/local/rvm/gems/ruby-1.9.3-p547/gems/epp-client-1.0.0/lib/epp-client/commands/read_write_command.rb:13:in `<<': Nodes belong to different documents. You must first import the node by calling XML::Document.import. (LibXML::XML::Error)
domain:check string payload sample
require "epp-client"
client = EPP::Client.new('user', 'pass', 'host', { :port => 1234} )
client.hello
client.check <<-EOXML
<domain:check
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.com</domain:name>
<domain:name>example.net</domain:name>
</domain:check>
EOXML
puts client.last_request
puts client.last_response
client.logout
domain:check XML::Node payload sample
require "epp-client"
client = EPP::Client.new('user', 'pass', 'host', { :port => 1234} )
client.hello
xml = XML::Node.new('check')
ns = XML::Namespace.new(xml, 'domain', 'urn:ietf:params:xml:ns:domain-1.0')
xml.namespaces.namespace = ns
%w(example.com example.net).each do |name|
xml << XML::Node.new('name', name, ns)
end
puts client.last_request
puts client.last_response
client.logout
If I tried with the domain:check block I get a different error this time..
/usr/local/rvm/gems/ruby-1.9.3-p547/gems/epp-client-1.0.0/lib/epp-client/client.rb:106:in `check': wrong number of arguments (0 for 1) (ArgumentError)
from test2.rb:8:in `<main>'
domain:check XML::Node payload sample
require "epp-client"
client = EPP::Client.new('user', 'pass', 'host', { :port => 1234} )
client.hello
client.check do |xml|
xml << (check = XML::Node.new('check'))
ns = XML::Namespace.new(check, 'domain', 'urn:ietf:params:xml:ns:domain-1.0')
check.namespaces.namespace = ns
%w(example.com example.net example.org).each do |name|
check << XML::Node.new('name', name, ns)
end
check
end
puts client.last_request
puts client.last_response
client.logout
I'm using ruby 1.9.3 and gem version 1.0
Regards
M
Extract EPP requests such as Hello, Login and Logout into their own request classes. The request classes should be capable of generating the full XML form of the request so that we can properly test them.
Hi,
I tried to add services like mentioned in the source of client.rb
services = EPP::Client::DEFAULT_SERVICES + %w(urn:ietf:params:xml:ns:secDNS-1.1)
EPP::Client.new('username','password','epp.example.com', :services => services)
but it does not seem to work. I get
uninitialized constant EPP::Client::DEFAULT_SERVICES
I also tried to do this:
services = %w(
http://www.dns.be/xml/epp/dnsbe-1.0
urn:ietf:params:xml:ns:domain-1.0
urn:ietf:params:xml:ns:contact-1.0
urn:ietf:params:xml:ns:host-1.0)
EPP::Client.new('username','password','epp.example.com', :services => services)
But no luck...
Can you please point me in the right direction?
Thanks a lot!
Ben
I have no idea what I'm doing wrong or how to resolve it. Spent hours on getting this far already, some example or docs would be nice at this point ๐ซ I think I'm getting close though, here's what I have so far:
client = EPP::Client.new('username', 'password', 'epp.registry.tryout.dns.be', {
:port => 33128,
:extensions => [
"http://www.dns.be/xml/epp/dnsbe-1.0",
"http://www.dns.be/xml/epp/nsgroup-1.0",
"http://www.dns.be/xml/epp/keygroup-1.0",
"urn:ietf:params:xml:ns:secDNS-1.1",
]})
# From your tests, which I'm using as examples now
contact_create = EPP::Contact::Create.new('UK-4398495',
:voice => "+44.1234567890",
:email => "[email protected]",
:postal_info => {
:org => "Epiphyte",
:name => "Enoch Root",
:addr => {
:street => "1 Test Avenue",
:city => "Testington",
:sp => "Testshire",
:pc => "TE57 1NG",
:cc => "GB" } },
:auth_info => {:pw => '2381728348'},
:disclose => {"0" => %w(voice email)})
create = EPP::Commands::Create.new(contact_create)
extension = XML::Node.new("ext")
dnsbe = XML::Namespace.new(extension, 'dnsbe', 'http://www.dns.be/xml/epp/dnsbe-1.0')
create = XML::Node.new("create", nil, dnsbe)
extension.namespaces.namespace = dnsbe
contact = XML::Node.new("contact", nil, dnsbe)
contact << XML::Node.new("type", "licensee", dnsbe)
contact << XML::Node.new("vat", "BE 123 4567 8900", dnsbe)
contact << XML::Node.new("lang", "nl", dnsbe)
create << contact
extension << create
command = EPP::Requests::Command.new('ABC-123', create, extension)
request = EPP::Request.new(command)
xml = request.to_xml
client.create request
This gives the following error:
Nodes belong to different documents. You must first import the node by calling XML::Document.import.
/home/vagrant/.bundler/ruby/2.0.0/epp-client-068586c8cdbe/lib/epp-client/requests/command.rb:21:in `<<'
#...
Any help would be appreciated. ๐
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.