[Xml-compile] XML::Compile::WSDL11 troubles with MediaMind API
Matthew Horsfall (alh)
wolfsage at gmail.com
Wed Sep 9 16:39:18 GMT 2015
Hello,
I'm trying to use XML::Compile with
http://platform.mediamind.com/Eyeblaster.MediaMind.API.Doc/, and for
most things it's working wonderfully.
However, there's on piece of the API that I'm not able to get to work
and I can't figure out why. (I apologize for the long email...)
In the Advertisers service
(https://platform.mediamind.com/Eyeblaster.MediaMind.API/AdvertiserService.svc?wsdl),
there is a GetAdvertisers call
(http://platform.mediamind.com/Eyeblaster.MediaMind.API.Doc/Default.aspx?page=Operation.aspx%3Fv%3D1%26OperationID%3D-1964927588).
This call takes an AdvertisersFilter argument which is an array of
AdvertiserServiceFilter. AdvertiserServiceFilter can be made up of a
bunch of different derived types - AdvertiserHasConversionsFilter,
AdvertiserIDFilter, AdvertiserNameFilter, etc...
No matter how I try though, I can't seem to pass these down. I
discovered the explain() call, which helped a little, but that call
doesn't seem to be aware of the derived types. I also couldn't get
explain() to work without some messing around.
For example:
#!/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, compile it
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;
my $wsdl = XML::Compile::WSDL11->new($file);
$wsdl->compileCalls;
print $wsdl->explain('GetAdvertisers', PERL => 'INPUT', recurse => 1);
If I run that, I get:
$ perl exp.pl
error: no prefix known for namespace
`http://api.eyeblaster.com/message', use addPrefixes()
If I add a bogus prefix, it seems to work.
($wsdl->addNicePrefix('bah', 'http://api.eyeblaster.com/message');)
$ perl exp.pl
[...]
# Describing complex bah:GetAdvertisersRequest
# {http://api.eyeblaster.com/message}GetAdvertisersRequest
# xmlns:bah http://api.eyeblaster.com/message
# xmlns:q5 http://api.eyeblaster.com/V1/DataContracts
# xmlns:xs http://www.w3.org/2001/XMLSchema
# is an unnamed complex
{ # sequence of AdvertisersFilter, Paging, ShowAdvertiserExtendedInfo
# is a q5:ArrayOfAdvertiserServiceFilter
# is nillable, as: AdvertisersFilter => NIL
# is optional
AdvertisersFilter =>
{ # sequence of AdvertiserServiceFilter
# is a q5:AdvertiserServiceFilter
# is nillable, as: AdvertiserServiceFilter => NIL
# occurs any number of times
AdvertiserServiceFilter => [{},], },
# is a bah:ListPaging
# is nillable, as: Paging => NIL
# is optional
Paging =>
{ # sequence of PageIndex, PageSize
# is a xs:int
PageIndex => 42,
# is a xs:int
PageSize => 42, },
# is a xs:boolean
# is optional
ShowAdvertiserExtendedInfo => "true", }
;
So that helped a little. I can see that I need:
AdvertisersFilter => {
AdvertiserServiceFilter => [ {
} ],
},
However, I don't know what to put in AdvertiserServiceFilter. This
*should* be any one of AdvertiserHasConversionsFilter,
AdvertiserIDFilter, AdvertiserNameFilter I would think, but the
explain output seems to stop at AdvertiserServiceFilter => [{},] as if
it doesn't know what an AdvertiserServiceFilter is.
I've tried:
AdvertisersFilter => { AdvertiserServiceFilter => [ {
AdvertiserNameFilter => { AdvertiserName => "..." } } ] }
And
AdvertisersFilter => { AdvertiserServiceFilter => [ { AdvertiserName
=> "..." } ] }
But I always get back an error like:
"mistake: tag `AdvertiserNameFilter' not used at
{http://api.eyeblaster.com/message}GetAdvertisersRequest/AdvertisersFilter/AdvertiserServiceFilter"
Any help would be appreciated.
Sadly, this API needs login credentials that I don't think I can
provide for testing.
-- Matthew Horsfall (alh)
More information about the Xml-compile
mailing list