Fault: 1
Code: soapenv:Server.generalException
String: An internal error has occurred. Please retry your
request.
Detail:
My code is as follows:
The data $_SESSION['cpcRecommended'], $_SESSION['client'],
$_SESSION['Grup_id'] and $_SESSION['id_word']; pick them up from
another php script using session variables.
<?php
session_start();
print_r($_POST);
require_once('soapclientfactory.php');
require('./lib.php');
$botonEntra = $_POST['entra'];
$botonApelo = $_POST['entraApelo'];//entraApelo sera un float
#cabecera
$email_1 = 'XXXX';
$password_1 = 'XXXX';
$client_email = 'XXXX';
$useragent_1 = ' AdWords API PHP info Code';
$developer_token_1 = '-------------';
$application_token_1 = '------------';
$debug = 1;
$headers =
'<email>' . $email_1 . '</email>'.
'<password>' . $password_1 . '</password>' .
'<useragent>' . $useragent_1 . '</useragent>' .
'<clientEmail>' . $_SESSION['cliente'] . '</clientEmail>' .
'<developerToken>' . $developer_token_1 . '</developerToken>' .
'<applicationToken>' . $application_token_1 . '</
applicationToken>';
$namespace = 'https://adwords.google.com/api/adwords/
v13';
$servicio_criterio =
SoapClientFactory::GetClient($namespace . '/CriterionService?
wsdl', 'wsdl');
$servicio_criterio->setHeaders($headers);
if ($servicio_criterio->fault) show_fault($servicio_criterio);
$request_xml =
'<updateCriteria>' .
'<criteria>' .
'<id>' . $_SESSION['id_word'] . '</id>' .
'<adGroupId>' . $_SESSION['Grup_id'] . '</adGroupId>'
'<maxCpc>' . $_SESSION['cpcRecommended'] . '</maxCpc>'.
'</criteria>' .
'</updateCriteria>';
$tag = $servicio_criterio->call('updateCriteria', $request_xml);
echo $request_xml . '<br>';
// print_r($_SESSION);
if ($debug) show_xml($servicio_criterio);
if ($servicio_criterio->fault) show_fault($servicio_criterio);
echo ' Cpc update in: ' . $_SESSION['cpcRecommended'];
}
?>
And my answer is this xml:
<html><head></head><body>Array
(
[entra] => Si
[entraApelo] =>
)
ENTRA<email>xxxx</email><password>xxxxx</password><useragent>AdWords
API PHP info Code</useragent><clientemail>xxxxxxx</
clientemail><developertoken>--------</
developertoken><applicationtoken>---------</applicationtoken>
<updatecriteria><criteria><id>62099911</id><adgroupid>1496190137</
adgroupid></criteria></updatecriteria><br>Array
(
[cliente] => ---------------
[grupo] => ----------------
[anuncio] => --------------
[word_text] => optimiza|4000000|62099911|0
[id_word] => 62099911
[cpcRecommended] => 4000000
)
POST /api/adwords/v13/CriterionService HTTP/1.0
Host: adwords.google.com
User-Agent: NuSOAP/0.7.3 (1.114)
Content-Type: text/xml; charset=ISO-8859-1
SOAPAction: ""
Content-Length: 786
<soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/
envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap-
enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2023="http://
tempuri.org"><soap-env:header><email>XXXXXXX</email><password>XXXXXX</
password><useragent>AdWords API PHP info Code</
useragent><clientemail>XXXXX</clientemail><developertoken>-------
<developertoken><applicationtoken>---------------</applicationtoken></
soap-env:header><soap-env:body><updatecriteria><criteria><id>62099911</
id><adgroupid>1496190137</adgroupid></criteria></updatecriteria></soap-
env:body></soap-env:envelope>HTTP/1.1 500 Internal Server Error
Content-Type: text/xml; charset=iso-8859-1
Date: Thu, 25 Feb 2010 15:52:12 GMT
Expires: Thu, 25 Feb 2010 15:52:12 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Server: GFE/2.0
X-XSS-Protection: 0
Transfer-Encoding: chunked
<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/
envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:header>
<responsetime soapenv:actor="http://schemas.xmlsoap.org/soap/actor/
next" soapenv:mustunderstand="0" xmlns="https://adwords.google.com/api/
adwords/v13">245</responsetime>
<operations soapenv:actor="http://schemas.xmlsoap.org/soap/actor/
next" soapenv:mustunderstand="0" xmlns="https://adwords.google.com/api/
adwords/v13">0</operations>
<units soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
soapenv:mustunderstand="0" xmlns="https://adwords.google.com/api/
adwords/v13">0</units>
<requestid soapenv:actor="http://schemas.xmlsoap.org/soap/actor/
next" soapenv:mustunderstand="0" xmlns="https://adwords.google.com/api/
adwords/v13">d8cdab54698eb22ddb9b52a1189f1752</requestid>
</soapenv:header>
<soapenv:body>
<soapenv:fault>
<faultcode>soapenv:Server.generalException</faultcode>
<faultstring>An internal error has occurred. Please retry your
request.</faultstring>
<detail>
<ns1:fault xmlns:ns1="https://adwords.google.com/api/adwords/
v13">
<ns1:code>0</ns1:code>
<ns1:message>An internal error has occurred. Please retry your
request.</ns1:message>
</ns1:fault>
</detail>
</soapenv:fault>
</soapenv:body>
</soapenv:envelope>
Fault: 1
Code: soapenv:Server.generalException
String: An internal error has occurred. Please retry your request.
Detail:
</body></html>
Can you help?
Sorry for my English
I believe the problem is that you are not setting the type of the
criteria object. You either need to set the xsi:type to "Keyword" or
include the field criterionType with the value "Keyword".
<v13:updateCriteria>
<v13:criteria xsi:type="v13:Keyword">
<v13:adGroupId>1366519735</v13:adGroupId>
<v13:criterionType>Keyword</v13:criterionType>
<v13:id>17398960</v13:id>
<v13:maxCpc>1000000</v13:maxCpc>
</v13:criteria>
</v13:updateCriteria>
Best,
- Eric Koleda, AdWords API Team