D
D
Den_CH2012-11-08 13:10:03
Perl
Den_CH, 2012-11-08 13:10:03

Obtaining a registry of banned sites?

This is the task - to get a file from the registry of prohibited sites.
Used by the dock zapret-info.gov.ru/docs/description_for_operators_...
Logic: execute the getLastDumpDate method , determine the freshness of the registry. If the registry is fresh, we send the request file and the disconnected ES. in the sendRequest method. In response, we receive a code in the form of a set of characters, such as this: "66a7d767cbe88d6bfeb8c9e9790e77be". This code should be fed to the getResult method , which will return the file as a ZIP archive. Here's the catch - if you immediately execute this method after receiving the code, the method answers " the request is being processed ", that is, everything is fine - the dock indicates that the getResult methodshould be done in a few minutes. I execute this method in a few minutes - it answers: " Error! Incorrect value of ES ".
Maybe someone from the community solved this problem, and solved it? I will be grateful for help.
Using Perl + SOAP::Lite
Briefly highlights of the code:

open FREQ, '<', 'request.xml';
open FSIG, '<', 'request.xml.sig';

$sig = <FSIG>;
$req = <FREQ>;

close FREQ;
close FSIG;

# Отправка запроса и электронной подписи
$soap = SOAP::Lite->service("http://www.zapret-info.gov.ru/services/OperatorRequest/?wsdl");
my @params =  (
    SOAP::Data->name( 'requestFile' )->type("string")->value($req),
    SOAP::Data->name( 'signatureFile')->type("xsd:base64Binary")->value($sig),
);
my $result = $soap->call( sendRequest =>  @params );
my $code = $result->body->{sendRequestResponse}->{code};

# Попытка получить файл реестра - оправляем полученный $code
my @params =  ( SOAP::Data->name( 'code' )->type("xsd:string")->value( $code ) );
my $resultFile = $soap->call( getResult =>  @params );

# При немедленном запуске этого метода скажет "запрос обрабатывается". При запуске по истечении нескольких минут - "некорректное значение ЭП"
print $resultFile->body->{getResultResponse}->{resultComment};

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Den_CH, 2012-11-08
@Den_CH

stalkerxxl, thanks, corrected.
Problem solved - my carelessness. I turned on "use SOAP::Lite;# qw(trace);", and saw that the request file was leaving in an obscene form.

SOAP::Data->name( 'requestFile' )->type("string")->value($req),

converted to
SOAP::Data->name( 'requestFile' )->type("xsd:base64Binary")->value( encode_base64($req) ),

I was misled by the fact that the code was still returned by the sendRequest method , although I suspected an error in thinking that the request file and signature were compared in the sendRequest method . Apparently, the comparison occurs when the getResult method is executed . In general, everything is turned upside down ...

V
Vayladion Gognazdiak, 2015-12-23
@etspring

https://gist.github.com/etspring/35b415f4723f6b52d8d1 - ruby ​​option

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question