Ayuda con REST::Client
Publicado: 2017-04-21 03:26 @184
Buenos días, no tengo mucha idea de programar en Perl, pero en el trabajo me han pedido que desde un Perl le pase unos parámetros a un servicio web y no tengo mucha idea.
En PowerShell sería así:
Y para Perl tengo esto pero no me funciona:
Gracias.
En PowerShell sería así:
Using powershell Syntax Highlighting
- $input = @{
- cabecera = @{
- terminal = "TDQY"
- };
- datosEntrada = @{
- NOMBRE_FICHERO = $FileName
- MEDIO_E_S = "FTP"
- ENTIDAD = $Cliente
- APLICACION = $Aplicacion
- DSN_FICHERO = $FileName."_".$fecha.$rand
- }
- }
- $jsonInput = ConvertTo-Json $input
- $output = Invoke-RestMethod -Method "POST" -Uri http://dcjbossxxxs2:9080/ConectorREST/services/SN552977 -ContentType "application/json" -Body $jsonInput
- if ($output.error) {
- $output.error
- } else {
- $output
- }
Coloreado en 0.006 segundos, usando GeSHi 1.0.8.4
Y para Perl tengo esto pero no me funciona:
Using perl Syntax Highlighting
- my $requestUrl1 = 'http://dcjbossxxxs2:9080/ConectorREST/services/SN552977';
- my $client1 = REST::Client->new({
- NOMBRE_FICHERO => $FileName,
- MEDIO_E_S => 'FTP',
- ENTIDAD => $Cliente,
- APLICACION => $Aplicacion ,
- DSN_FICHERO => $FileName."_".$fecha.$rand,
- });
- $client1->POST($requestUrl1, {CustomHeader => 'Value'});
- EscribirEnLog(scalar localtime, "$client1");
Coloreado en 0.002 segundos, usando GeSHi 1.0.8.4
Gracias.