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

Matthew Horsfall (alh) wolfsage at gmail.com
Thu Sep 10 12:27:22 GMT 2015


On Thu, Sep 10, 2015 at 8:17 AM, Mark Overmeer <mark at overmeer.net> wrote:
> * 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?

A sample request message? No, only what XML::Compile is generating for me.

Here's a sample response:

  <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
      <GetAdvertisersResponse xmlns="http://api.eyeblaster.com/message">
        <Advertisers
xmlns:a="http://api.eyeblaster.com/V1/DataContracts"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
          <a:AdvertiserInfo>
            <a:ID>134418</a:ID>
            <a:AdvertiserExtendedInfo i:nil="true"/>
            <a:AdvertiserName>test $$</a:AdvertiserName>
            <a:IsGlobalAdvertiser>false</a:IsGlobalAdvertiser>
            <a:Vertical>Other</a:Vertical>
          </a:AdvertiserInfo>
          <a:AdvertiserInfo>
            <a:ID>134420</a:ID>
            <a:AdvertiserExtendedInfo i:nil="true"/>
            <a:AdvertiserName>test 32638</a:AdvertiserName>
            <a:IsGlobalAdvertiser>false</a:IsGlobalAdvertiser>
            <a:Vertical>Other</a:Vertical>
          </a:AdvertiserInfo>
          <a:AdvertiserInfo>
            <a:ID>134426</a:ID>
            <a:AdvertiserExtendedInfo i:nil="true"/>
            <a:AdvertiserName>The test advertiser 20429</a:AdvertiserName>
            <a:IsGlobalAdvertiser>false</a:IsGlobalAdvertiser>
            <a:Vertical>Other</a:Vertical>
          </a:AdvertiserInfo>
          <a:AdvertiserInfo>
            <a:ID>134427</a:ID>
            <a:AdvertiserExtendedInfo i:nil="true"/>
            <a:AdvertiserName>The test advertiser 20520</a:AdvertiserName>
            <a:IsGlobalAdvertiser>false</a:IsGlobalAdvertiser>
            <a:Vertical>Other</a:Vertical>
          </a:AdvertiserInfo>
          <a:AdvertiserInfo>
            <a:ID>134428</a:ID>
            <a:AdvertiserExtendedInfo i:nil="true"/>
            <a:AdvertiserName>The test advertiser 20586</a:AdvertiserName>
            <a:IsGlobalAdvertiser>false</a:IsGlobalAdvertiser>
            <a:Vertical>Other</a:Vertical>
          </a:AdvertiserInfo>
        </Advertisers>
        <TotalCount>5</TotalCount>
      </GetAdvertisersResponse>
    </s:Body>
  </s:Envelope>

>>   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,

It does.

It looks like modifying the WSDL before loading to add the
substituionGroups is the way to go, as horrible as that feels.

I'll see if I can get the vendor to update their WSDLs...

Thanks so much!

-- Matthew Horsfall (alh)



More information about the Xml-compile mailing list