line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package XML::SRS; |
3
|
|
|
|
|
|
|
BEGIN { |
4
|
1
|
|
|
1
|
|
2557
|
$XML::SRS::VERSION = '0.09'; |
5
|
|
|
|
|
|
|
} |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
30
|
BEGIN { our $PROTOCOL_VERSION = "5.0" } |
8
|
1
|
|
|
1
|
|
49
|
use XML::SRS::Version; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use Moose::Role; |
11
|
|
|
|
|
|
|
use XML::SRS::Types; |
12
|
|
|
|
|
|
|
use XML::SRS::Node; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use PRANG::Graph; |
15
|
|
|
|
|
|
|
BEGIN { with 'PRANG::Graph', 'XML::SRS::Node'; } |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# packet types |
18
|
|
|
|
|
|
|
use XML::SRS::Request; |
19
|
|
|
|
|
|
|
use XML::SRS::Response; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# data types |
22
|
|
|
|
|
|
|
use XML::SRS::Time; |
23
|
|
|
|
|
|
|
use XML::SRS::Date; |
24
|
|
|
|
|
|
|
use XML::SRS::TimeStamp; |
25
|
|
|
|
|
|
|
use XML::SRS::Contact; |
26
|
|
|
|
|
|
|
use XML::SRS::Contact::Filter; |
27
|
|
|
|
|
|
|
use XML::SRS::Contact::Address::Filter; |
28
|
|
|
|
|
|
|
use XML::SRS::Audit; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# --- |
31
|
|
|
|
|
|
|
# plug-ins: |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# Query types: |
34
|
|
|
|
|
|
|
use XML::SRS::Whois; |
35
|
|
|
|
|
|
|
use XML::SRS::ACL::Query; |
36
|
|
|
|
|
|
|
use XML::SRS::Registrar::Query; |
37
|
|
|
|
|
|
|
use XML::SRS::Registrar::Update; |
38
|
|
|
|
|
|
|
use XML::SRS::Domain::Create; |
39
|
|
|
|
|
|
|
use XML::SRS::Domain::Update; |
40
|
|
|
|
|
|
|
use XML::SRS::Domain::Query; |
41
|
|
|
|
|
|
|
use XML::SRS::Domain::Transferred; |
42
|
|
|
|
|
|
|
use XML::SRS::UDAIValid::Query; |
43
|
|
|
|
|
|
|
use XML::SRS::Handle::Create; |
44
|
|
|
|
|
|
|
use XML::SRS::Handle::Update; |
45
|
|
|
|
|
|
|
use XML::SRS::Handle::Query; |
46
|
|
|
|
|
|
|
use XML::SRS::Message; |
47
|
|
|
|
|
|
|
use XML::SRS::Message::Ack::Response; |
48
|
|
|
|
|
|
|
use XML::SRS::GetMessages; |
49
|
|
|
|
|
|
|
use XML::SRS::AckMessage; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# ActionResponse types: |
52
|
|
|
|
|
|
|
use XML::SRS::Error; |
53
|
|
|
|
|
|
|
use XML::SRS::ACL; |
54
|
|
|
|
|
|
|
use XML::SRS::Domain; |
55
|
|
|
|
|
|
|
use XML::SRS::Handle; |
56
|
|
|
|
|
|
|
use XML::SRS::Registrar; |
57
|
|
|
|
|
|
|
use XML::SRS::UDAIValid; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 NAME |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
XML::SRS - Shared Registry System XML Protocol |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 SYNOPSIS |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# Construct a request |
70
|
|
|
|
|
|
|
my $create = XML::SRS::Domain::Create->new( |
71
|
|
|
|
|
|
|
action_id => "kaihoro.co.nz-create-".time(), |
72
|
|
|
|
|
|
|
domain_name => "kaihoro.co.nz", |
73
|
|
|
|
|
|
|
term => 12, |
74
|
|
|
|
|
|
|
delegate => 1, |
75
|
|
|
|
|
|
|
contact_registrant => { |
76
|
|
|
|
|
|
|
name => "Lord Crumb", |
77
|
|
|
|
|
|
|
email => 'kaihoro.takeaways@gmail.com', |
78
|
|
|
|
|
|
|
address => { |
79
|
|
|
|
|
|
|
address1 => "57 Mount Pleasant St", |
80
|
|
|
|
|
|
|
address2 => "Burbia", |
81
|
|
|
|
|
|
|
city => "Kaihoro", |
82
|
|
|
|
|
|
|
region => "Nelson", |
83
|
|
|
|
|
|
|
cc => "NZ", |
84
|
|
|
|
|
|
|
}, |
85
|
|
|
|
|
|
|
phone => { |
86
|
|
|
|
|
|
|
cc => "64", |
87
|
|
|
|
|
|
|
ndc => "4", |
88
|
|
|
|
|
|
|
subscriber => "499 2267", |
89
|
|
|
|
|
|
|
}, |
90
|
|
|
|
|
|
|
}, |
91
|
|
|
|
|
|
|
nameservers => [qw( ns1.registrar.net.nz ns2.registrar.net.nz )], |
92
|
|
|
|
|
|
|
); |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
my $request = XML::SRS::Request->new( |
95
|
|
|
|
|
|
|
registrar_id => 555, |
96
|
|
|
|
|
|
|
requests => [$create], |
97
|
|
|
|
|
|
|
); |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
my $xml_request = $request->to_xml; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
# $xml_request is now an XML string containing a request that can be sent to |
102
|
|
|
|
|
|
|
# the SRS |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
# $xml_response is an XML string recieved from the SRS |
105
|
|
|
|
|
|
|
my $response = XML::SRS::Response->parse($xml_response); |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
# Calling 'results' gives us an array reference with the results for |
108
|
|
|
|
|
|
|
# each of the requests we sent. |
109
|
|
|
|
|
|
|
my $results = $response->results; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
# Assuming the first result was a domain create, check to see if it was |
112
|
|
|
|
|
|
|
# successful |
113
|
|
|
|
|
|
|
my $result = $results->[0]; # $result is a XML::SRS::Result |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
my $domain = $result->response; |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
# Print the domain's status |
118
|
|
|
|
|
|
|
print $domain->status; |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 DESCRIPTION |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
This module is an implementation of the XML protocol used by the .nz |
123
|
|
|
|
|
|
|
registry. It allows XML requests (and responses) to be constructed via |
124
|
|
|
|
|
|
|
an OO interface. Additionally, it allows SRS XML documents to be parsed, |
125
|
|
|
|
|
|
|
returning a set of objects. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Note, this documentation does not attempt to describe the SRS protocol |
128
|
|
|
|
|
|
|
itself. Please see the NZRS website (L<http://nzrs.net.nz>) for more |
129
|
|
|
|
|
|
|
information on the protocol. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Validation is performed on both XML emitting and parsing. This should be |
132
|
|
|
|
|
|
|
less stringent than the SRS itself, so although XML::SRS may generate |
133
|
|
|
|
|
|
|
requests that the SRS will reject as invalid, you can be sure it won't |
134
|
|
|
|
|
|
|
reject input the SRS would accept. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
The parsing and emitting of XML is handled by L<PRANG>. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Some more information on how to create and parse XML documents follows. |
139
|
|
|
|
|
|
|
We assume that you're using XML::SRS from a client's point-of-view, i.e. |
140
|
|
|
|
|
|
|
you're interested in creating requests and parsing responses. Therefore, |
141
|
|
|
|
|
|
|
we don't discuss parsing requests and creating responses, even though |
142
|
|
|
|
|
|
|
XML:SRS has these capabilities. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head2 Constructing requests |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
A request consists of multiple 'actions' or 'transactions', such as |
147
|
|
|
|
|
|
|
Whois, DomainCreate, etc. Each action has its own class in the XML::SRS |
148
|
|
|
|
|
|
|
namespace. These should be instantiated (see each individual class for |
149
|
|
|
|
|
|
|
information on the parameters for the constructor), and passed to the |
150
|
|
|
|
|
|
|
'requests' parameter of a XML::SRS::Request object. The example in |
151
|
|
|
|
|
|
|
the synopsis illustrates the construction of a DomainCreate request. |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
You can then call the to_xml() method on the constructed object |
154
|
|
|
|
|
|
|
to retrieve the xml. Note, to_xml() can be called on any level of |
155
|
|
|
|
|
|
|
object if you require an XML fragment. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head2 Parsing responses |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
A response can be parsed by simply calling the 'parse' method (or a |
160
|
|
|
|
|
|
|
related method - see below) on the XML::SRS package. Again, the |
161
|
|
|
|
|
|
|
synopsis of this module demostrates this. |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
The resulting object will be an L<XML::SRS::Response> instance. See the |
164
|
|
|
|
|
|
|
documentation for that module for methods to retrieve the data in the |
165
|
|
|
|
|
|
|
response. |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head1 METHODS |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
This module uses the L<PRANG::Graph> role, and so the parse methods |
170
|
|
|
|
|
|
|
(i.e. parse(), parse_file() and parse_fh()) are available. See that |
171
|
|
|
|
|
|
|
module's documentation for more information. |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
Note, as XML::SRS itself cannot be instantiated, you cannot call the |
174
|
|
|
|
|
|
|
to_xml() method from PRANG::Graph on it. However, each of the XML::SRS |
175
|
|
|
|
|
|
|
classes have this method available if you're interested in constucting |
176
|
|
|
|
|
|
|
XML documents. In particular, XML::SRS::Request can be used to |
177
|
|
|
|
|
|
|
construct an entire SRS request. |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head1 COMPOSED OF |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
L<PRANG::Graph>, L<XML::SRS::Node> |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head1 BACKGROUND |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
The SRS protocol was developed in 2002, using what were considered stable XML |
186
|
|
|
|
|
|
|
standard methods at the time, such as SGML DTD. This compares to the now |
187
|
|
|
|
|
|
|
de-facto standard, EPP (RFC3730, friends and updates), which was developed |
188
|
|
|
|
|
|
|
using XML Schema and XML Namespaces. As such, the SRS protocol as a stable |
189
|
|
|
|
|
|
|
standard far pre-dates EPP, which took a further 2 years to reach 1.0 status. |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=head1 GLOBALS |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
There is currently a C<$XML::SRS::PROTOCOL_VERSION> variable which |
194
|
|
|
|
|
|
|
includes the version of the SRS protocol parsed by the module. |
195
|
|
|
|
|
|
|
Currently, the ability to parse more than one version at a time is not |
196
|
|
|
|
|
|
|
supported, so in the event of registry protocol version changes, you |
197
|
|
|
|
|
|
|
will need to upgrade the version of L<XML::SRS> in lock-step for any |
198
|
|
|
|
|
|
|
new functionality. This global is not exported. |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=head1 SOURCE, SUBMISSIONS, SUPPORT |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
Source code is available from Catalyst: |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
git://git.catalyst.net.nz/XML-SRS.git |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
And Github: |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
git://github.com/catalyst/XML-SRS.git |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
Please see the file F<SubmittingPatches> for information on preferred |
211
|
|
|
|
|
|
|
submission formats. |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
Suggested avenues for support: |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=over |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=item * |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
The DNRS forum on SourceForge - |
220
|
|
|
|
|
|
|
L<http://sourceforge.net/projects/dnrs/forums> |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=item * |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
Contact the author and ask either politely or commercially for help. |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=item * |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
Log a ticket on L<http://rt.cpan.org/> |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=back |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=head1 SEE ALSO |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
L<PRANG> |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=head1 AUTHOR AND LICENCE |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
Development commissioned by NZ Registry Services, and carried out by |
239
|
|
|
|
|
|
|
Catalyst IT - L<http://www.catalyst.net.nz/> |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
Copyright 2009-2011, NZ Registry Services. This module is licensed |
242
|
|
|
|
|
|
|
under the Artistic License v2.0, which permits relicensing under other |
243
|
|
|
|
|
|
|
Free Software licenses. |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
=cut |