Response headers behaving better
authorChris Cormack <chrisc@catalyst.net.nz>
Tue, 4 Mar 2014 02:45:00 +0000 (15:45 +1300)
committerChris Cormack <chrisc@catalyst.net.nz>
Tue, 4 Mar 2014 02:45:00 +0000 (15:45 +1300)
lib/NCIP/Handler.pm
templates/response.tt

index 2618e79..df25530 100644 (file)
@@ -104,11 +104,11 @@ sub get_agencies {
 
     my $root = $xmldoc->documentElement();
 
-    my @from =
-      $xpc->findnodes( '//ns:InitiationHeader/FromAgencyId/AgencyId', $root );
-    my @to =
-      $xpc->findnodes( '//ns:InitiationHeader/ToAgencyId/AgencyId', $root );
-    return ( $from[0]->textContent, $to[0]->textContent );
+    my $from =
+      $xpc->find( '//ns:FromAgencyId', $root );
+    my $to =
+      $xpc->find( '//ns:ToAgencyId', $root );
+    return ( $from, $to );
 }
 
 sub render_output {
index 167ce2e..68519ae 100644 (file)
@@ -1,13 +1,13 @@
-[% INCLUDE 'includes/header.inc' %]
+[%# INCLUDE 'includes/header.inc' %]
 
 <NCIPMessage>
     <[% messagetype %]>
        <ResponseHeader>
             <FromAgencyId>
-              <AgencyId>[% fromagency %]</AgencyId>
+              <AgencyId>[% fromagency | trim%]</AgencyId>
             </FromAgencyId>
             <ToAgencyId>
-               <AgencyId>[% toagency %]</AgencyId>
+               <AgencyId>[% toagency | trim %]</AgencyId>
             </ToAgencyId>
         </ResponseHeader>
     [% myfile = "includes/$messagetype" _ ".inc" %]