13 / 10 / 4
Регистрация: 25.11.2010
Сообщений: 358
Записей в блоге: 1
1

Работа с SOAP сервисами

01.01.2013, 21:08. Показов 3942. Ответов 4
Метки нет (Все метки)

Author24 — интернет-сервис помощи студентам
Ситуация такова, пишу, точнее пытаюсь написать, трей агент для "узнавания" баланса счета абонента. Т.е. пога нужна интернет-провайдеру. Нужн это все организовать через WSDL и SOAP. Мне дали ссылку и дотуп к wsdl файлу, нопри генерации pas файла в делфи, в ем возникает куча ошибок. Там используется тип Array, просто так и идет array. Без описания элементво прочего. Он там много где, и из-за этгого нифига не пашет. Меня уверили, что на PHP все прекрасно рабоает. Но его я не знаю.
Кто может помочь исправить или писал подобные проги, хоть что-то! Помогите, сдавать скоро..
0
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
01.01.2013, 21:08
Ответы с готовыми решениями:

Работа с сервисами
Всем доброго время суток , ребята может кто помочь с заданием по Бат файлу ?) Смысл задание : Вы...

Работа с веб-сервисами
Часто в вакансиях ios developer встречаю графу по опыту работы с веб-сервисами. Подскажите, что под...

C# Работа с сервисами\службами
Здравствуйте. Подскажите, как получить полную информацию о каком либо сервисе. Сейчас использую...

Работа с сервисами в ASP.NET
В примере проекта на ASP есть написаний сервис, который отвечает не запросы клиента. Как со...

4
Модератор
3490 / 2613 / 741
Регистрация: 19.09.2012
Сообщений: 7,974
01.01.2013, 21:32 2
Код то выложи, а то что исправлять то будем.
0
13 / 10 / 4
Регистрация: 25.11.2010
Сообщений: 358
Записей в блоге: 1
01.01.2013, 21:33  [ТС] 3
Delphi
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
// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL     : [url]http://sedna.aplus.by/sedna/wsdl/customer.wsdl[/url]
//  >Import : http://sedna.aplus.by/sedna/wsdl/customer.wsdl>0
// Encoding : UTF-8
// Version  : 1.0
// (12.12.2012 21:06:22 - - $Rev: 34800 $)
// ************************************************************************ //
 
unit customer1;
 
interface
 
uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;
 
const
  IS_OPTN = $0001;
 
 
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.
  // ************************************************************************ //
  // !:double          - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:string          - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:integer         - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:unsignedInt     - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:Array           - "http://schemas.xmlsoap.org/soap/encoding/"[Gbl]
 
  CustomerAccountResponse = class;              { "http://sedna.aplus.by/customer/"[GblElm] }
  CustomerResponse     = class;                 { "http://sedna.aplus.by/customer/"[GblElm] }
  CustomerTypeResponse = class;                 { "http://sedna.aplus.by/customer/"[GblElm] }
  CustomerAccount      = class;                 { "http://sedna.aplus.by/customer/"[GblCplx] }
  Customer             = class;                 { "http://sedna.aplus.by/customer/"[GblCplx] }
  ResponseError        = class;                 { "http://sedna.aplus.by/customer/"[GblCplx] }
  CustomerType         = class;                 { "http://sedna.aplus.by/customer/"[GblCplx] }
 
 
  // ************************************************************************ //
  // XML       : CustomerAccountResponse, global, <element>
  // Namespace : [url]http://sedna.aplus.by/customer/[/url]
  // ************************************************************************ //
  CustomerAccountResponse = class(TRemotable)
  private
    Faccount: CustomerAccount;
    Faccount_Specified: boolean;
    Ferror: ResponseError;
    Ferror_Specified: boolean;
    procedure Setaccount(Index: Integer; const ACustomerAccount: CustomerAccount);
    function  account_Specified(Index: Integer): boolean;
    procedure Seterror(Index: Integer; const AResponseError: ResponseError);
    function  error_Specified(Index: Integer): boolean;
  public
    destructor Destroy; override;
  published
    property account: CustomerAccount  Index (IS_OPTN) read Faccount write Setaccount stored account_Specified;
    property error:   ResponseError    Index (IS_OPTN) read Ferror write Seterror stored error_Specified;
  end;
 
 
 
  // ************************************************************************ //
  // XML       : CustomerResponse, global, <element>
  // Namespace : [url]http://sedna.aplus.by/customer/[/url]
  // ************************************************************************ //
  CustomerResponse = class(TRemotable)
  private
    Fcustomer: Customer;
    Fcustomer_Specified: boolean;
    Ferror: ResponseError;
    Ferror_Specified: boolean;
    procedure Setcustomer(Index: Integer; const ACustomer: Customer);
    function  customer_Specified(Index: Integer): boolean;
    procedure Seterror(Index: Integer; const AResponseError: ResponseError);
    function  error_Specified(Index: Integer): boolean;
  public
    destructor Destroy; override;
  published
    property customer: Customer       Index (IS_OPTN) read Fcustomer write Setcustomer stored customer_Specified;
    property error:    ResponseError  Index (IS_OPTN) read Ferror write Seterror stored error_Specified;
  end;
 
 
 
  // ************************************************************************ //
  // XML       : CustomerTypeResponse, global, <element>
  // Namespace : [url]http://sedna.aplus.by/customer/[/url]
  // ************************************************************************ //
  CustomerTypeResponse = class(TRemotable)
  private
    FcustomerType: CustomerType;
    FcustomerType_Specified: boolean;
    Ferror: ResponseError;
    Ferror_Specified: boolean;
    procedure SetcustomerType(Index: Integer; const ACustomerType: CustomerType);
    function  customerType_Specified(Index: Integer): boolean;
    procedure Seterror(Index: Integer; const AResponseError: ResponseError);
    function  error_Specified(Index: Integer): boolean;
  public
    destructor Destroy; override;
  published
    property customerType: CustomerType   Index (IS_OPTN) read FcustomerType write SetcustomerType stored customerType_Specified;
    property error:        ResponseError  Index (IS_OPTN) read Ferror write Seterror stored error_Specified;
  end;
 
 
 
  // ************************************************************************ //
  // XML       : CustomerAccount, global, <complexType>
  // Namespace : [url]http://sedna.aplus.by/customer/[/url]
  // ************************************************************************ //
  CustomerAccount = class(TRemotable)
  private
    Fid: Cardinal;
    FcustomerId: Cardinal;
    Fbalance: Double;
  published
    property id:         Cardinal  read Fid write Fid;
    property customerId: Cardinal  read FcustomerId write FcustomerId;
    property balance:    Double    read Fbalance write Fbalance;
  end;
 
 
 
  // ************************************************************************ //
  // XML       : Customer, global, <complexType>
  // Namespace : [url]http://sedna.aplus.by/customer/[/url]
  // ************************************************************************ //
  Customer = class(TRemotable)
  private
    Fid: Cardinal;
    Ftype_: Int64;
    Fgroup: Cardinal;
    Finfo: Array;
  published
    property id:    Cardinal  read Fid write Fid;
    property type_: Int64     read Ftype_ write Ftype_;
    property group: Cardinal  read Fgroup write Fgroup;
    property info:  Array       read Finfo write Finfo;
  end;
 
 
  // ************************************************************************ //
  // XML       : ResponseError, global, <complexType>
  // Namespace : [url]http://sedna.aplus.by/customer/[/url]
  // ************************************************************************ //
  ResponseError = class(TRemotable)
  private
    Fcode: Int64;
    Fmessage_: string;
    Felist: Array;
    Felist_Specified: boolean;
    procedure Setelist(Index: Integer; const AArray: Array);
    function  elist_Specified(Index: Integer): boolean;
  published
    property code:     Int64   read Fcode write Fcode;
    property message_: string  read Fmessage_ write Fmessage_;
    property elist:    Array     Index (IS_OPTN) read Felist write Setelist stored elist_Specified;
  end;
 
 
 
  // ************************************************************************ //
  // XML       : CustomerType, global, <complexType>
  // Namespace : [url]http://sedna.aplus.by/customer/[/url]
  // ************************************************************************ //
  CustomerType = class(TRemotable)
  private
    Fid: Cardinal;
    Ftitle: string;
    FnamePattern: Array;
    Ffileds: Array;
  published
    property id:          Cardinal  read Fid write Fid;
    property title:       string    read Ftitle write Ftitle;
    property namePattern: Array     read FnamePattern write FnamePattern;
    property fileds:      Array     read Ffileds write Ffileds;
  end;
 
 
  // ************************************************************************ //
  // Namespace : [url]http://sedna.aplus.by/customer/[/url]
  // soapAction: [url]http://sedna.aplus.by/customer/%operationName%[/url]
  // transport : [url]http://schemas.xmlsoap.org/soap/http[/url]
  // style     : rpc
  // use       : encoded
  // binding   : customerSOAP
  // service   : customer
  // port      : customerSOAP
  // URL       : [url]http://sedna.aplus.by/sedna/soap/customer.php[/url]
  // ************************************************************************ //
  сustomer = interface(IInvokable)
  ['{E006FA42-8302-2A9A-17C5-3AD65AC33213}']
    function  getCustomerGroups: Array; stdcall;
    function  getCustomerType(const id: Cardinal): CustomerTypeResponse; stdcall;
    function  getCustomer(const customerId: Cardinal): CustomerResponse; stdcall;
    function  getCustomerByAccountId(const accountId: Cardinal): CustomerResponse; stdcall;
    function  getCustomerAccount(const accountId: Cardinal): CustomerAccountResponse; stdcall;
    function  createCustomer(const type_: Int64; const group: Cardinal; const data: Array): CustomerResponse; stdcall;
    function  updateCustomer(const customerId: Cardinal; const data: Array): CustomerResponse; stdcall;
  end;
 
function Getcustomer(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): сustomer;
 
 
implementation
  uses SysUtils;
 
function Getcustomer(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): сustomer;
const
  defWSDL = 'http://sedna.aplus.by/sedna/wsdl/customer.wsdl';
  defURL  = 'http://sedna.aplus.by/sedna/soap/customer.php';
  defSvc  = 'customer';
  defPrt  = 'customerSOAP';
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 сustomer);
    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;
 
 
destructor CustomerAccountResponse.Destroy;
begin
  SysUtils.FreeAndNil(Faccount);
  SysUtils.FreeAndNil(Ferror);
  inherited Destroy;
end;
 
procedure CustomerAccountResponse.Setaccount(Index: Integer; const ACustomerAccount: CustomerAccount);
begin
  Faccount := ACustomerAccount;
  Faccount_Specified := True;
end;
 
function CustomerAccountResponse.account_Specified(Index: Integer): boolean;
begin
  Result := Faccount_Specified;
end;
 
procedure CustomerAccountResponse.Seterror(Index: Integer; const AResponseError: ResponseError);
begin
  Ferror := AResponseError;
  Ferror_Specified := True;
end;
 
function CustomerAccountResponse.error_Specified(Index: Integer): boolean;
begin
  Result := Ferror_Specified;
end;
 
destructor CustomerResponse.Destroy;
begin
  SysUtils.FreeAndNil(Fcustomer);
  SysUtils.FreeAndNil(Ferror);
  inherited Destroy;
end;
 
procedure CustomerResponse.Setcustomer(Index: Integer; const ACustomer: Customer);
begin
  Fcustomer := ACustomer;
  Fcustomer_Specified := True;
end;
 
function CustomerResponse.customer_Specified(Index: Integer): boolean;
begin
  Result := Fcustomer_Specified;
end;
 
procedure CustomerResponse.Seterror(Index: Integer; const AResponseError: ResponseError);
begin
  Ferror := AResponseError;
  Ferror_Specified := True;
end;
 
function CustomerResponse.error_Specified(Index: Integer): boolean;
begin
  Result := Ferror_Specified;
end;
 
destructor CustomerTypeResponse.Destroy;
begin
  SysUtils.FreeAndNil(FcustomerType);
  SysUtils.FreeAndNil(Ferror);
  inherited Destroy;
end;
 
procedure CustomerTypeResponse.SetcustomerType(Index: Integer; const ACustomerType: CustomerType);
begin
  FcustomerType := ACustomerType;
  FcustomerType_Specified := True;
end;
 
function CustomerTypeResponse.customerType_Specified(Index: Integer): boolean;
begin
  Result := FcustomerType_Specified;
end;
 
procedure CustomerTypeResponse.Seterror(Index: Integer; const AResponseError: ResponseError);
begin
  Ferror := AResponseError;
  Ferror_Specified := True;
end;
 
function CustomerTypeResponse.error_Specified(Index: Integer): boolean;
begin
  Result := Ferror_Specified;
end;
 
procedure ResponseError.Setelist(Index: Integer; const AArray: Array);
begin
  Felist := AArray;
  Felist_Specified := True;
end;
 
function ResponseError.elist_Specified(Index: Integer): boolean;
begin
  Result := Felist_Specified;
end;
 
initialization
  { customer }
  InvRegistry.RegisterInterface(TypeInfo(customer), 'http://sedna.aplus.by/customer/', 'UTF-8');
  InvRegistry.RegisterDefaultSOAPAction(TypeInfo(customer), 'http://sedna.aplus.by/customer/%operationName%');
  { customer.createCustomer }
  InvRegistry.RegisterParamInfo(TypeInfo(customer), 'createCustomer', 'type_', 'type', '');
  RemClassRegistry.RegisterXSClass(CustomerAccountResponse, 'http://sedna.aplus.by/customer/', 'CustomerAccountResponse');
  RemClassRegistry.RegisterXSClass(CustomerResponse, 'http://sedna.aplus.by/customer/', 'CustomerResponse');
  RemClassRegistry.RegisterXSClass(CustomerTypeResponse, 'http://sedna.aplus.by/customer/', 'CustomerTypeResponse');
  RemClassRegistry.RegisterXSClass(CustomerAccount, 'http://sedna.aplus.by/customer/', 'CustomerAccount');
  RemClassRegistry.RegisterXSClass(Customer, 'http://sedna.aplus.by/customer/', 'Customer');
  RemClassRegistry.RegisterExternalPropName(TypeInfo(Customer), 'type_', '[ExtName="type"]');
  RemClassRegistry.RegisterXSClass(ResponseError, 'http://sedna.aplus.by/customer/', 'ResponseError');
  RemClassRegistry.RegisterExternalPropName(TypeInfo(ResponseError), 'message_', '[ExtName="message"]');
  RemClassRegistry.RegisterXSClass(CustomerType, 'http://sedna.aplus.by/customer/', 'CustomerType');
 
end.
0
Модератор
3490 / 2613 / 741
Регистрация: 19.09.2012
Сообщений: 7,974
01.01.2013, 23:14 4
В коде имеется как минимум один нестандартный тип переменных (Array), который в данном модуле нигде не описан.
Возможно его описание есть в других модулях:
Delphi
1
uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;
Что-то об этой проблеме говорится в комментариях кода:
Delphi
1
2
3
4
5
6
7
8
9
10
11
12
// ************************************************************************ //
  // 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.
  // ************************************************************************ //
  // !:double          - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:string          - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:integer         - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:unsignedInt     - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:Array           - "http://schemas.xmlsoap.org/soap/encoding/"[Gbl]
К сожалению, я не силен в английском, но общий смысл такой, что перечисленные ниже типы тут не описаны.
Возможно нужна одна из последних версий Дельфи или какая-то "примочка" к ней типа Delphi 2010 WSDL importer.

Добавлено через 9 минут
Думаю можно попробовать подобрать тип массива "методом тыка"
Delphi
1
2
...: Array of integer;
// и т.д.
либо узнать тип у разработчиков вебсервиса.
1
13 / 10 / 4
Регистрация: 25.11.2010
Сообщений: 358
Записей в блоге: 1
01.01.2013, 23:16  [ТС] 5
gorfil, спасибо. Да, пробовала "методом тыка", но так не работает. Постараюсь узнать больше.
0
01.01.2013, 23:16
IT_Exp
Эксперт
87844 / 49110 / 22898
Регистрация: 17.06.2006
Сообщений: 92,604
01.01.2013, 23:16
Помогаю со студенческими работами здесь

Работа с Веб Сервисами на ASP.Net
Здравствуйте! Подскажите пожалуйста новичку в работе с Веб Сервисами, как передать объект класса в...

Работа с SOAP
Нужно отправить xml с помощью SOAP И получить ответ Роюсь в сети но простого и ясного ответа не...

Работа с SOAP
Подскажите, пожалуйста, как установить модуль suds для работы с SOAP. Скачивала отсюда...

Работа с SOAP
Здравствуйте, уважаемые форумчане! Пишу SOAP запрос к удаленному сервису. Возникла проблема с...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
5
Ответ Создать тему
Опции темы

КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2024, CyberForum.ru