#!/usr/bin/env perl

use strict;
use warnings;

use LWP::UserAgent;

use XML::Compile::WSDL11;
use XML::Compile::SOAP11;
use XML::Compile::Transport::SOAPHTTP;

use File::Temp qw(tempfile);

my $wsdl_url = 'https://platform.mediamind.com/Eyeblaster.MediaMind.API/AdvertiserService.svc?wsdl';

# Grab wsdl
my (undef, $file) = tempfile();
$file .= ".wsdl1";

my $lwp = LWP::UserAgent->new;
my $res = $lwp->mirror($wsdl_url, $file);
die "Mirroring failed: " . $res->status_line unless $res->is_success;

# This continually grabs more and more memory. The compileCalls()
# seems to be the culprit. I would expect this to not continue to
# grow endlessly 
while (1) {
  my $wsdl = XML::Compile::WSDL11->new($file);

  print "Compiling calls...\n";
  $wsdl->compileCalls;
}
