Axis doesn't generate TargetingIdea class from WSDL

216 views
Skip to first unread message

Maxim

unread,
Dec 22, 2011, 4:13:59 PM12/22/11
to adwor...@googlegroups.com

Hello.

I’ve been working with google api for 6-7 years now, but this is rather unusual.

In V201109, when generating soap client for TargetingIdeaService, Axis would not generate a class for TargetingIdea. What’s so special about the definition of TargetingIdea?

<complexType name="TargetingIdea"><annotation><documentation>
           
Represents a {@link TargetingIdea} returned by search criteria specified in
           
the {@link TargetingIdeaSelector}. Targeting ideas are keywords or placements
           
that are similar to those the user inputs.
         
</documentation></annotation><sequence><element maxOccurs="unbounded" minOccurs="0" name="data" type="tns:Type_AttributeMapEntry"><annotation><documentation>
               
Map of
               
{@link com.google.ads.api.services.targetingideas.external.AttributeType}
               
to {@link Attribute}. Stores all data retrieved for each key {@code
               
AttributeType}.
               
<span class="constraint Required">This field is required and should not be {@code null}.</span>
             
</documentation></annotation></element></sequence></complexType>

The generated code for TargetingIdeaPage
<complexType name="TargetingIdeaPage"><annotation><documentation>
           
Contains a subset of {@link TargetingIdea}s from the search criteria
           
specified by a {@link TargetingIdeaSelector}.
         
</documentation></annotation><sequence><element maxOccurs="1" minOccurs="0" name="totalNumEntries" type="xsd:int"><annotation><documentation>
               
Total number of entries that can be retrieved using the get method.
             
</documentation></annotation></element><element maxOccurs="unbounded" minOccurs="0" name="entries" type="tns:TargetingIdea"><annotation><documentation>
               
The result entries in this page, as list of {@link TargetingIdea}s.
             
</documentation></annotation></element></sequence></complexType>

 looks like this:

    /**
     * Gets the entries value for this TargetingIdeaPage.
     *
     * @return entries   * The result entries in this page, as list of {@link TargetingIdea}s.
     */
   
public com.google.adwords.api.Type_AttributeMapEntry[][] getEntries() {
       
return entries;
   }

So it looks like the WSDL2Java totally skipped the definition of TargetingIdea.
In the examples in the API docs the code and import statements definitely refer to TargetingIdea class.

Any ideas? (‘scuse the pun)

Thanks,
Maxim

Kevin Winter

unread,
Dec 27, 2011, 8:46:20 AM12/27/11
to adwor...@googlegroups.com
Hi Maxim,
  What version of axis are you using?  I believe we're using axis 1.4 for the existing Java library and did not run into this issue.  We're trying to add support for axis 2 in the rewrite of the java library, but have run into some fun issues getting the classes generated (current solution involves hacking some XSLT to get it somewhat right - still very much a work in progress).

- Kevin Winter
AdWords API Team

Maxim

unread,
Dec 27, 2011, 11:04:38 AM12/27/11
to AdWords API Forum
Kevin, I'm using axis 1.4 as well, which is why I was surprised.
I already coded for using the Type_AttributeMapEntry[][] so it's not a
big deal. If I'm the only one who has this problem then don't worry
about it. Most people are probably using your client libs where
everything is already generated.

Kevin Winter

unread,
Dec 27, 2011, 12:23:53 PM12/27/11
to adwor...@googlegroups.com
Hi Maxim,
  I can confirm that our TargetingIdeaPage does have a getEntries value of TargetingIdea: http://code.google.com/p/google-api-adwords-java/source/browse/trunk/src/com/google/api/adwords/v201109/o/TargetingIdeaPage.java#61

I've seen similar issues where an object with a single inner field can be "unwrapped" in this fashion (notable in python which uses hashes), but never for classes.  Perhaps there's an option controlling this feature that is different between our two usages of axis 1.4.  What about v201101?  If you generate the classes against v201101 do you see the same behavior?  I don't see any changes between v201101 and v201109 for these objects, so I'm surprised this only appeared in v201109.

Maxim

unread,
Dec 27, 2011, 1:22:22 PM12/27/11
to AdWords API Forum
We are still on v201008 and I'm building v201109 client.
Sounds like an axis config problem. I'm on a skiing trip at the
moment, but I'll try different settings. Thanks for your help.

On Dec 27, 9:23 am, Kevin Winter <Kevin.Win...@google.com> wrote:
> Hi Maxim,
>   I can confirm that our TargetingIdeaPage does have a getEntries value of
> TargetingIdea:http://code.google.com/p/google-api-adwords-java/source/browse/trunk/...

Kevin Winter

unread,
Dec 27, 2011, 5:14:08 PM12/27/11
to adwor...@googlegroups.com
Hi Maxim,
  One of the previous maintainers of the current java library mentioned that there's a flag for WSDL2JAVA and you need to tell it to generate "all", all="true" for the ant task, --all for command line.

- Kevin Winter

Maxim

unread,
Dec 27, 2011, 5:50:16 PM12/27/11
to AdWords API Forum
Yes, I always use "all", but in this case axis decided to unwrap the
type.
Oh well...

okieb...@gmail.com

unread,
Mar 7, 2012, 3:36:58 PM3/7/12
to adwor...@googlegroups.com
Kevin,
Sorry to hijack this thread, but the same problem exists with both wsdl.exe and svcutil.exe for this class generation from the provided wsdl. TargetingService class is not generated and the TargetingIdeaPage references unwrapped definition.  
As pointed out the TargetingIdeaPage generates:

<System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "3.0.4506.648"),  _
     System.SerializableAttribute(),  _
     System.Diagnostics.DebuggerStepThroughAttribute(),  _
     System.ComponentModel.DesignerCategoryAttribute("code"),  _
     System.Xml.Serialization.XmlTypeAttribute([Namespace]:="https://adwords.google.com/api/adwords/o/v201109")>  _
    Partial Public Class TargetingIdeaPage
        
        Private totalNumEntriesField As Integer
        
        Private totalNumEntriesFieldSpecified As Boolean
        
        Private entriesField()() As Type_AttributeMapEntry
        
        '''<remarks/>
        <System.Xml.Serialization.XmlElementAttribute(Order:=0)>  _
        Public Property totalNumEntries() As Integer
            Get
                Return Me.totalNumEntriesField
            End Get
            Set
                Me.totalNumEntriesField = value
            End Set
        End Property
        
        '''<remarks/>
        <System.Xml.Serialization.XmlIgnoreAttribute()>  _
        Public Property totalNumEntriesSpecified() As Boolean
            Get
                Return Me.totalNumEntriesFieldSpecified
            End Get
            Set
                Me.totalNumEntriesFieldSpecified = value
            End Set
        End Property
        
        '''<remarks/>
        <System.Xml.Serialization.XmlArrayAttribute(Order:=1),  _
         System.Xml.Serialization.XmlArrayItemAttribute("data", GetType(Type_AttributeMapEntry), IsNullable:=false)>  _
        Public Property entries() As Type_AttributeMapEntry()()
            Get
                Return Me.entriesField
            End Get
            Set
                Me.entriesField = value
            End Set
        End Property
    End Class
    

Rather than:

    <System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")> _
    <System.SerializableAttribute()> _
    <System.Diagnostics.DebuggerStepThroughAttribute()> _
    <System.ComponentModel.DesignerCategoryAttribute("code")> _
    <System.Xml.Serialization.XmlTypeAttribute([Namespace]:="https://adwords.google.com/api/adwords/o/v201109")> _
    Partial Public Class TargetingIdeaPage
        Private totalNumEntriesField As Integer

        Private totalNumEntriesFieldSpecified As Boolean

        Private entriesField As TargetingIdea()

        Public Property totalNumEntries() As Integer
            Get
                Return Me.totalNumEntriesField
            End Get
            Set(ByVal value As Integer)
                Me.totalNumEntriesField = value
                Me.totalNumEntriesSpecified = True
            End Set
        End Property

        <System.Xml.Serialization.XmlIgnoreAttribute()> _
        <EditorBrowsable(EditorBrowsableState.Never)> _
        Public Property totalNumEntriesSpecified() As Boolean
            Get
                Return Me.totalNumEntriesFieldSpecified
            End Get
            Set(ByVal value As Boolean)
                Me.totalNumEntriesFieldSpecified = value
            End Set
        End Property

        <System.Xml.Serialization.XmlElementAttribute("entries")> _
        Public Property entries() As TargetingIdea()
            Get
                Return Me.entriesField
            End Get
            Set(ByVal value As TargetingIdea())
                Me.entriesField = value
            End Set
        End Property
    End Class

I manually edit my class output to correct this, but it can be a tough one to debug for the newbies.  Can you pass along to the web services team to see if there is a solution for upcoming releases?

David  

Kevin Winter

unread,
Mar 7, 2012, 4:51:13 PM3/7/12
to adwor...@googlegroups.com
Hi David,
  Unfortunately, I've never worked with generated classes in DotNet.  It looks like the NoClientLibrary wiki page for the DotNet library mentions this is a known issue: http://code.google.com/p/google-api-adwords-dotnet/wiki/NoClientLibrary#b._wsdl.exe_doesn't_generate_some_types_properly.

- Kevin Winter
AdWords API Team

okieb...@gmail.com

unread,
Mar 9, 2012, 10:46:01 AM3/9/12
to adwor...@googlegroups.com
I appreciate your time and of course the link!  Another step for me to add to my documentation for generating classes from the published wsdl. Perhaps you can have all the affected WSDL's modified upon your next release, to add the 
  <element maxOccurs="1" minOccurs="1" name="dummy" type="xsd:string"  xmlns="http://www.w3.org/2001/XMLSchema"/>
So AdWords API developers' have one less source of hair loss.
David

Ari

unread,
Jan 2, 2015, 2:44:14 PM1/2/15
to adwor...@googlegroups.com
I'm having this same issue in C#. However changing the entriesField to a one dimensional array causes "Unexpected Internal API errors with Google.

I'm curious to how you changed the entriesField attribute to a "TargetingIdea" from "Type_AttributeMapEntry"

Where did that come from? Did you define it?

Josh Radcliff (AdWords API Team)

unread,
Jan 2, 2015, 4:49:23 PM1/2/15
to adwor...@googlegroups.com
Hi,

Is there some reason why you aren't using the .NET client library? It takes care of generating classes from WSDLs for you, and will save you from the headache of working with wsdl.exe.

Thanks,
Josh, AdWords API Team
Reply all
Reply to author
Forward
0 new messages