1 package OpenILS::Application::Acq::EDI::Translator;
10 my $proto = 'http://';
11 my $host = $proto . 'localhost';
17 my ($class, %args) = @_;
18 my $self = bless(\%args, $class);
30 my $target = $self->{host} || $host;
31 $target =~ /^\S+:\/\// or $target = ($self->{proto} || $proto) . $target;
32 $target =~ /:\d+$/ or $target .= ':' . ($self->{port} || $port);
33 $target .= ($self->{path} || $path);
34 $self->{verbose} and print "Cleanup: $self->{host} ==> $target\n";
35 $self->{host} = $target;
41 return $self->{client} ||= RPC::XML::Client->new($self->{host}); # TODO: auth
47 my $client = $self->client();
48 $self->{verbose} and print "Trying json2edi on host: $self->{host}\n";
49 my $resp = $client->send_request('edi2json', $text);
50 $self->{verbose} and print Dumper($resp);
57 my $client = $self->client();
58 $self->{verbose} and print "Trying edi2json on host: $self->{host}\n";
59 my $resp = $client->send_request('json2edi', $text);
60 $self->{verbose} and print Dumper($resp);