two more working examples
authorAleš Křenek <ljocha@ics.muni.cz>
Thu, 18 Dec 2008 17:51:01 +0000 (17:51 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Thu, 18 Dec 2008 17:51:01 +0000 (17:51 +0000)
org.glite.lb.ws-test/examples/ws_joblog.pl [new file with mode: 0755]
org.glite.lb.ws-test/examples/ws_jobstat.pl [new file with mode: 0755]

diff --git a/org.glite.lb.ws-test/examples/ws_joblog.pl b/org.glite.lb.ws-test/examples/ws_joblog.pl
new file mode 100755 (executable)
index 0000000..8118a46
--- /dev/null
@@ -0,0 +1,52 @@
+#!/usr/bin/perl
+
+# version known to support enough from document/literal to work
+use SOAP::Lite 0.69;
+
+use Data::Dumper;
+
+$ENV{HTTPS_CA_DIR}='/etc/grid-security/certificates';
+$ENV{HTTPS_VERSION}='3';
+
+$ENV{HTTPS_CA_FILE}= $ENV{HTTPS_CERT_FILE} = $ENV{HTTPS_KEY_FILE} =
+       $ENV{X509_USER_PROXY} ? $ENV{X509_USER_PROXY} : "/tmp/x509up_u$<";
+
+die "usage: $0 jobid\n" unless $#ARGV == 0;
+
+$job = shift;
+
+$job =~ ?https://([^:]*):([0-9]*)/(.*)?;
+$port = $2 + 3;
+$srv = "https://$1:$port/lb";
+
+
+$c = SOAP::Lite
+       -> uri('http://glite.org/wsdl/services/lb')
+       -> proxy($srv) ;
+
+
+# TODO: replace with $srv/lb/?wsdl once it works
+service $c 'http://egee.cesnet.cz/en/WSDL/HEAD/LB.wsdl';
+
+$c->serializer->register_ns('http://glite.org/wsdl/types/lb','lbt');
+
+ns $c 'http://glite.org/wsdl/elements/lb';
+
+$req = SOAP::Data->value(
+               SOAP::Data->name(jobConditions => \SOAP::Data->value(
+                       SOAP::Data->name(attr => 'JOBID')->type('lbt:queryAttr'),
+                       SOAP::Data->name(record => \SOAP::Data->value(
+                               SOAP::Data->name(op => 'EQUAL')->type('lbt:queryOp'),
+                               SOAP::Data->name(value1 => \SOAP::Data->value(
+                                       SOAP::Data->name(c => $job)
+                               ))
+                       ))
+               )),
+       );
+
+on_fault $c sub { print Dumper($_[1]->fault); $fault = 1; };
+
+$resp = $c -> QueryEvents($req);
+
+print Dumper($resp->result),"\n";
+
diff --git a/org.glite.lb.ws-test/examples/ws_jobstat.pl b/org.glite.lb.ws-test/examples/ws_jobstat.pl
new file mode 100755 (executable)
index 0000000..4acb19d
--- /dev/null
@@ -0,0 +1,48 @@
+#!/usr/bin/perl
+
+# version known to support enough from document/literal to work
+use SOAP::Lite 0.69;
+
+use Data::Dumper;
+
+$ENV{HTTPS_CA_DIR}='/etc/grid-security/certificates';
+$ENV{HTTPS_VERSION}='3';
+
+$ENV{HTTPS_CA_FILE}= $ENV{HTTPS_CERT_FILE} = $ENV{HTTPS_KEY_FILE} =
+       $ENV{X509_USER_PROXY} ? $ENV{X509_USER_PROXY} : "/tmp/x509up_u$<";
+
+die "usage: $0 jobid\n" unless $#ARGV == 0;
+
+$job = shift;
+
+$job =~ ?https://([^:]*):([0-9]*)/(.*)?;
+$port = $2 + 3;
+$srv = "https://$1:$port/lb";
+
+
+$c = SOAP::Lite
+       -> uri('http://glite.org/wsdl/services/lb')
+       -> proxy($srv) ;
+
+
+# TODO: replace with $srv/lb/?wsdl once it works
+service $c 'http://egee.cesnet.cz/en/WSDL/HEAD/LB.wsdl';
+
+$c->serializer->register_ns('http://glite.org/wsdl/types/lb','lbt');
+
+ns $c 'http://glite.org/wsdl/elements/lb';
+
+$req = SOAP::Data->value(
+               SOAP::Data->name(jobid => $job),
+               SOAP::Data->name(flags => \SOAP::Data->value(
+                               SOAP::Data->name(flag => 'CLASSADS')->type('lbt:jobFlagsValue'),
+                               SOAP::Data->name(flag => 'CHILDSTAT')->type('lbt:jobFlagsValue')
+               )),
+       );
+
+on_fault $c sub { print Dumper($_[1]->fault); $fault = 1; };
+
+$resp = $c -> JobStatus($req);
+
+print Dumper($resp->result),"\n";
+