slightly more testing/debugging. basically working
[Net-GlobalPOPs-MediaServicesAPI.git] / lib / Net / GlobalPOPs / MediaServicesAPI.pm
index 0f0a940..6b671fd 100644 (file)
@@ -109,7 +109,7 @@ sub AUTOLOAD {
   $w->xmlDecl('ISO-8859-1');
   $w->doctype('request', undef, $URL);
 
-  $w->startTag('request', 'id' => '1');  #XXX request ID???
+  $w->startTag('request', 'id' => '');  #XXX request ID???
     $w->startTag('header');
       $w->startTag('sender');
 
@@ -144,7 +144,7 @@ sub AUTOLOAD {
 
   $w->endTag('request');
 
-  $output =~ s/\n\n/\n/g;
+  #$output =~ s/\n+/\n/g;
 
   warn "XML Request for $function function:\n$output"
     if $self->{'debug'};
@@ -152,9 +152,12 @@ sub AUTOLOAD {
   my( $page, $response, %reply_headers ) = https_post(
     'host'         => $HOST,
     'path'         => $PATH,
-    'content'      => $output,
-    'Content-Type' => 'text/plain',
-    'headers' => {},
+    'args'         => { 'apidata' => $output, },
+    #'content'      => $output,
+    #'Content-Type' => 'text/plain',
+    #'Content-Type' => 'text/xml',
+    #'Content-Type' => 'application/xml',
+    #'headers' => {},
     'debug'        => $self->{'debug'},
   );
 
@@ -166,12 +169,17 @@ sub AUTOLOAD {
   warn "XML Response for $function function:\n: $page"
     if $self->{'debug'};
 
-  my $hashref = XMLin $page;
+  my $hashref = XMLin( $page );
 
-  warn "Parsed response for $function funtion:\n: ". Dumper($hashref)
-    if $self->{'debug'}
+  warn "Parsed response for $function funtion:\n". Dumper($hashref)
+    if $self->{'debug'};
+
+  my $return = $hashref->{'body'};
+
+  warn "Returning data:\n". Dumper($return)
+    if $self->{'debug'};
 
-  %$hashref;
+  $return;
 
 }