Здравствуйте, помогите пожалуйста разобраться с отправкой XML файла.
по инструкции
Цитата:
Сформировать xml-файл (client.xml — название файла) вида для запроса
реквизитов организации:
Код:
<?xml version="1.0" encoding="UTF-8"?>
<ns:Documents Version="1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ns="http://fsrar.ru/WEGAIS/WB_DOC_SINGLE_01"
xmlns:oref="http://fsrar.ru/WEGAIS/ClientRef"
xmlns:qp="http://fsrar.ru/WEGAIS/QueryParameters">
<ns:Owner>
<ns:FSRAR_ID>00040218</ns:FSRAR_ID>
</ns:Owner>
<ns:Document>
<ns:QueryClients>
<qp:Parameters>
<qp:Parameter>
<qp:Name>ИНН</qp:Name>
<qp:Value>1681000049</qp:Value>
</qp:Parameter>
</qp:Parameters>
</ns:QueryClients>
</ns:Document>
</ns:Documents>
Отправить запрос (1.5.1) в УТМ с помощью команды вида:
curl -F''xml_file=@client.xml'' http://localhost:8080/opt/in/QueryPartner
|
Что я и делаю
Код:
procedure TFmMain.BitBtn2Click(Sender: TObject);
var
XMLDoc : TXMLDocument;
HTTP : THTTPSend;
FS: TFileStream;
s : string;
begin
try
Memo1.Clear;
XMLDoc := TXMLDocument.Create(Application);
with XMLDoc do
begin
Options := Options + [doNodeAutoIndent];
Active := True;
Version := '1.0';
Encoding := 'UTF-8';
with AddChild('ns:Documents') do
begin
Attributes['Version'] := '1.0';
Attributes['xmlns:xsi'] := 'http://www.w3.org/2001/XMLSchema-instance';
Attributes['xmlns:ns'] := 'http://fsrar.ru/WEGAIS/WB_DOC_SINGLE_01';
Attributes['xmlns:oref'] := 'http://fsrar.ru/WEGAIS/ClientRef';
Attributes['xmlns:qp'] := 'http://fsrar.ru/WEGAIS/QueryParameters';
with AddChild('ns:Owner') do ChildValues['ns:FSRAR_ID'] := '020000616195';
with AddChild('ns:Document') do
with AddChild('ns:QueryClients') do
with AddChild('qp:Parameters') do
with AddChild('qp:Parameter') do
begin
ChildValues['qp:Name'] := 'ИНН';
ChildValues['qp:Value'] := '6143063881';
end;
SaveToFile('C:\temp\client.xml');
end;
end;
FS := TFileStream.Create('C:\temp\client.xml', fmOpenRead);
FS.Position := 0;
HTTP := THTTPSend.Create;
HTTP.Document.CopyFrom(FS, FS.Size);
//HTTP.Document.SaveToFile('C:\temp\client111.xml'); //Проверка, что документ есть
if HTTP.HTTPMethod('POST', 'http://localhost:8080/opt/in/QueryPartner') then
begin
s := HTTP.ResultString+':'+IntToStr(HTTP.ResultCode);
ShowMessage(s);
Memo1.Lines.Add(s);
end;
finally
FreeAndNil(XMLDoc);
end;
end;
Получаю ошибку
Подскажите где я ошибся???