| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
use Data::Dumper; |
|---|
| 4 |
|
|---|
| 5 |
use SOAP::Lite +trace => 'all'; |
|---|
| 6 |
|
|---|
| 7 |
use SOAP::Lite::Packager; |
|---|
| 8 |
use MIME::Entity; |
|---|
| 9 |
use MIME::Base64; |
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
open(A, $ARGV[0]) or die "Can't open $ARGV[0]\n"; |
|---|
| 13 |
$fullfile = ""; |
|---|
| 14 |
while(<A>){ |
|---|
| 15 |
$fullfile .= $_; |
|---|
| 16 |
} |
|---|
| 17 |
$encoded = encode_base64($fullfile, ""); |
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
@statz = stat($ARGV[0]); |
|---|
| 21 |
$decodedLength = $statz[7]; |
|---|
| 22 |
if(length($fullfile) != $decodedLength){ |
|---|
| 23 |
print "What tha...\n"; |
|---|
| 24 |
} |
|---|
| 25 |
$encodedLength = length($encoded); |
|---|
| 26 |
print "File size = " . $statz[7] . "\n"; |
|---|
| 27 |
print "Base64 size = $encodedLength\n"; |
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
$fileNameSOAP = SOAP::Data->name(fileName => $ARGV[0]); |
|---|
| 36 |
$waitFileSOAP = SOAP::Data->name(waitTime => 15); |
|---|
| 37 |
$dataSOAP = SOAP::Data->name(data => $encoded); |
|---|
| 38 |
$encodedLengthSOAP = SOAP::Data->name(encodedLength => $encodedLength); |
|---|
| 39 |
$decodedLengthSOAP = SOAP::Data->name(decodedLength => $decodedLength); |
|---|
| 40 |
|
|---|
| 41 |
$pingDataA = SOAP::Data->name(a => "http://www.cnn.com"); |
|---|
| 42 |
|
|---|
| 43 |
$calcDataA = SOAP::Data->name(a => $ARGV[0]); |
|---|
| 44 |
$calcDataB = SOAP::Data->name(b => 2); |
|---|
| 45 |
|
|---|
| 46 |
$structData = SOAP::Data->name(a => "a"); |
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 |
|
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
print "\ncalling client setup\n\n"; |
|---|
| 62 |
|
|---|
| 63 |
|
|---|
| 64 |
$client = SOAP::Lite |
|---|
| 65 |
-> proxy('http://192.168.0.131:1234/') |
|---|
| 66 |
-> ns('capture'); |
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 |
print "\ncalling receiveFileBase64\n\n"; |
|---|
| 72 |
$som = $client->receiveFileBase64($fileNameSOAP); |
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 |
|
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 |
$encodedDataFromServer = $som->result; |
|---|
| 85 |
$fileFromServer = decode_base64($encodedDataFromServer); |
|---|
| 86 |
open(BLA, ">serverfile.exe"); |
|---|
| 87 |
print BLA $fileFromServer; |
|---|
| 88 |
close(BLA); |
|---|
| 89 |
|
|---|
| 90 |
|
|---|
| 91 |
|
|---|
| 92 |
|
|---|
| 93 |
|
|---|
| 94 |
|
|---|
| 95 |
|
|---|
| 96 |
|
|---|
| 97 |
|
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 |
|
|---|
| 101 |
|
|---|
| 102 |
|
|---|
| 103 |
|
|---|
| 104 |
|
|---|
| 105 |
|
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 |
|
|---|