From dad75a04f2a422d0ab86b47b7a49ba8c2e941d78 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ale=C5=A1=20K=C5=99enek?= Date: Thu, 18 Dec 2008 17:51:01 +0000 Subject: [PATCH] two more working examples --- org.glite.lb.ws-test/examples/ws_joblog.pl | 52 +++++++++++++++++++++++++++++ org.glite.lb.ws-test/examples/ws_jobstat.pl | 48 ++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100755 org.glite.lb.ws-test/examples/ws_joblog.pl create mode 100755 org.glite.lb.ws-test/examples/ws_jobstat.pl 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 index 0000000..8118a46 --- /dev/null +++ b/org.glite.lb.ws-test/examples/ws_joblog.pl @@ -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 index 0000000..4acb19d --- /dev/null +++ b/org.glite.lb.ws-test/examples/ws_jobstat.pl @@ -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"; + -- 1.8.2.3