Bonjour,

Je suis nouveau sur Perl et j'"hérite" d'un script à modifier.
Ce script est appelé par Progress afin d'invoquer un WebService.
Le retour du WebService est renvoyé à Progress par la sortie standard.

Le script actuel:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
#!/usr/bin/perl -w
#perl -MCPAN -e 'install SOAP::Lite'
#use SOAP::Lite +trace=> 'all' ;
#use SOAP::Lite +trace=> 'debug' ;
use SOAP::Lite;
my $client = SOAP::Lite
    -> uri('urn:prgs:DocLiteral:WSTKDocLiteral')
    -> proxy('http://canas60:25011/wsa/wsa1')
    -> on_action(sub{sprintf '%s/%s', @_ });
 
my $res = $client->Flux_TarifsEng(
    SOAP::Data->name(ipcCodUser => SOAP::Data->type(string => @ARGV )),
    SOAP::Data->name(ipcIDSession => SOAP::Data->type(string => @ARGV)),
    SOAP::Data->name(ipcLstFrsSoc => SOAP::Data->type(string => @ARGV)),
    SOAP::Data->name(ipcLstPrdAdh => SOAP::Data->type(string => @ARGV)),
    SOAP::Data->name(ipcLstTypeDoc => SOAP::Data->type(string => @ARGV)),
    SOAP::Data->name(ipcDebDate => SOAP::Data->type(string => @ARGV)),
    SOAP::Data->name(ipcFinDate => SOAP::Data->type(string => @ARGV)),
    SOAP::Data->name(ipcLstSoc => SOAP::Data->type(string => @ARGV)),
    SOAP::Data->name(ipcLstAdh => SOAP::Data->type(string => @ARGV)),
    SOAP::Data->name(oplOk => SOAP::Data->type(string => '')),
    SOAP::Data->name(oplResultat => SOAP::Data->type(string => '')),
    SOAP::Data->name(opcFileXML => SOAP::Data->type(string => ''))
);
# print "\n\n";
print $res->valueof('//Flux_TarifsEngResponse/oplOk');
print "\n";
print $res->valueof('//Flux_TarifsEngResponse/oplResultat');
print "\n";
print $res->valueof('//Flux_TarifsEngResponse/opcFileXML');
print "\n[EOF]";
La modification consiste à ce que le troisième argument renvoyé par Perl (opcFileXML) ne soit pas renvoyé sur la sortie standard mais directement sur un fichier.

La version modifiée :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
#!/usr/bin/perl -w
#perl -MCPAN -e 'install SOAP::Lite'
#use SOAP::Lite +trace=> 'all' ;
#use SOAP::Lite +trace=> 'debug' ;
use SOAP::Lite;
my $client = SOAP::Lite
    -> uri('urn:prgs:DocLiteral:WSTKDocLiteral')
    -> proxy('http://canas60:25011/wsa/wsa1')
    -> on_action(sub{sprintf '%s/%s', @_ });
 
my $res = $client->Flux_TarifsEng(
    SOAP::Data->name(ipcCodUser => SOAP::Data->type(string => @ARGV )),
    SOAP::Data->name(ipcIDSession => SOAP::Data->type(string => @ARGV)),
    SOAP::Data->name(ipcLstFrsSoc => SOAP::Data->type(string => @ARGV)),
    SOAP::Data->name(ipcLstPrdAdh => SOAP::Data->type(string => @ARGV)),
    SOAP::Data->name(ipcLstTypeDoc => SOAP::Data->type(string => @ARGV)),
    SOAP::Data->name(ipcDebDate => SOAP::Data->type(string => @ARGV)),
    SOAP::Data->name(ipcFinDate => SOAP::Data->type(string => @ARGV)),
    SOAP::Data->name(ipcLstSoc => SOAP::Data->type(string => @ARGV)),
    SOAP::Data->name(ipcLstAdh => SOAP::Data->type(string => @ARGV)),
    SOAP::Data->name(oplOk => SOAP::Data->type(string => '')),
    SOAP::Data->name(oplResultat => SOAP::Data->type(string => '')),
    SOAP::Data->name(opcFileXML => SOAP::Data->type(string => ''))
);
# print "\n\n";
print $res->valueof('//Flux_TarifsEngResponse/oplOk');
print "\n";
print $res->valueof('//Flux_TarifsEngResponse/oplResultat');
print "\n[EOF]";
open(OUT,">c:/perl/essai.xml");
print OUT $res->valueof('//Flux_TarifsEngResponse/opcFileXML');
close(OUT);
Mon problème est que je ne sais pas comment récupérer le deuxième paramètre envoyé à Perl afin de l'utiliser comme partie du nom de fichier à créer (exemple : flux_valeur_d'ipcIDSession.xml).

Si quelqu'un peut m'aider.
Merci