Quick SOAP+XML Tutorial results in XML_STREAM_EXC

522 views
Skip to first unread message

Bill Jenkins

unread,
Apr 24, 2012, 4:43:35 PM4/24/12
to adwor...@googlegroups.com
Request: Can anyone suggest a solution to the XML_STREAM_EXC error I am recieving?


I'm learning the adwords API and tried implementing the Quick SOAP+XML tutorial at  https://developers.google.com/adwords/api/docs/#soap

After editing out the spaces used to indent the lines of XML code the result passes validation at  http://validator.w3.org/check

Here's the curl command I enter:  curl --header "Content-Type: application/soap+xml" --data @hello_world.xml https://adwords-sandbox.google.com/api/adwords/cm/v201109/CampaignService

Here's the result:  <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring>XML_STREAM_EXC</faultstring></soap:Fault></soap:Body></soap:Envelope>

Here's the contents of hello_world.xml (with private info replaced by xxx)

<?xmlversion ="1.0" encoding="UTF-8"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns="https://adwords.google.com/api/adwords/cm/v201109">
<soap:Header>
<RequestHeader>
<authToken>xxx</authToken>
<userAgent>curl-tutorial</userAgent>
<developerToken>x...@gmail.com</developerToken>
<clientCustomerId>xxx-xxx-xxxx</clientCustomerId>
</RequestHeader>
</soap:Header>
<soap:Body>
<mutate>
<operations>
<operator>ADD</operator>
<operand>
<name>HelloWorld!withcURL</name>
<budget>
<period>DAILY</period>
<amount>
<microAmount>1000000000</microAmount>
</amount>
<deliveryMethod>STANDARD</deliveryMethod>
</budget>
<biddingStrategy
xmlns:cm="https://adwords.google.com/api/adwords/cm/v201109"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="cm:ManualCPC"/>
</operand>
</operations>
</mutate>
</soap:Body>
</soap:Envelope>

Anash P. Oommen

unread,
Apr 25, 2012, 5:27:16 AM4/25/12
to adwor...@googlegroups.com
Hi Bill,

XML_STREAM_EXC error means that your xml is not well-formed. I'm not sure if this is a copy-paste error, but there should be a space after <?xml in the xml request you pasted.

Cheers,
Anash P. Oommen,
AdWords API Advisor.

Bill Jenkins

unread,
Apr 25, 2012, 9:03:56 AM4/25/12
to adwor...@googlegroups.com
Thanks Anash. I corrected that missing space.

The error result continued as before. What I then discovered was that new lines between < and > are not acceptable, even though they are accepted by the validator.

By removing those new lines I'm getting beyond the XML_STREAM_EXC error.

Thanks,
Bill

Anash P. Oommen

unread,
Apr 26, 2012, 7:28:02 AM4/26/12
to adwor...@googlegroups.com
Hi Bill,

If I remember correctly, XML doesn't allow a \n in the node name. That should explain why you got  XML_STREAM_EXC error .

Cheers,
Anash P. Oommen,
AdWords API Advisor.
Reply all
Reply to author
Forward
0 new messages