[MOBY-guts] biomoby commit

Eddie Kawas kawas at dev.open-bio.org
Fri Oct 16 17:43:09 UTC 2009


kawas
Fri Oct 16 13:43:09 EDT 2009
Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts
In directory dev.open-bio.org:/tmp/cvs-serv25056/MOSES-MOBY/bin/scripts

Modified Files:
	moses-testing-service.pl 
Log Message:
moses-testing-service.pl - async cgi service portion:
        * Moved the POST request out of the foreach
          $queryID loop.
        * Added the name of the element "analysis_event"
          to $xpath.
        * Moved the sleep(20) out of the &_check_status
          sub. 
        * Added a diagnostic message for the die
          statement when we cant find our event id.
        * Moved some messages for "verbose" info in
          &_check_status, so the script always reports
          the job status whether a job has completed
          or not.
        * I also added $queryID to the verbose messaging
          so the script reports which job that status
          message corresponded to...
          
(thx to Pieter Neerincx for patience, code and suggestions)
moby-live/Perl/MOSES-MOBY/bin/scripts moses-testing-service.pl,1.13,1.14
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts/moses-testing-service.pl,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts/moses-testing-service.pl	2009/10/16 14:13:39	1.13
+++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts/moses-testing-service.pl	2009/10/16 17:43:09	1.14
@@ -130,9 +130,7 @@
 	  or die "$@\n";
 	eval "use MOBY::Async::WSRF; 1;"
 	  or die "$@\n";
-
 }
-
 use strict;
 
 sub _empty_input {
@@ -149,17 +147,22 @@
 sub _check_status {
 	my ( $status, $completed, $queryID, $opt_v ) = @_;
 	if ( $status->type == LSAE_PERCENT_PROGRESS_EVENT ) {
+		print "Current percentage for job $queryID: ", $status->percentage, "\n"
+		  if $opt_v;
 		if ( $status->percentage >= 100 ) {
 			$completed->{$queryID} = 1;
 		} elsif ( $status->percentage < 100 ) {
-			print "Current percentage: ", $status->percentage, "\n" if $opt_v;
-			print "\tmsg: ", ($status->message ? $status->message : "no message found ..."), "\n" if $opt_v;
-			sleep(20);
+			print "\tmsg: ",
+			  ( $status->message ? $status->message : "no message found ..." ), "\n"
+			  if $opt_v;
+
+			#sleep(20);
 		} else {
 			die "ERROR:  analysis event block not well formed.\n";
 		}
-
 	} elsif ( $status->type == LSAE_STATE_CHANGED_EVENT ) {
+		print "Current state for job $queryID: ", $status->new_state, "\n"
+		  if $opt_v;
 		if (    ( $status->new_state =~ m"completed"i )
 			 || ( $status->new_state =~ m"terminated_by_request"i )
 			 || ( $status->new_state =~ m"terminated_by_error"i ) )
@@ -168,36 +171,45 @@
 		} elsif (    ( $status->new_state =~ m"created"i )
 				  || ( $status->new_state =~ m"running"i ) )
 		{
-			print "Current State: ", $status->new_state, "\n" if $opt_v;
-			print "\tmsg: ", ($status->message ? $status->message : "no message found ..."), "\n" if $opt_v;
-			sleep(20);
+			print "\tmsg: ",
+			  ( $status->message ? $status->message : "no message found ..." ), "\n"
+			  if $opt_v;
+
+			#sleep(20);
 		} else {
 			die "ERROR:  analysis event block not well formed.\n";
 		}
-
 	} elsif ( $status->type == LSAE_STEP_PROGRESS_EVENT ) {
+		print "Steps completed for job $queryID: ", $status - > steps_completed, "\n"
+		  if $opt_v;
 		if ( $status->steps_completed >= $status->total_steps ) {
 			$completed->{$queryID} = 1;
 		} elsif ( $status->steps_completed < $status->total_steps ) {
-			print "Steps completed: ", $status->steps_completed, "\n" if $opt_v;
-			print "\tmsg: ", ($status->message ? $status->message : "no message found ..."), "\n" if $opt_v;
-			sleep(20);
+			print "\tmsg: ",
+			  ( $status->message ? $status->message : "no message found ..." ), "\n"
+			  if $opt_v;
+
+			#sleep(20);
 		} else {
 			die "ERROR:  analysis event block not well formed.\n";
 		}
-
 	} elsif ( $status->type == LSAE_TIME_PROGRESS_EVENT ) {
+		print "Time remaining for job $queryID: ", $status->remaining, "\n"
+		  if $opt_v;
 		if ( $status->remaining == 0 ) {
 			$completed->{$queryID} = 1;
 		} elsif ( $status->remaining > 0 ) {
-			print "Time remaining: ", $status->remaining, "\n" if $opt_v;
-			print "\tmsg: ", ($status->message ? $status->message : "no message found ..."), "\n" if $opt_v;
-			sleep(20);
+			print "\tmsg: ",
+			  ( $status->message ? $status->message : "no message found ..." ), "\n"
+			  if $opt_v;
+
+			#sleep(20);
 		} else {
 			die "ERROR:  analysis event block not well formed.\n";
 		}
 	} else {
-		warn "Whilst checking the status of our resource, we entered into a possible infinite loop ...\n";
+		warn
+"Whilst checking the status of our resource, we entered into a possible infinite loop ...\n";
 	}
 }
 
@@ -238,7 +250,6 @@
 			die $msg;
 		}
 	);
-
 	my $input = '';
 	if ( @ARGV > 0 ) {
 		my $data = shift;    # a file name
@@ -249,14 +260,11 @@
 	} else {
 		$input = _empty_input;
 	}
-
 	print $soap ->$service( SOAP::Data->type( 'string' => "$input" ) )->result;
-
 } elsif ($opt_c) {
 
 	# calling a real service, using cgi
-	my $ua = LWP::UserAgent->new;
-
+	my $ua    = LWP::UserAgent->new;
 	my $input = '';
 	if ( @ARGV > 0 ) {
 		my $data = shift;    # a file name
@@ -267,14 +275,11 @@
 	} else {
 		$input = _empty_input;
 	}
-
 	my $req = HTTP::Request->new( POST => $opt_c );
 	$req->content_type('application/x-www-form-urlencoded');
 	$req->content("data=$input");
 	print "\n" . $ua->request($req)->as_string . "\n";
-
 } elsif ($opt_C) {
-
 	my $input = '';
 	if ( @ARGV > 0 ) {
 		my $data = shift;    # a file name
@@ -289,7 +294,6 @@
 	# extract all of the query ids from $input
 	my @query_ids = _get_query_ids($input);
 	my %completed = ();
-
 	print "Sending the following data to $opt_C\n$input\n";
 
 	# post to the web service
@@ -304,7 +308,6 @@
 	# do we have an error?
 	die "Error calling service: " . $response->status_line
 	  if ( $response->code != 200 );
-
 	my $epr    = $response->header("moby-wsrf");
 	my $parser = XML::LibXML->new();
 	my $doc    = $parser->parse_string($epr);
@@ -327,261 +330,267 @@
 
 	# poll
 	while (1) {
+
+#
+# Poll the service for the status of all query IDs associated with this service invocation.
+#
+		$req = HTTP::Request->new( POST => $opt_C . "/status" );
+		$req->header( "moby-wsrf" => $header );
+		$req->content_type('application/x-www-form-urlencoded');
+		$req->content("data=$searchTerm");
+		$response = $ua->request($req);
+		my $xml    = $response->content();
+		my $parser = XML::LibXML->new();
+		my $doc    = $parser->parse_string($xml);
+
 		foreach my $queryID (@query_ids) {
 
 			# skip poll if current job completed
 			next if $completed{$queryID};
 
-			# poll the service for given query ID
-			$req = HTTP::Request->new( POST => $opt_C . "/status" );
-			$req->header( "moby-wsrf" => $header );
-			$req->content_type('application/x-www-form-urlencoded');
-			$req->content("data=$searchTerm");
-			$response = $ua->request($req);
-			my $xml    = $response->content();
-			my $parser = XML::LibXML->new();
-			my $doc    = $parser->parse_string($xml);
-			my $xpath = "//*[\@*='$queryID']";
-            my $xpc   = XML::LibXML::XPathContext->new();
-            my $nodes = $xpc->findnodes( $xpath, $doc->documentElement );
-            # should only be one ...
-            die unless $nodes->size() == 1;
-			my $status = LSAE::AnalysisEventBlock->new( $nodes->get_node(1)->toString() );
+			#
+			# Find status of this query ID.
+			#
+			#my $xpath = "//*[local-name() = 'analysis_event'][\@id='$queryID']";
+			#my $xpath = "//analysis_event[\@id='$queryID']";
+			$xpath = "//*[local-name() = 'analysis_event'][\@*='$queryId']";
+			my $xpc = XML::LibXML::XPathContext->new();
+			my $nodes = $xpc->findnodes( $xpath, $doc->documentElement );
+
+			# should only be one ...
+			die
+"Service returned unexpected/malformed resource property XML, which should contain service status info."
+			  unless $nodes->size() == 1;
+			my $status =
+			  LSAE::AnalysisEventBlock->new( $nodes->get_node(1)->toString() );
 			&_check_status( $status, \%completed, $queryID, $opt_v );
 		}
 		last if scalar keys(%completed) == $#query_ids + 1;
+		my $interval = 20;
+		print "Checking job state again in $interval seconds.\n\n" if $opt_v;
+		sleep($interval);
 	}
+	last if scalar keys(%completed) == $#query_ids + 1;
+}
 
-	# task is finished, obtain the result
-	$searchTerm = "";
-	$searchTerm .=
+# task is finished, obtain the result
+$searchTerm = "";
+$searchTerm .=
 "<wsrf-rp:GetMultipleResourceProperties xmlns:wsrf-rp='$WSRF::Constants::WSRP' xmlns:mobyws='$WSRF::Constants::MOBY'>";
-	foreach my $queryID (@query_ids) {
-		$searchTerm .=
-		    "<wsrf-rp:ResourceProperty>mobyws:result_" 
-		  . $queryID
-		  . "</wsrf-rp:ResourceProperty>";
-	}
-	$searchTerm .= "</wsrf-rp:GetMultipleResourceProperties>";
-
-	$header = _moby_wsrf_header( $opt_C, $ID );
-	$header =~ s/\n//gi;
-
-	$req = HTTP::Request->new( POST => $opt_C . "/results" );
-	$req->header( "moby-wsrf" => $header );
-	$req->content_type('application/x-www-form-urlencoded');
-	$req->content("data=$searchTerm");
-	$response = $ua->request($req);
-
-	# create nicely formatted XML
-	$parser = XML::LibXML->new();
-	$doc    = $parser->parse_string( $response->content );
-	print "\n" . $doc->toString(1);
-
-	# destroy the job
-	$searchTerm = '<Destroy xmlns="http://docs.oasis-open.org/wsrf/rl-2"/> ';
-	$req = HTTP::Request->new( POST => $opt_C . "/destroy" );
-	$req->header( "moby-wsrf" => $header );
-	$req->content_type('application/x-www-form-urlencoded');
-	$req->content("data=$searchTerm");
-	$response = $ua->request($req);
-	print "Destroying the resource returned:\n\t" . $response->content . "\n" if $opt_v;
-
-} elsif ($opt_a) {
-
-	# calling a real service, using async soap
-	# call using async mode for async service ... _submit
-	$service .= "_submit";
-
-	# set up the wsrf call
-	my $soap = WSRF::Lite->proxy($opt_a)->uri($WSRF::Constants::MOBY)->on_fault(
-		sub {
-			my $soap = shift;
-			my $res  = shift;
-			my $msg =
-			  ref $res
-			  ? "--- SOAP FAULT ---\n" . $res->faultcode . " " . $res->faultstring
-			  : "--- TRANSPORT ERROR ---\n" . $soap->transport->status . "\n$res\n";
-			die $msg;
-		}
-	);
-
-	# get the input
-	my $input = '';
-	if ( @ARGV > 0 ) {
-		my $data = shift;    # a file name
-		open INPUT, "<$data"
-		  or die "Cannot read '$data': $!\n";
-		while (<INPUT>) { $input .= $_; }
-		close INPUT;
-	} else {
-		$input = _empty_input;
-	}
-
-	# extract all of the query ids from $input
-	my @query_ids = _get_query_ids($input);
-	print "\nSending the following data to $service asynchronously:\n", $input, "\n"
-	  if $opt_v;
-
-	# submit the job
-	my $epr = ( $soap->$service( SOAP::Data->type( 'string' => "$input" ) )->result );
-
-	# Get address from the returned Endpoint Reference
-	my $address = $epr->{'EndpointReference'}->{Address};
-
-	# Get resource identifier from the returned Endpoint Reference
-	my $identifier =
-	  $epr->{'EndpointReference'}->{ReferenceParameters}->{ServiceInvocationId};
-
-	# Compose the Endpoint Reference
-	my $EPR = WSRF::WS_Address->new();
-	$EPR->Address($address);
-	$EPR->ReferenceParameters(   '<mobyws:ServiceInvocationId xmlns:mobyws="'
-							   . $WSRF::Constants::MOBY . '">'
-							   . $identifier
-							   . '</mobyws:ServiceInvocationId>' );
-	my %completed = ();
-	while (1) {
-		foreach my $queryID (@query_ids) {
-
-			# skip poll if current job completed
-			next if $completed{$queryID};
+foreach my $queryID (@query_ids) {
+	$searchTerm .=
+	    "<wsrf-rp:ResourceProperty>mobyws:result_" 
+	  . $queryID
+	  . "</wsrf-rp:ResourceProperty>";
+}
+$searchTerm .= "</wsrf-rp:GetMultipleResourceProperties>";
+$header = _moby_wsrf_header( $opt_C, $ID );
+$header =~ s/\n//gi;
+$req = HTTP::Request->new( POST => $opt_C . "/results" );
+$req->header( "moby-wsrf" => $header );
+$req->content_type('application/x-www-form-urlencoded');
+$req->content("data=$searchTerm");
+$response = $ua->request($req);
+
+# create nicely formatted XML
+$parser = XML::LibXML->new();
+$doc    = $parser->parse_string( $response->content );
+print "\n" . $doc->toString(1);
+
+# destroy the job
+$searchTerm = '<Destroy xmlns="http://docs.oasis-open.org/wsrf/rl-2"/> ';
+$req = HTTP::Request->new( POST => $opt_C . "/destroy" );
+$req->header( "moby-wsrf" => $header );
+$req->content_type('application/x-www-form-urlencoded');
+$req->content("data=$searchTerm");
+$response = $ua->request($req);
+print "Destroying the resource returned:\n\t" . $response->content . "\n" if $opt_v;
+}
+elsif ($opt_a) {
 
-			# poll the service for given query ID
-			my $searchTerm = "";
-			$searchTerm .=
+  # calling a real service, using async soap
+  # call using async mode for async service ... _submit
+  $service .= "_submit";
+
+  # set up the wsrf call
+  my $soap = WSRF::Lite->proxy($opt_a)->uri($WSRF::Constants::MOBY)->on_fault(
+	  sub {
+		  my $soap = shift;
+		  my $res  = shift;
+		  my $msg =
+			ref $res
+			? "--- SOAP FAULT ---\n" . $res->faultcode . " " . $res->faultstring
+			: "--- TRANSPORT ERROR ---\n" . $soap->transport->status . "\n$res\n";
+		  die $msg;
+	  }
+  );
+
+  # get the input
+  my $input = '';
+  if ( @ARGV > 0 ) {
+	  my $data = shift;    # a file name
+	  open INPUT, "<$data"
+		or die "Cannot read '$data': $!\n";
+	  while (<INPUT>) { $input .= $_; }
+	  close INPUT;
+  } else {
+	  $input = _empty_input;
+  }
+
+  # extract all of the query ids from $input
+  my @query_ids = _get_query_ids($input);
+  print "\nSending the following data to $service asynchronously:\n", $input, "\n"
+	if $opt_v;
+
+  # submit the job
+  my $epr = ( $soap->$service( SOAP::Data->type( 'string' => "$input" ) )->result );
+
+  # Get address from the returned Endpoint Reference
+  my $address = $epr->{'EndpointReference'}->{Address};
+
+  # Get resource identifier from the returned Endpoint Reference
+  my $identifier =
+	$epr->{'EndpointReference'}->{ReferenceParameters}->{ServiceInvocationId};
+
+  # Compose the Endpoint Reference
+  my $EPR = WSRF::WS_Address->new();
+  $EPR->Address($address);
+  $EPR->ReferenceParameters(   '<mobyws:ServiceInvocationId xmlns:mobyws="'
+							 . $WSRF::Constants::MOBY . '">'
+							 . $identifier
+							 . '</mobyws:ServiceInvocationId>' );
+  my %completed = ();
+  while (1) {
+	  foreach my $queryID (@query_ids) {
+
+		  # skip poll if current job completed
+		  next if $completed{$queryID};
+
+		  # poll the service for given query ID
+		  my $searchTerm = "";
+		  $searchTerm .=
 "<wsrp:ResourceProperty xmlns:wsrp='$WSRF::Constants::WSRP' xmlns:mobyws='$WSRF::Constants::MOBY'>";
-			$searchTerm .= "mobyws:status_" . $queryID;
-			$searchTerm .= "</wsrp:ResourceProperty>";
-
-			$soap = WSRF::Lite->uri($WSRF::Constants::WSRP)->on_action(
-				sub {
-					sprintf '%s/%s/%sRequest', $WSRF::Constants::WSRPW, $_[1], $_[1];
-				}
-			  )->wsaddress($EPR)
-			  ->GetMultipleResourceProperties(
+		  $searchTerm .= "mobyws:status_" . $queryID;
+		  $searchTerm .= "</wsrp:ResourceProperty>";
+		  $soap = WSRF::Lite->uri($WSRF::Constants::WSRP)->on_action(
+			  sub {
+				  sprintf '%s/%s/%sRequest', $WSRF::Constants::WSRPW, $_[1], $_[1];
+			  }
+			)->wsaddress($EPR)
+			->GetMultipleResourceProperties(
 										  SOAP::Data->value($searchTerm)->type('xml') );
+		  my $parser = XML::LibXML->new();
+		  my $xml    = $soap->raw_xml;
+		  my $doc    = $parser->parse_string($xml);
+		  $soap = $doc->getDocumentElement();
+		  my $prop_name = "status_" . $queryID;
+		  my ($prop) =
+			   $soap->getElementsByTagNameNS( $WSRF::Constants::MOBY, $prop_name )
+			|| $soap->getElementsByTagName($prop_name);
+		  my $event = $prop->getFirstChild->toString
+			unless ref $prop eq "XML::LibXML::NodeList";
+		  $event = $prop->pop()->getFirstChild->toString
+			if ref $prop eq "XML::LibXML::NodeList";
+		  my $status = LSAE::AnalysisEventBlock->new($event);
+
+		  if ( $status->type == LSAE_PERCENT_PROGRESS_EVENT ) {
+			  if ( $status->percentage >= 100 ) {
+				  $completed{$queryID} = 1;
+			  } elsif ( $status->percentage < 100 ) {
+				  print "Current percentage: ", $status->percentage, "\n" if $opt_v;
+				  sleep(20);
+			  } else {
+				  die "ERROR:  analysis event block not well formed.\n";
+			  }
+		  } elsif ( $status->type == LSAE_STATE_CHANGED_EVENT ) {
+			  if (    ( $status->new_state =~ m"completed"i )
+				   || ( $status->new_state =~ m"terminated_by_request"i )
+				   || ( $status->new_state =~ m"terminated_by_error"i ) )
+			  {
+				  $completed{$queryID} = 1;
+			  } elsif (    ( $status->new_state =~ m"created"i )
+						|| ( $status->new_state =~ m"running"i ) )
+			  {
+				  print "Current State: ", $status->new_state, "\n" if $opt_v;
+				  sleep(20);
+			  } else {
+				  die "ERROR:  analysis event block not well formed.\n";
+			  }
+		  } elsif ( $status->type == LSAE_STEP_PROGRESS_EVENT ) {
+			  if ( $status->steps_completed >= $status->total_steps ) {
+				  $completed{$queryID} = 1;
+			  } elsif ( $status->steps_completed < $status->total_steps ) {
+				  print "Steps completed: ", $status->steps_completed, "\n" if $opt_v;
+				  sleep(20);
+			  } else {
+				  die "ERROR:  analysis event block not well formed.\n";
+			  }
+		  } elsif ( $status->type == LSAE_TIME_PROGRESS_EVENT ) {
+			  if ( $status->remaining == 0 ) {
+				  $completed{$queryID} = 1;
+			  } elsif ( $status->remaining > 0 ) {
+				  print "Time remaining: ", $status->remaining, "\n" if $opt_v;
+				  sleep(20);
+			  } else {
+				  die "ERROR:  analysis event block not well formed.\n";
+			  }
+		  }
+	  }
+	  last if scalar keys(%completed) == $#query_ids + 1;
+  }
+  foreach my $queryID (@query_ids) {
 
-			my $parser = XML::LibXML->new();
-			my $xml    = $soap->raw_xml;
-			my $doc    = $parser->parse_string($xml);
-			$soap = $doc->getDocumentElement();
-			my $prop_name = "status_" . $queryID;
-
-			my ($prop) =
-			     $soap->getElementsByTagNameNS( $WSRF::Constants::MOBY, $prop_name )
-			  || $soap->getElementsByTagName($prop_name);
-			my $event = $prop->getFirstChild->toString
-			  unless ref $prop eq "XML::LibXML::NodeList";
-			$event = $prop->pop()->getFirstChild->toString
-			  if ref $prop eq "XML::LibXML::NodeList";
-
-			my $status = LSAE::AnalysisEventBlock->new($event);
-			if ( $status->type == LSAE_PERCENT_PROGRESS_EVENT ) {
-				if ( $status->percentage >= 100 ) {
-					$completed{$queryID} = 1;
-				} elsif ( $status->percentage < 100 ) {
-					print "Current percentage: ", $status->percentage, "\n" if $opt_v;
-					sleep(20);
-				} else {
-					die "ERROR:  analysis event block not well formed.\n";
-				}
-
-			} elsif ( $status->type == LSAE_STATE_CHANGED_EVENT ) {
-				if (    ( $status->new_state =~ m"completed"i )
-					 || ( $status->new_state =~ m"terminated_by_request"i )
-					 || ( $status->new_state =~ m"terminated_by_error"i ) )
-				{
-					$completed{$queryID} = 1;
-				} elsif (    ( $status->new_state =~ m"created"i )
-						  || ( $status->new_state =~ m"running"i ) )
-				{
-					print "Current State: ", $status->new_state, "\n" if $opt_v;
-					sleep(20);
-				} else {
-					die "ERROR:  analysis event block not well formed.\n";
-				}
-
-			} elsif ( $status->type == LSAE_STEP_PROGRESS_EVENT ) {
-				if ( $status->steps_completed >= $status->total_steps ) {
-					$completed{$queryID} = 1;
-				} elsif ( $status->steps_completed < $status->total_steps ) {
-					print "Steps completed: ", $status->steps_completed, "\n" if $opt_v;
-					sleep(20);
-				} else {
-					die "ERROR:  analysis event block not well formed.\n";
-				}
-
-			} elsif ( $status->type == LSAE_TIME_PROGRESS_EVENT ) {
-				if ( $status->remaining == 0 ) {
-					$completed{$queryID} = 1;
-				} elsif ( $status->remaining > 0 ) {
-					print "Time remaining: ", $status->remaining, "\n" if $opt_v;
-					sleep(20);
-				} else {
-					die "ERROR:  analysis event block not well formed.\n";
-				}
-			}
-		}
-		last if scalar keys(%completed) == $#query_ids + 1;
-	}
-
-	foreach my $queryID (@query_ids) {
-
-		# get the result
-		my $searchTerm .=
+	  # get the result
+	  my $searchTerm .=
 "<wsrp:ResourceProperty xmlns:wsrp='$WSRF::Constants::WSRP' xmlns:mobyws='$WSRF::Constants::MOBY'>";
-		$searchTerm .= "mobyws:result_" . $queryID;
-		$searchTerm .= "</wsrp:ResourceProperty>";
-		my $ans = WSRF::Lite->uri($WSRF::Constants::WSRP)->on_action(
-			sub {
-				sprintf '%s/%s/%sRequest', $WSRF::Constants::WSRPW, $_[1], $_[1];
-			}
-		  )->wsaddress($EPR)
-		  ->GetMultipleResourceProperties(
-										  SOAP::Data->value($searchTerm)->type('xml') );
-		die "ERROR:  " . $ans->faultstring if ( $ans->fault );
-
-		my $parser = XML::LibXML->new();
-		my $xml    = $ans->raw_xml;
-		my $doc    = $parser->parse_string($xml);
-		$soap = $doc->getDocumentElement();
-		my $prop_name = "result_" . $queryID;
-		my ($prop) = $soap->getElementsByTagNameNS( $WSRF::Constants::MOBY, $prop_name )
-		  || $soap->getElementsByTagName($prop_name);
-		my $result = $prop->getFirstChild->toString
-		  unless ref $prop eq "XML::LibXML::NodeList";
-		$result = $prop->pop()->getFirstChild->toString
-		  if ref $prop eq "XML::LibXML::NodeList";
-		print $result;
-	}
-
-	# destroy the result
-	my $ans = WSRF::Lite->uri($WSRF::Constants::WSRL)->on_action(
-		sub {
-			sprintf '%s/ImmediateResourceTermination/%sRequest',
-			  $WSRF::Constants::WSRLW, $_[1];
-		}
-	)->wsaddress($EPR)->Destroy();
-
+	  $searchTerm .= "mobyws:result_" . $queryID;
+	  $searchTerm .= "</wsrp:ResourceProperty>";
+	  my $ans = WSRF::Lite->uri($WSRF::Constants::WSRP)->on_action(
+		  sub {
+			  sprintf '%s/%s/%sRequest', $WSRF::Constants::WSRPW, $_[1], $_[1];
+		  }
+		)->wsaddress($EPR)
+		->GetMultipleResourceProperties( SOAP::Data->value($searchTerm)->type('xml') );
+	  die "ERROR:  " . $ans->faultstring if ( $ans->fault );
+	  my $parser = XML::LibXML->new();
+	  my $xml    = $ans->raw_xml;
+	  my $doc    = $parser->parse_string($xml);
+	  $soap = $doc->getDocumentElement();
+	  my $prop_name = "result_" . $queryID;
+	  my ($prop) = $soap->getElementsByTagNameNS( $WSRF::Constants::MOBY, $prop_name )
+		|| $soap->getElementsByTagName($prop_name);
+	  my $result = $prop->getFirstChild->toString
+		unless ref $prop eq "XML::LibXML::NodeList";
+	  $result = $prop->pop()->getFirstChild->toString
+		if ref $prop eq "XML::LibXML::NodeList";
+	  print $result;
+  }
+
+  # destroy the result
+  my $ans = WSRF::Lite->uri($WSRF::Constants::WSRL)->on_action(
+	  sub {
+		  sprintf '%s/ImmediateResourceTermination/%sRequest',
+			$WSRF::Constants::WSRLW, $_[1];
+	  }
+  )->wsaddress($EPR)->Destroy();
 } else {
 
-	# calling a local service module, without SOAP
-	my $data;
-	if ( @ARGV > 0 ) {
-		$data = shift;    # a file name
-	} else {
-		use File::Temp qw( tempfile );
-		my $fh;
-		( $fh, $data ) = tempfile( UNLINK => 1 );
-		print $fh _empty_input();
-		close $fh;
-	}
-	eval "require $module" or croak $@;
-	eval {
-		my $target = new $module;
-		print $target->$service($data), "\n";
-	} or croak $@;
+  # calling a local service module, without SOAP
+  my $data;
+  if ( @ARGV > 0 ) {
+	  $data = shift;    # a file name
+  } else {
+	  use File::Temp qw( tempfile );
+	  my $fh;
+	  ( $fh, $data ) = tempfile( UNLINK => 1 );
+	  print $fh _empty_input();
+	  close $fh;
+  }
+  eval "require $module" or croak $@;
+  eval {
+	  my $target = new $module;
+	  print $target->$service($data), "\n";
+  } or croak $@;
 }
 
 sub _moby_wsrf_header {




More information about the MOBY-guts mailing list