-
Notifications
You must be signed in to change notification settings - Fork 1
/
CityService.pas
executable file
·523 lines (446 loc) · 19.8 KB
/
CityService.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL : https://api.n11.com/ws/CityService.wsdl
// >Import : https://api.n11.com/ws/CityService.wsdl>0
// Encoding : UTF-8
// Version : 1.0
// (19.01.2020 02:07:38 - - $Rev: 96726 $)
// ************************************************************************ //
unit CityService;
interface
uses Soap.InvokeRegistry, Soap.SOAPHTTPClient, System.Types, Soap.XSBuiltIns;
const
IS_OPTN = $0001;
IS_UNBD = $0002;
IS_NLBL = $0004;
IS_UNQL = $0008;
IS_REF = $0080;
type
// ************************************************************************ //
// The following types, referred to in the WSDL document are not being represented
// in this file. They are either aliases[@] of other types represented or were referred
// to but never[!] declared in the document. The types from the latter category
// typically map to predefined/known XML or Embarcadero types; however, they could also
// indicate incorrect WSDL documents that failed to declare or import a schema type.
// ************************************************************************ //
// !:integer - "http://www.w3.org/2001/XMLSchema"[Gbl]
// !:long - "http://www.w3.org/2001/XMLSchema"[Gbl]
// !:string - "http://www.w3.org/2001/XMLSchema"[Gbl]
GetCityRequest = class; { "http://www.n11.com/ws/schemas"[Lit][GblElm] }
GetCitiesRequest = class; { "http://www.n11.com/ws/schemas"[Lit][GblElm] }
GetCityResponse = class; { "http://www.n11.com/ws/schemas"[Lit][GblElm] }
GetDistrictRequest = class; { "http://www.n11.com/ws/schemas"[Lit][GblElm] }
GetDistrictResponse = class; { "http://www.n11.com/ws/schemas"[Lit][GblElm] }
GetNeighborhoodsRequest = class; { "http://www.n11.com/ws/schemas"[Lit][GblElm] }
GetCitiesResponse = class; { "http://www.n11.com/ws/schemas"[Lit][GblElm] }
DistrictData = class; { "http://www.n11.com/ws/schemas"[GblCplx] }
ResultInfo = class; { "http://www.n11.com/ws/schemas"[GblCplx] }
CityData = class; { "http://www.n11.com/ws/schemas"[GblCplx] }
GetNeighborhoodsResponse = class; { "http://www.n11.com/ws/schemas"[Lit][GblElm] }
NeighborhoodData = class; { "http://www.n11.com/ws/schemas"[GblCplx] }
// ************************************************************************ //
// XML : GetCityRequest, global, <element>
// Namespace : http://www.n11.com/ws/schemas
// Serializtn: [xoLiteralParam]
// Info : Wrapper
// ************************************************************************ //
GetCityRequest = class(TRemotable)
private
FcityCode: Int64;
public
constructor Create; override;
published
property cityCode: Int64 Index (IS_UNQL) read FcityCode write FcityCode;
end;
// ************************************************************************ //
// XML : GetCitiesRequest, global, <element>
// Namespace : http://www.n11.com/ws/schemas
// Serializtn: [xoLiteralParam]
// Info : Wrapper
// ************************************************************************ //
GetCitiesRequest = class(TRemotable)
private
public
constructor Create; override;
published
end;
// ************************************************************************ //
// XML : GetCityResponse, global, <element>
// Namespace : http://www.n11.com/ws/schemas
// Serializtn: [xoLiteralParam]
// Info : Wrapper
// ************************************************************************ //
GetCityResponse = class(TRemotable)
private
Fresult: ResultInfo;
Fcity: CityData;
public
constructor Create; override;
destructor Destroy; override;
published
property result: ResultInfo Index (IS_UNQL) read Fresult write Fresult;
property city: CityData Index (IS_UNQL) read Fcity write Fcity;
end;
// ************************************************************************ //
// XML : GetDistrictRequest, global, <element>
// Namespace : http://www.n11.com/ws/schemas
// Serializtn: [xoLiteralParam]
// Info : Wrapper
// ************************************************************************ //
GetDistrictRequest = class(TRemotable)
private
FcityCode: Int64;
public
constructor Create; override;
published
property cityCode: Int64 Index (IS_UNQL) read FcityCode write FcityCode;
end;
DistrictList = array of DistrictData; { "http://www.n11.com/ws/schemas"[GblCplx] }
// ************************************************************************ //
// XML : GetDistrictResponse, global, <element>
// Namespace : http://www.n11.com/ws/schemas
// Serializtn: [xoLiteralParam]
// Info : Wrapper
// ************************************************************************ //
GetDistrictResponse = class(TRemotable)
private
Fresult: ResultInfo;
Fdistricts: DistrictList;
public
constructor Create; override;
destructor Destroy; override;
published
property result: ResultInfo Index (IS_UNQL) read Fresult write Fresult;
property districts: DistrictList Index (IS_UNQL) read Fdistricts write Fdistricts;
end;
// ************************************************************************ //
// XML : GetNeighborhoodsRequest, global, <element>
// Namespace : http://www.n11.com/ws/schemas
// Serializtn: [xoLiteralParam]
// Info : Wrapper
// ************************************************************************ //
GetNeighborhoodsRequest = class(TRemotable)
private
FdistrictId: Int64;
public
constructor Create; override;
published
property districtId: Int64 Index (IS_UNQL) read FdistrictId write FdistrictId;
end;
CityList = array of CityData; { "http://www.n11.com/ws/schemas"[GblCplx] }
// ************************************************************************ //
// XML : GetCitiesResponse, global, <element>
// Namespace : http://www.n11.com/ws/schemas
// Serializtn: [xoLiteralParam]
// Info : Wrapper
// ************************************************************************ //
GetCitiesResponse = class(TRemotable)
private
Fresult: ResultInfo;
Fcities: CityList;
public
constructor Create; override;
destructor Destroy; override;
published
property result: ResultInfo Index (IS_UNQL) read Fresult write Fresult;
property cities: CityList Index (IS_UNQL) read Fcities write Fcities;
end;
// ************************************************************************ //
// XML : DistrictData, global, <complexType>
// Namespace : http://www.n11.com/ws/schemas
// ************************************************************************ //
DistrictData = class(TRemotable)
private
Fname_: string;
Fid: Int64;
published
property name_: string Index (IS_UNQL) read Fname_ write Fname_;
property id: Int64 Index (IS_UNQL) read Fid write Fid;
end;
// ************************************************************************ //
// XML : ResultInfo, global, <complexType>
// Namespace : http://www.n11.com/ws/schemas
// ************************************************************************ //
ResultInfo = class(TRemotable)
private
Fstatus: string;
Fstatus_Specified: boolean;
FerrorCode: string;
FerrorCode_Specified: boolean;
FerrorMessage: string;
FerrorMessage_Specified: boolean;
FerrorCategory: string;
FerrorCategory_Specified: boolean;
procedure Setstatus(Index: Integer; const Astring: string);
function status_Specified(Index: Integer): boolean;
procedure SeterrorCode(Index: Integer; const Astring: string);
function errorCode_Specified(Index: Integer): boolean;
procedure SeterrorMessage(Index: Integer; const Astring: string);
function errorMessage_Specified(Index: Integer): boolean;
procedure SeterrorCategory(Index: Integer; const Astring: string);
function errorCategory_Specified(Index: Integer): boolean;
published
property status: string Index (IS_OPTN or IS_NLBL or IS_UNQL) read Fstatus write Setstatus stored status_Specified;
property errorCode: string Index (IS_OPTN or IS_NLBL or IS_UNQL) read FerrorCode write SeterrorCode stored errorCode_Specified;
property errorMessage: string Index (IS_OPTN or IS_NLBL or IS_UNQL) read FerrorMessage write SeterrorMessage stored errorMessage_Specified;
property errorCategory: string Index (IS_OPTN or IS_NLBL or IS_UNQL) read FerrorCategory write SeterrorCategory stored errorCategory_Specified;
end;
// ************************************************************************ //
// XML : CityData, global, <complexType>
// Namespace : http://www.n11.com/ws/schemas
// ************************************************************************ //
CityData = class(TRemotable)
private
FcityCode: string;
FcityId: Int64;
FcityName: string;
published
property cityCode: string Index (IS_UNQL) read FcityCode write FcityCode;
property cityId: Int64 Index (IS_UNQL) read FcityId write FcityId;
property cityName: string Index (IS_UNQL) read FcityName write FcityName;
end;
NeighborhoodListData = array of NeighborhoodData; { "http://www.n11.com/ws/schemas"[GblCplx] }
// ************************************************************************ //
// XML : GetNeighborhoodsResponse, global, <element>
// Namespace : http://www.n11.com/ws/schemas
// Serializtn: [xoLiteralParam]
// Info : Wrapper
// ************************************************************************ //
GetNeighborhoodsResponse = class(TRemotable)
private
Fresult: ResultInfo;
Fneighborhoods: NeighborhoodListData;
public
constructor Create; override;
destructor Destroy; override;
published
property result: ResultInfo Index (IS_UNQL) read Fresult write Fresult;
property neighborhoods: NeighborhoodListData Index (IS_UNQL) read Fneighborhoods write Fneighborhoods;
end;
// ************************************************************************ //
// XML : NeighborhoodData, global, <complexType>
// Namespace : http://www.n11.com/ws/schemas
// ************************************************************************ //
NeighborhoodData = class(TRemotable)
private
Fname_: string;
Fid: Int64;
published
property name_: string Index (IS_UNQL) read Fname_ write Fname_;
property id: Int64 Index (IS_UNQL) read Fid write Fid;
end;
// ************************************************************************ //
// Namespace : http://www.n11.com/ws/schemas
// transport : http://schemas.xmlsoap.org/soap/http
// style : document
// use : literal
// binding : CityServicePortSoap11
// service : CityServicePortService
// port : CityServicePortSoap11
// URL : https://api.n11.com/ws/cityService/
// ************************************************************************ //
CityServicePort = interface(IInvokable)
['{2EEA8613-D347-DAD1-584B-8167DDCA06A9}']
// Cannot unwrap:
// - Input element wrapper name does not match operation's name
// - More than one strictly out element was found
function GetCities(const GetCitiesRequest: GetCitiesRequest): GetCitiesResponse; stdcall;
// Cannot unwrap:
// - Input element wrapper name does not match operation's name
// - More than one strictly out element was found
function GetCity(const GetCityRequest: GetCityRequest): GetCityResponse; stdcall;
// Cannot unwrap:
// - Input element wrapper name does not match operation's name
// - More than one strictly out element was found
function GetDistrict(const GetDistrictRequest: GetDistrictRequest): GetDistrictResponse; stdcall;
// Cannot unwrap:
// - Input element wrapper name does not match operation's name
// - More than one strictly out element was found
function GetNeighborhoods(const GetNeighborhoodsRequest: GetNeighborhoodsRequest): GetNeighborhoodsResponse; stdcall;
end;
function GetCityServicePort(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): CityServicePort;
implementation
uses System.SysUtils;
function GetCityServicePort(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): CityServicePort;
const
defWSDL = 'https://api.n11.com/ws/CityService.wsdl';
defURL = 'https://api.n11.com/ws/cityService/';
defSvc = 'CityServicePortService';
defPrt = 'CityServicePortSoap11';
var
RIO: THTTPRIO;
begin
Result := nil;
if (Addr = '') then
begin
if UseWSDL then
Addr := defWSDL
else
Addr := defURL;
end;
if HTTPRIO = nil then
RIO := THTTPRIO.Create(nil)
else
RIO := HTTPRIO;
try
Result := (RIO as CityServicePort);
if UseWSDL then
begin
RIO.WSDLLocation := Addr;
RIO.Service := defSvc;
RIO.Port := defPrt;
end else
RIO.URL := Addr;
finally
if (Result = nil) and (HTTPRIO = nil) then
RIO.Free;
end;
end;
constructor GetCityRequest.Create;
begin
inherited Create;
FSerializationOptions := [xoLiteralParam];
end;
constructor GetCitiesRequest.Create;
begin
inherited Create;
FSerializationOptions := [xoLiteralParam];
end;
constructor GetCityResponse.Create;
begin
inherited Create;
FSerializationOptions := [xoLiteralParam];
end;
destructor GetCityResponse.Destroy;
begin
System.SysUtils.FreeAndNil(Fresult);
System.SysUtils.FreeAndNil(Fcity);
inherited Destroy;
end;
constructor GetDistrictRequest.Create;
begin
inherited Create;
FSerializationOptions := [xoLiteralParam];
end;
constructor GetDistrictResponse.Create;
begin
inherited Create;
FSerializationOptions := [xoLiteralParam];
end;
destructor GetDistrictResponse.Destroy;
var
I: Integer;
begin
for I := 0 to System.Length(Fdistricts)-1 do
System.SysUtils.FreeAndNil(Fdistricts[I]);
System.SetLength(Fdistricts, 0);
System.SysUtils.FreeAndNil(Fresult);
inherited Destroy;
end;
constructor GetNeighborhoodsRequest.Create;
begin
inherited Create;
FSerializationOptions := [xoLiteralParam];
end;
constructor GetCitiesResponse.Create;
begin
inherited Create;
FSerializationOptions := [xoLiteralParam];
end;
destructor GetCitiesResponse.Destroy;
var
I: Integer;
begin
for I := 0 to System.Length(Fcities)-1 do
System.SysUtils.FreeAndNil(Fcities[I]);
System.SetLength(Fcities, 0);
System.SysUtils.FreeAndNil(Fresult);
inherited Destroy;
end;
procedure ResultInfo.Setstatus(Index: Integer; const Astring: string);
begin
Fstatus := Astring;
Fstatus_Specified := True;
end;
function ResultInfo.status_Specified(Index: Integer): boolean;
begin
Result := Fstatus_Specified;
end;
procedure ResultInfo.SeterrorCode(Index: Integer; const Astring: string);
begin
FerrorCode := Astring;
FerrorCode_Specified := True;
end;
function ResultInfo.errorCode_Specified(Index: Integer): boolean;
begin
Result := FerrorCode_Specified;
end;
procedure ResultInfo.SeterrorMessage(Index: Integer; const Astring: string);
begin
FerrorMessage := Astring;
FerrorMessage_Specified := True;
end;
function ResultInfo.errorMessage_Specified(Index: Integer): boolean;
begin
Result := FerrorMessage_Specified;
end;
procedure ResultInfo.SeterrorCategory(Index: Integer; const Astring: string);
begin
FerrorCategory := Astring;
FerrorCategory_Specified := True;
end;
function ResultInfo.errorCategory_Specified(Index: Integer): boolean;
begin
Result := FerrorCategory_Specified;
end;
constructor GetNeighborhoodsResponse.Create;
begin
inherited Create;
FSerializationOptions := [xoLiteralParam];
end;
destructor GetNeighborhoodsResponse.Destroy;
var
I: Integer;
begin
for I := 0 to System.Length(Fneighborhoods)-1 do
System.SysUtils.FreeAndNil(Fneighborhoods[I]);
System.SetLength(Fneighborhoods, 0);
System.SysUtils.FreeAndNil(Fresult);
inherited Destroy;
end;
initialization
{ CityServicePort }
InvRegistry.RegisterInterface(TypeInfo(CityServicePort), 'http://www.n11.com/ws/schemas', 'UTF-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(CityServicePort), '');
InvRegistry.RegisterInvokeOptions(TypeInfo(CityServicePort), ioDocument);
InvRegistry.RegisterInvokeOptions(TypeInfo(CityServicePort), ioLiteral);
RemClassRegistry.RegisterXSClass(GetCityRequest, 'http://www.n11.com/ws/schemas', 'GetCityRequest');
RemClassRegistry.RegisterSerializeOptions(GetCityRequest, [xoLiteralParam]);
RemClassRegistry.RegisterXSClass(GetCitiesRequest, 'http://www.n11.com/ws/schemas', 'GetCitiesRequest');
RemClassRegistry.RegisterSerializeOptions(GetCitiesRequest, [xoLiteralParam]);
RemClassRegistry.RegisterXSClass(GetCityResponse, 'http://www.n11.com/ws/schemas', 'GetCityResponse');
RemClassRegistry.RegisterSerializeOptions(GetCityResponse, [xoLiteralParam]);
RemClassRegistry.RegisterXSClass(GetDistrictRequest, 'http://www.n11.com/ws/schemas', 'GetDistrictRequest');
RemClassRegistry.RegisterSerializeOptions(GetDistrictRequest, [xoLiteralParam]);
RemClassRegistry.RegisterXSInfo(TypeInfo(DistrictList), 'http://www.n11.com/ws/schemas', 'DistrictList');
RemClassRegistry.RegisterXSClass(GetDistrictResponse, 'http://www.n11.com/ws/schemas', 'GetDistrictResponse');
RemClassRegistry.RegisterExternalPropName(TypeInfo(GetDistrictResponse), 'districts', '[ArrayItemName="district"]');
RemClassRegistry.RegisterSerializeOptions(GetDistrictResponse, [xoLiteralParam]);
RemClassRegistry.RegisterXSClass(GetNeighborhoodsRequest, 'http://www.n11.com/ws/schemas', 'GetNeighborhoodsRequest');
RemClassRegistry.RegisterSerializeOptions(GetNeighborhoodsRequest, [xoLiteralParam]);
RemClassRegistry.RegisterXSInfo(TypeInfo(CityList), 'http://www.n11.com/ws/schemas', 'CityList');
RemClassRegistry.RegisterXSClass(GetCitiesResponse, 'http://www.n11.com/ws/schemas', 'GetCitiesResponse');
RemClassRegistry.RegisterExternalPropName(TypeInfo(GetCitiesResponse), 'cities', '[ArrayItemName="city"]');
RemClassRegistry.RegisterSerializeOptions(GetCitiesResponse, [xoLiteralParam]);
RemClassRegistry.RegisterXSClass(DistrictData, 'http://www.n11.com/ws/schemas', 'DistrictData');
RemClassRegistry.RegisterExternalPropName(TypeInfo(DistrictData), 'name_', '[ExtName="name"]');
RemClassRegistry.RegisterXSClass(ResultInfo, 'http://www.n11.com/ws/schemas', 'ResultInfo');
RemClassRegistry.RegisterXSClass(CityData, 'http://www.n11.com/ws/schemas', 'CityData');
RemClassRegistry.RegisterXSInfo(TypeInfo(NeighborhoodListData), 'http://www.n11.com/ws/schemas', 'NeighborhoodListData');
RemClassRegistry.RegisterXSClass(GetNeighborhoodsResponse, 'http://www.n11.com/ws/schemas', 'GetNeighborhoodsResponse');
RemClassRegistry.RegisterExternalPropName(TypeInfo(GetNeighborhoodsResponse), 'neighborhoods', '[ArrayItemName="neighborhood"]');
RemClassRegistry.RegisterSerializeOptions(GetNeighborhoodsResponse, [xoLiteralParam]);
RemClassRegistry.RegisterXSClass(NeighborhoodData, 'http://www.n11.com/ws/schemas', 'NeighborhoodData');
RemClassRegistry.RegisterExternalPropName(TypeInfo(NeighborhoodData), 'name_', '[ExtName="name"]');
end.