[Xml-compile] XML::Compile::WSDL11 troubles with MediaMind API

Mark Overmeer mark at overmeer.net
Thu Sep 10 12:17:38 GMT 2015


* Matthew Horsfall (alh) (wolfsage at gmail.com) [150910 11:45]:
> On Wed, Sep 9, 2015 at 4:14 PM, Mark Overmeer <mark at overmeer.net> wrote:
> > If they had used that, as they intended to when I see the detail of the
> > rest of the spec, then your life would be very easy.  However, according
> > to the current wsdl you can only use AdvertiserServerFilter elements at
> > that spot...  not what you wish for.
> 
> Ugh, wonderful.

Too late last night, I thought that there is an other option: your
schema may use the awful xsi:type.  Is that the case?  Do you have
an example message somewhere?

>   my @filters = $advertiser_wsdl->writer('tns:AdvertiserNameFilter')->(
>     $doc, { AdvertiserName => 'what' }
>   );
> 
>   error: cannot find element or attribute
> `{http://api.eyeblaster.com/}AdvertiserNameFilter' at
> tns:AdvertiserNameFilter

Well, there is no element in the WSDL with that name, only a type.  So,
the complaint is correct.

If your messages use xsi:type, then read section "Handling xsi:type"
in XML::Compile::Schema.  Probably you then need
   $wsdl->addXsiType('data:AdvertiserServiceFilter' => 'AUTO');

> Also, is the error I was getting in my first email when using
> ->explain() a bug in XML::Compile or something wrong with the WSDL?
> 
>  (error: no prefix known for namespace
> `http://api.eyeblaster.com/message', use addPrefixes())

The schema included in the WSDL defines elements and types in the
targetNamespace http://api.eyeblaster.com/message  However, these
elements apparently never refer to other elements in the namespace:
there is no xmlns which assigns a prefix to that URI.  The example
generator explain() really likes to show prefixes.

The best way to start a project, is to add this to your script
  my $wsdl = XML::Compile::WSDL11->new($wsdl, prefixes => \%prefixes);
where you manually assign your own prefixes to the namespaces used.
If you don't, the prefix names used in the schema are used... which
may change over generations of the schema (they are often generated)

  my %prefixes =
    ( msg  => 'http://api.eyeblaster.com/message'
    , data => 'http://api.eyeblaster.com/V1/DataContracts'
    , ...more?...
    );

-- 
I hope this helps,

               MarkOv

------------------------------------------------------------------------
       Mark Overmeer MSc                                MARKOV Solutions
       Mark at Overmeer.net                          solutions at overmeer.net
http://Mark.Overmeer.net                   http://solutions.overmeer.net




More information about the Xml-compile mailing list