С Новым годом! Форум программистов, компьютерный форум, киберфорум
C++ Builder
Войти
Регистрация
Восстановить пароль
Блоги Сообщество Поиск Заказать работу  
 
 Аватар для Nazar25
0 / 0 / 0
Регистрация: 06.12.2014
Сообщений: 80

Подключение веб-сервиса по SOAP

15.12.2015, 03:43. Показов 4373. Ответов 0
Метки нет (Все метки)

Студворк — интернет-сервис помощи студентам
Помогите, пожалуйста.
Хочу написать программку, которая выводила бы мне информацию о посылке. Я ввожу трек номер, а мне показывается сообщение о текущем состоянии.
Работаю в Embarcadero RAD Studio XE7. Для проверки кинул только один Button на форму.
Зашел на сайт Укрпочты, скопировал WSDL ссылку, зашел через WSDL Importer, потом добавил ссылку на barcodestatistic.h в include. Создал объект класса _di_BarcodeStatisticSoap и назвал его - Ukrposhta. Потом используя GetBarcodeInfo ввожу guid, barcode, culture.
Запускаю программу, отладчиком помечаю строчку с GetBarcodeInfo, но она выдает ошибку.
Подскажите, пожалуйста, что я делаю не так? И что должно быть в guid?
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//---------------------------------------------------------------------------
 
#include <vcl.h>
#pragma hdrstop
 
#include "Unit1.h"
#include "barcodestatistic.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
Culture uk;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{_di_BarcodeStatisticSoap Ukrposhta = GetBarcodeStatisticSoap();
Ukrposhta->GetBarcodeInfo("fcc8d9e1-b6f9-438f-9ac8-b67ab44391dd","RI660223960CN",uk);
}
//---------------------------------------------------------------------------
Код файла barcodestatistic.h:
C++
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
// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL     : [url]http://services.ukrposhta.com/barcodestatistic/barcodestatistic.asmx?WSDL[/url]
//  >Import : http://services.ukrposhta.com/barcodestatistic/barcodestatistic.asmx?WSDL>0
// Encoding : utf-8
// Version  : 1.0
// (15.12.2015 0:27:59 - - $Rev: 69934 $)
// ************************************************************************ //
 
#ifndef   barcodestatisticH
#define   barcodestatisticH
 
#include <System.hpp>
#include <Soap.InvokeRegistry.hpp>
#include <Soap.XSBuiltIns.hpp>
#include <Soap.SOAPHTTPClient.hpp>
 
#if !defined(SOAP_REMOTABLE_CLASS)
#define SOAP_REMOTABLE_CLASS __declspec(delphiclass)
#endif
#if !defined(IS_OPTN)
#define IS_OPTN 0x0001
#endif
#if !defined(IS_REF)
#define IS_REF 0x0080
#endif
 
 
namespace NS_barcodestatistic {
 
// ************************************************************************ //
// 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.
// ************************************************************************ //
// !:string          - "http://www.w3.org/2001/XMLSchema"[Gbl]
 
class SOAP_REMOTABLE_CLASS BarcodeInfoService2;
class SOAP_REMOTABLE_CLASS BarcodeInfoService;
 
enum class Culture   /* "http://barcode.org/"[GblSmpl] */
{
  uk,
  en
};
 
class Culture_TypeInfoHolder : public TObject {
  Culture __instanceType;
public:
__published:
  __property Culture __propType = { read=__instanceType };
};
 
 
 
// ************************************************************************ //
// XML       : BarcodeInfoService, global, <complexType>
// Namespace : [url]http://barcode.org/[/url]
// ************************************************************************ //
class BarcodeInfoService2 : public TRemotable {
private:
  UnicodeString   Fbarcode;
  bool            Fbarcode_Specified;
  UnicodeString   Fcode;
  bool            Fcode_Specified;
  UnicodeString   Flastofficeindex;
  bool            Flastofficeindex_Specified;
  UnicodeString   Feventdate;
  bool            Feventdate_Specified;
  UnicodeString   Flastoffice;
  bool            Flastoffice_Specified;
  UnicodeString   Feventdescription;
  bool            Feventdescription_Specified;
  void __fastcall Setbarcode(int Index, UnicodeString _prop_val)
  {  Fbarcode = _prop_val; Fbarcode_Specified = true;  }
  bool __fastcall barcode_Specified(int Index)
  {  return Fbarcode_Specified;  }
  void __fastcall Setcode(int Index, UnicodeString _prop_val)
  {  Fcode = _prop_val; Fcode_Specified = true;  }
  bool __fastcall code_Specified(int Index)
  {  return Fcode_Specified;  }
  void __fastcall Setlastofficeindex(int Index, UnicodeString _prop_val)
  {  Flastofficeindex = _prop_val; Flastofficeindex_Specified = true;  }
  bool __fastcall lastofficeindex_Specified(int Index)
  {  return Flastofficeindex_Specified;  }
  void __fastcall Seteventdate(int Index, UnicodeString _prop_val)
  {  Feventdate = _prop_val; Feventdate_Specified = true;  }
  bool __fastcall eventdate_Specified(int Index)
  {  return Feventdate_Specified;  }
  void __fastcall Setlastoffice(int Index, UnicodeString _prop_val)
  {  Flastoffice = _prop_val; Flastoffice_Specified = true;  }
  bool __fastcall lastoffice_Specified(int Index)
  {  return Flastoffice_Specified;  }
  void __fastcall Seteventdescription(int Index, UnicodeString _prop_val)
  {  Feventdescription = _prop_val; Feventdescription_Specified = true;  }
  bool __fastcall eventdescription_Specified(int Index)
  {  return Feventdescription_Specified;  }
__published:
  __property UnicodeString    barcode = { index=(IS_OPTN), read=Fbarcode, write=Setbarcode, stored = barcode_Specified };
  __property UnicodeString       code = { index=(IS_OPTN), read=Fcode, write=Setcode, stored = code_Specified };
  __property UnicodeString lastofficeindex = { index=(IS_OPTN), read=Flastofficeindex, write=Setlastofficeindex, stored = lastofficeindex_Specified };
  __property UnicodeString  eventdate = { index=(IS_OPTN), read=Feventdate, write=Seteventdate, stored = eventdate_Specified };
  __property UnicodeString lastoffice = { index=(IS_OPTN), read=Flastoffice, write=Setlastoffice, stored = lastoffice_Specified };
  __property UnicodeString eventdescription = { index=(IS_OPTN), read=Feventdescription, write=Seteventdescription, stored = eventdescription_Specified };
};
 
 
 
 
// ************************************************************************ //
// XML       : BarcodeInfoService, global, <element>
// Namespace : [url]http://barcode.org/[/url]
// ************************************************************************ //
class BarcodeInfoService : public BarcodeInfoService2 {
private:
__published:
};
 
 
 
// ************************************************************************ //
// Namespace : [url]http://barcode.org/[/url]
// soapAction: [url]http://barcode.org/GetBarcodeInfo[/url]
// transport : [url]http://schemas.xmlsoap.org/soap/http[/url]
// style     : document
// use       : literal
// binding   : BarcodeStatisticSoap
// service   : BarcodeStatistic
// port      : BarcodeStatisticSoap
// URL       : [url]http://services.ukrposhta.com/barcodestatistic/barcodestatistic.asmx[/url]
// ************************************************************************ //
__interface INTERFACE_UUID("{E05140C3-F554-4B04-9E90-13946666305F}") BarcodeStatisticSoap : public IInvokable
{
public:
  virtual BarcodeInfoService2* GetBarcodeInfo(const UnicodeString guid, const UnicodeString barcode, const Culture culture) = 0;
};
typedef DelphiInterface<BarcodeStatisticSoap> _di_BarcodeStatisticSoap;
 
 
// ************************************************************************ //
// Namespace : [url]http://barcode.org/[/url]
// style     : ????
// use       : ????
// binding   : BarcodeStatisticHttpGet
// service   : BarcodeStatistic
// port      : BarcodeStatisticHttpGet
// ************************************************************************ //
__interface INTERFACE_UUID("{035DD936-7838-C6DB-FB50-4F26E2D765F4}") BarcodeStatisticHttpGet : public IInvokable
{
public:
  virtual BarcodeInfoService* GetBarcodeInfo(const UnicodeString guid, const UnicodeString barcode, const UnicodeString culture) = 0;
};
typedef DelphiInterface<BarcodeStatisticHttpGet> _di_BarcodeStatisticHttpGet;
 
 
// ************************************************************************ //
// Namespace : [url]http://barcode.org/[/url]
// style     : ????
// use       : ????
// binding   : BarcodeStatisticHttpPost
// service   : BarcodeStatistic
// port      : BarcodeStatisticHttpPost
// ************************************************************************ //
__interface INTERFACE_UUID("{AB6DD959-15A9-3FA8-6312-12CCA5886F7D}") BarcodeStatisticHttpPost : public IInvokable
{
public:
  virtual BarcodeInfoService* GetBarcodeInfo(const UnicodeString guid, const UnicodeString barcode, const UnicodeString culture) = 0;
};
typedef DelphiInterface<BarcodeStatisticHttpPost> _di_BarcodeStatisticHttpPost;
 
_di_BarcodeStatisticSoap GetBarcodeStatisticSoap(bool useWSDL=false, System::String addr= System::String(), Soaphttpclient::THTTPRIO* HTTPRIO=0);
 
_di_BarcodeStatisticHttpGet GetBarcodeStatisticHttpGet(bool useWSDL=false, System::String addr= System::String(), Soaphttpclient::THTTPRIO* HTTPRIO=0);
 
_di_BarcodeStatisticHttpPost GetBarcodeStatisticHttpPost(bool useWSDL=false, System::String addr= System::String(), Soaphttpclient::THTTPRIO* HTTPRIO=0);
 
 
};     // NS_barcodestatistic
 
#if !defined(NO_IMPLICIT_NAMESPACE_USE)
using  namespace NS_barcodestatistic;
#endif
 
 
 
#endif // barcodestatisticH
P.S. Кому интересно: http://ukrposhta.ua/vidslidkuvati-forma-poshuku
Миниатюры
Подключение веб-сервиса по SOAP  
0
cpp_developer
Эксперт
20123 / 5690 / 1417
Регистрация: 09.04.2010
Сообщений: 22,546
Блог
15.12.2015, 03:43
Ответы с готовыми решениями:

XML SOAP PHP 1с(Нужно забрать XML c веб сервиса)
Хелп плиз есть веб сервис раскатанный на 1с ...

Подключение в консольном С#-приложение, метода веб-сервиса калькулятор
Как подключить в консольном С#-приложение, метод веб-сервиса калькулятор?

SOAP получение данных с web-сервиса
Есть код: &lt;?php $client = new SoapClient(&quot;http://xxx.ru/WCF/ClientService.svc?wsdl&quot;); $params = array ...

0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
raxper
Эксперт
30234 / 6612 / 1498
Регистрация: 28.12.2010
Сообщений: 21,154
Блог
15.12.2015, 03:43
Помогаю со студенческими работами здесь

Отображение xml из SOAP web-сервиса
Добрый день! Подскажите есть web-сервис, написанный по технологии SOAP, необходимо создать php файл, который будет отображать...

SOAP клиент для web-сервиса
Здравствуйте. Подобно этой теме https://www.cyberforum.ru/delphi-networks/thread1369524.html Сделал подобное приложение на турбо...

Через SOAP запрос получить информацию с сервиса ФИАС
Всем привет! Столкнулся с проблемой получения результата с сервиса ФИАС посредством SOAP. До этого SOAP ниразу не пользовался, поэтому не...

Как получить данные от wcf сервиса через SOAP
Имеется wcf service. Необходимо вызвать его метод и получить данные. Возможно ли это сделать через WebClient, например?

SOAP клиент для web-сервиса npchk.nalog.ru
Всем привет. Возникла необходимость написать клиент для сервиса http://npchk.nalog.ru. WSDL сервиса -...


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

Или воспользуйтесь поиском по форуму:
1
Ответ Создать тему
Новые блоги и статьи
Расчёт переходных процессов в цепи постоянного тока
igorrr37 16.01.2026
/ * Дана цепь постоянного тока с R, L, C, k(ключ), U, E, J. Программа составляет систему уравнений по 1 и 2 законам Кирхгофа, решает её и находит токи на L и напряжения на C в установ. режимах до и. . .
Восстановить юзерскрипты Greasemonkey из бэкапа браузера
damix 15.01.2026
Если восстановить из бэкапа профиль Firefox после переустановки винды, то список юзерскриптов в Greasemonkey будет пустым. Но восстановить их можно так. Для этого понадобится консольная утилита. . .
Изучаю kubernetes
lagorue 13.01.2026
А пригодятся-ли мне знания kubernetes в России?
Сукцессия микоризы: основная теория в виде двух уравнений.
anaschu 11.01.2026
https:/ / rutube. ru/ video/ 7a537f578d808e67a3c6fd818a44a5c4/
WordPad для Windows 11
Jel 10.01.2026
WordPad для Windows 11 — это приложение, которое восстанавливает классический текстовый редактор WordPad в операционной системе Windows 11. После того как Microsoft исключила WordPad из. . .
Classic Notepad for Windows 11
Jel 10.01.2026
Old Classic Notepad for Windows 11 Приложение для Windows 11, позволяющее пользователям вернуть классическую версию текстового редактора «Блокнот» из Windows 10. Программа предоставляет более. . .
Почему дизайн решает?
Neotwalker 09.01.2026
В современном мире, где конкуренция за внимание потребителя достигла пика, дизайн становится мощным инструментом для успеха бренда. Это не просто красивый внешний вид продукта или сайта — это. . .
Модель микоризы: классовый агентный подход 3
anaschu 06.01.2026
aa0a7f55b50dd51c5ec569d2d10c54f6/ O1rJuneU_ls https:/ / vkvideo. ru/ video-115721503_456239114
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2026, CyberForum.ru