unmarshalling error

813 views
Skip to first unread message

soumya pathuri

unread,
Jul 13, 2011, 11:34:11 AM7/13/11
to AdWords API Forum
I am trying to create a campaign using campaign service and it is
giving following error

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/
envelope/"><soap:Body><soap:Fault><faultcode>soap:Server</
faultcode><faultstring>Unmarshalling Error: unexpected element
(uri:"https://adwords-sandbox.google.com/api/adwords/cm/v201101",
local:"RequestHeader"). Expected elements are &lt;{https://
adwords.google.com/api/adwords/cm/v201101}ApiExceptionFault&gt;,&lt;
{https://adwords.google.com/api/adwords/cm/v201101}
RequestHeader&gt;,&lt;{https://adwords.google.com/api/adwords/cm/
v201101}ResponseHeader&gt;,&lt;{https://adwords.google.com/api/adwords/
cm/v201101}get&gt;,&lt;{https://adwords.google.com/api/adwords/cm/
v201101}getResponse&gt;,&lt;{https://adwords.google.com/api/adwords/cm/
v201101}mutate&gt;,&lt;{https://adwords.google.com/api/adwords/cm/
v201101}mutateResponse&gt; </faultstring></soap:Fault></soap:Body></
soap:Envelope>

Code:

<?xml version='1.0' encoding='UTF-8' ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://
schemas.xmlsoap.org/soap/envelope/'
xmlns:ns1='https://adwords-sandbox.google.com/api/
adwords/cm/v201101'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-
instance'>
<SOAP-ENV:Header>
<ns1:RequestHeader xmlns:ns1='https://adwords-
sandbox.google.com/api/adwords/cm/v201101'
xsi:type='ns1:RequestHeader'>
<ns1:authToken></ns1:authToken>
<ns1:developerToken>x...@gmail.com++USD</ns1:developerToken>
<ns1:clientEmail>client...@gmail.com</ns1:clientEmail>
<ns1:userAgent>Adwords API Testing</ns1:userAgent>
</ns1:RequestHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns1:mutate>
<ns1:operations>
<ns1:operator>ADD</ns1:operator>
<ns1:operand>
<ns1:name>TestCruise111</ns1:name>
<ns1:status>PAUSED</ns1:status>
<ns1:budget>
<ns1:period>DAILY</ns1:period>
<ns1:amount>
<ns1:microAmount>50000000</ns1:microAmount>
</ns1:amount>
<ns1:deliveryMethod>STANDARD</ns1:deliveryMethod>
</ns1:budget>
<ns1:biddingStrategy xmlns:cm='https://adwords-
sandbox.google.com/api/adwords/cm/v201101' xmlns:xsi='http://
www.w3.org/2001/XMLSchema-instance' xsi:type='ManualCPC'/>
</ns1:operand>
</ns1:operations>
</ns1:mutate>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Please suggest.
Thanks,
Soumya

Kevin Winter

unread,
Jul 18, 2011, 10:51:43 AM7/18/11
to adwor...@googlegroups.com
Hi Soumya,
  There are a few things you need to fix with your xml.

- You need to use adwords.google.com for the namespaces, even when making requests against the sandbox.
- You need a namespace qualifier on the xsi:type for the bidding strategy.

I noticed a few other things you don't need that could be removed

- You don't need to specify the namespaces everywhere in the xml, once you declare it at the top it's declared for the whole XML document.
- You don't need an xsi:type for RequestHeader.
- You don't need to specify the cm namespace, you aren't using it.

Here's the formatted working copy (working except it doesn't have valid credentials) I ended up with:

   <SOAP-ENV:Header>
      <ns1:RequestHeader>
         <ns1:authToken/>
         <ns1:developerToken>x...@gmail.com++USD</ns1:developerToken>
         <ns1:clientEmail>client...@gmail.com</ns1:clientEmail>
         <ns1:userAgent>Adwords API Testing</ns1:userAgent>
      </ns1:RequestHeader>
   </SOAP-ENV:Header>
   <SOAP-ENV:Body>
      <ns1:mutate>
         <ns1:operations>
            <ns1:operator>ADD</ns1:operator>
            <ns1:operand>
               <ns1:name>TestCruise111</ns1:name>
               <ns1:status>PAUSED</ns1:status>
               <ns1:budget>
                  <ns1:period>DAILY</ns1:period>
                  <ns1:amount>
                     <ns1:microAmount>50000000</ns1:microAmount>
                  </ns1:amount>
                  <ns1:deliveryMethod>STANDARD</ns1:deliveryMethod>
               </ns1:budget>
               <ns1:biddingStrategy xsi:type="ns1:ManualCPC"/>
            </ns1:operand>
         </ns1:operations>
      </ns1:mutate>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

- Kevin Winter
AdWords API Team
Reply all
Reply to author
Forward
0 new messages