comments
authorAleš Křenek <ljocha@ics.muni.cz>
Wed, 26 Mar 2008 16:43:58 +0000 (16:43 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Wed, 26 Mar 2008 16:43:58 +0000 (16:43 +0000)
org.glite.lb.client/examples/job-status.pl
org.glite.lb.client/examples/user-jobs.pl

index e3ea58b..c5c654a 100755 (executable)
@@ -3,6 +3,8 @@
 use SOAP::Lite;
 use Data::Dumper;
 
+# see user-jobs.pl for comments on this magic
+
 $ENV{HTTPS_CA_DIR}='/etc/grid-security/certificates';
 $ENV{HTTPS_VERSION}='3';
 
@@ -15,24 +17,31 @@ $host = $1; $port = $2;
 $server = $host . ':' . ($port + 3);
 
 $c = SOAP::Lite
-       -> proxy($server) -> uri('http://glite.org/wsdl/services/lb');
+       -> proxy($server)
+       -> uri('http://glite.org/wsdl/services/lb');
 
 service $c 'http://egee.cesnet.cz/cms/export/sites/egee/en/WSDL/HEAD/LB.wsdl';
 ns $c 'http://glite.org/wsdl/elements/lb';
+
+# we need another namespace explicitely here
 $c->serializer->register_ns('http://glite.org/wsdl/types/lb','lbtype');
 
 on_fault $c sub { print Dumper($_[1]->fault); $fault = 1; };
 
+# construct the request, see SOAP::Data docs for details
 $req = SOAP::Data->value(
                SOAP::Data->name(jobid=>$job),
+# here the other namespace is used
                SOAP::Data->name(flags=>'')->type('lbtype:jobFlags')
        );
 
+# call the WS op
 $resp = JobStatus $c $req;
 $body = $resp->body();
 
 # print Dumper $resp->body();
 
+# pick something reasonable from the response to print
 unless ($fault) {
        @fields = qw/state jobtype owner networkServer doneCode exitCode childrenNum/;
        $stat = $resp->body()->{JobStatusResponse}->{stat};
index 63295a7..2ad5d08 100755 (executable)
@@ -4,26 +4,36 @@ use SOAP::Lite;
 use Data::Dumper;
 
 $ENV{HTTPS_CA_DIR}='/etc/grid-security/certificates';
+
+# necessary to get compatible SSL handshake with the Globus server implementation
 $ENV{HTTPS_VERSION}='3';
 
+# a trick to make proxy credentials work
 $proxy = $ENV{X509_USER_PROXY} ? $ENV{X509_USER_PROXY} : "/tmp/x509up_u$<";
 $ENV{HTTPS_CERT_FILE}= $ENV{HTTPS_KEY_FILE} = $ENV{HTTPS_CA_FILE} = $proxy;
 
 $server = shift or die "usage: $0 server\n";
 
+# initialize the server handle, wsdl, and namespace
 $c = SOAP::Lite
-       -> proxy($server) -> uri('http://glite.org/wsdl/services/lb');
+       -> proxy($server)
+       -> uri('http://glite.org/wsdl/services/lb');
 
 service $c 'http://egee.cesnet.cz/cms/export/sites/egee/en/WSDL/HEAD/LB.wsdl';
 ns $c 'http://glite.org/wsdl/elements/lb';
 
+# setup trivial fault handler
 on_fault $c sub { print Dumper($_[1]->fault); $fault = 1; };
 
+# call the actual WS operation
 $resp = UserJobs $c;
+
 $body = $resp->body();
 
-# print Dumper $resp->body();
+# too much rubbish
+# print Dumper $body;
 
+# follow the response structure and pick just jobids and states to print
 unless ($fault) {
        $njobs = $#{$body->{UserJobsResponse}->{jobs}};
        for ($i = 0; $i < $njobs; $i++) {