Reuse uploaded image from MediaService when creating TemplateAd (templateId=432)

2014-06-10 Thread Chingiz Aitkul
Hi there, I was able to create an Image TemplateAd (templateId=432) by 
directly creating a new Image via 
com.google.api.ads.common.lib.utils.Media.getMediaDataFromFile.

What I want to do now, is to reuse an Image I have previously uploaded via 
MediaService by its mediaId.

When I do this:

*TemplateAd templateAd = new TemplateAd();*
*templateAd.setTemplateId(432L);*
*...*


*Image image = new 
Image();image.setMediaId(image.getMediaId());templateAd.setAdAsImage(newImage);*

I get following request and error response. Could you please tell me why I 
get the error NullError.NULL_CONTENT? What am I doing wrong here?

*Request:*
















































*http://schemas.xmlsoap.org/soap/envelope/ 
" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema 
" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance 
">https://adwords.google.com/api/adwords/cm/v201402 
" 
soapenv:mustUnderstand="0">5329326840some_developer_tokensome_agentfalsefalsehttps://adwords.google.com/api/adwords/cm/v201402 
">ADD14655479043https://adwords.google.com/api/adwords/cm/v201402 
" 
xsi:type="ns2:TemplateAd">some_urlsome_display_url432adDataappIdTEXTsome_app_id_textappStoreENUM2351043323300250some_ad_namePAUSED*

Respone:






























*http://schemas.xmlsoap.org/soap/envelope/ 
">https://adwords.google.com/api/adwords/cm/v201402 
">0004fb7ba9c493000ae0ce41eb002b05AdGroupAdServicemutate1508soap:Server[NullError.NULL_CONTENT
 
@ 
operations[0].operand.ad.adAsImage]https://adwords.google.com/api/adwords/cm/v201402 
">[NullError.NULL_CONTENT
 
@ 
operations[0].operand.ad.adAsImage]ApiExceptionhttp://www.w3.org/2001/XMLSchema-instance 
" 
xsi:type="NullError">operations[0].operand.ad.adAsImageNullError.NULL_CONTENTNullErrorNULL_CONTENT*

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can't set DYNAMIC_IMAGE MediaType when uploading animated GIF image via MediaService

2014-06-10 Thread Chingiz Aitkul
Hi, yes I can create the ad using UI with the very same animated gif Image.

Actually I can upload the Image via MediaService, and get a generated 
mediaId. The problem is that the Image media is not retrievable after that. 
On the other hand, when I upload a static GIF or JPEG Image, it is always 
retrievable via MediaService after that. The Java example code from 
google sets the media type as MediaMediaType.IMAGE, before uploading via 
MediaService, so I tried to set MediaMediaType.DYNAMIC_IMAGE instead, which 
generated an error I posted above.

The question is, why does MediaService reply with ok when I upload an 
animated GIF Image by specifying media type IMAGE, but then somehow 
"forget" it? If it is media type DYNAMIC_IMAGE, i should use when uploading 
animated GIFs, why do I get error from MediaService?


On Monday, June 9, 2014 8:26:32 PM UTC+2, Josh Radcliff (AdWords API Team) 
wrote:

> Hi,
>
> The UI supports a wide variety of ads, but the API may not necessarily 
> support every one of these formats. As a starting point, have you tried 
> creating the ad through the UI using the image in question? If the UI won't 
> create the ad, then the API will not either.
>
> Also, the MediaService is meant for usage with template ads 
> <https://developers.google.com/adwords/api/docs/appendix/templateads>, 
> which does *not* include ImageAd 
> <https://developers.google.com/adwords/api/docs/reference/v201402/AdGroupAdService.ImageAd>s.
>  
> If you want to create an *ImageAd* you'll have to skip *MediaService* 
> altogether and pass the image data directly on the ImageAd.image.data 
> <https://developers.google.com/adwords/api/docs/reference/v201402/AdGroupAdService.Image#data>
>  field in 
> your *AdGroupAdService* request.
>
> Cheers,
> Josh, AdWords API Team
>
> On Friday, June 6, 2014 12:08:42 PM UTC-4, Chingiz Aitkul wrote:
>>
>> Hi there, I am trying to upload an animated GIF Image via upload() method 
>> of MediaService using example code provided with Java library for AdWords 
>> API. When I upload a static GIF or JPEG file it works ok.
>>
>> When I try to upload an animated GIF Image, the Service replies with a 
>> MediaID without any errors, but when I query for all available media files, 
>> I don't recieve any entries for the animated GIF Images, only the static 
>> Image Uploads I retrieved.
>>
>> I noticed that in the example code 
>> (adwords.axis.v201402.misc.UploadImage.java) the MediaType of the Image is 
>> set before uploading to MediaMediaType,IMAGE. So I Change it to 
>> MediaMediaType.DYNAMIC_IMAGE, and when I do so, I get the following error.
>>
>> Could you please advice, if this is a bug or I am doing something wrong 
>> here?
>>
>> *http://schemas.xmlsoap.org/soap/envelope/* 
>> <http://schemas.xmlsoap.org/soap/envelope/>
>>
>> *">https://adwords.google.com/api/adwords/cm/v201402* 
>> <https://adwords.google.com/api/adwords/cm/v201402>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *">
>> 0004fb2cc9f931980ae06184c4000fa2
>> MediaService
>> upload
>> 1
>> 600
>> 
>> soap:Server
>> [MediaError.UNSUPPORTED_OPERATION @ 
>> media[0].type]
>> https://adwords.google.com/api/adwords/cm/v201402* 
>> <https://adwords.google.com/api/adwords/cm/v201402>
>>
>>
>> *">[MediaError.UNSUPPORTED_OPERATION @ 
>> media[0].type]
>> ApiExceptionException in thread "main" 
>> http://www.w3.org/2001/XMLSchema-instance* 
>> <http://www.w3.org/2001/XMLSchema-instance>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *" xsi:type="MediaError">
>> media[0].type
>> 
>> MediaError.UNSUPPORTED_OPERATION  
>>   
>> MediaError
>> UNSUPPORTED_OPERATION
>> 
>> *
>>
>>
>>
>>
>>
>>
>>
>> *AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server 
>> <http://schemas.xmlsoap.org/soap/envelope/%7DServer> faultSubcode: 
>>  faultString: [MediaError.UNSUPPORTED_OPERATION @ 
>> media[0].type] faultActor:  faultNode:  faultDetail: 
>>  {https://adwords.google.c

Can't set DYNAMIC_IMAGE MediaType when uploading animated GIF image via MediaService

2014-06-06 Thread Chingiz Aitkul
Hi there, I am trying to upload an animated GIF Image via upload() method 
of MediaService using example code provided with Java library for AdWords 
API. When I upload a static GIF or JPEG file it works ok.

When I try to upload an animated GIF Image, the Service replies with a 
MediaID without any errors, but when I query for all available media files, 
I don't recieve any entries for the animated GIF Images, only the static 
Image Uploads I retrieved.

I noticed that in the example code 
(adwords.axis.v201402.misc.UploadImage.java) the MediaType of the Image is 
set before uploading to MediaMediaType,IMAGE. So I Change it to 
MediaMediaType.DYNAMIC_IMAGE, and when I do so, I get the following error.

Could you please advice, if this is a bug or I am doing something wrong 
here?

*http://schemas.xmlsoap.org/soap/envelope/* 


*">https://adwords.google.com/api/adwords/cm/v201402* 













*">
0004fb2cc9f931980ae06184c4000fa2
MediaService
upload
1
600

soap:Server
[MediaError.UNSUPPORTED_OPERATION @ 
media[0].type]
https://adwords.google.com/api/adwords/cm/v201402* 



*">[MediaError.UNSUPPORTED_OPERATION @ 
media[0].type]
ApiExceptionException in thread "main" 
http://www.w3.org/2001/XMLSchema-instance* 











*" xsi:type="MediaError">
media[0].type

MediaError.UNSUPPORTED_OPERATION 
   
MediaError
UNSUPPORTED_OPERATION

*







*AxisFault faultCode: 
{http://schemas.xmlsoap.org/soap/envelope/}Server faultSubcode: 
 faultString: [MediaError.UNSUPPORTED_OPERATION @ 
media[0].type] faultActor:  faultNode:  faultDetail: 
 
{https://adwords.google.com/api/adwords/cm/v201402}ApiExceptionFault:[MediaError.UNSUPPORTED_OPERATION
 
@ 
media[0].type]ApiExceptionhttp://www.w3.org/2001/XMLSchema-instance* 
*" 
xsi:type="MediaError">media[0].typeMediaError.UNSUPPORTED_OPERATIONMediaErrorUNSUPPORTED_OPERATION*




















































*[MediaError.UNSUPPORTED_OPERATION @ media[0].type] at 
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
 at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at 
java.lang.reflect.Constructor.newInstance(Constructor.java:408) at 
java.lang.Class.newInstance(Class.java:433) at 
org.apache.axis.encoding.ser.BeanDeserializer.(BeanDeserializer.java:104) 
at 
org.apache.axis.encoding.ser.BeanDeserializer.(BeanDeserializer.java:90) 
at 
com.google.api.ads.adwords.axis.v201402.cm.ApiException.getDeserializer(ApiException.java:143)
 at 
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at 
java.lang.reflect.Method.invoke(Method.java:483) at 
org.apache.axis.encoding.ser.BaseDeserializerFactory.getSpecialized(BaseDeserializerFactory.java:154)
 at 
org.apache.axis.encoding.ser.BaseDeserializerFactory.getDeserializerAs(BaseDeserializerFactory.java:84)
 at 
org.apache.axis.encoding.DeserializationContext.getDeserializer(DeserializationContext.java:464)
 at 
org.apache.axis.encoding.DeserializationContext.getDeserializerForType(DeserializationContext.java:547)
 at 
org.apache.axis.message.SOAPFaultDetailsBuilder.onStartChild(SOAPFaultDetailsBuilder.java:157)
 at 
org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
 at 
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
 at 
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:378)
 at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2770)
 at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
 at 
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:117)
 at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
 at 
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
 at 
com.sun.org.apache.xerces.internal.parsers.XM