note 82453 added to function.soap-soapclient-call
| From: | bananos at dev dot co dot ua | Date: | Fri, 11 Apr 2008 12:13:37 +0000 |
| Subject: | note 82453 added to function.soap-soapclient-call | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-138183@lists.php.net to get a copy of this message | ||
I'm writing PHP SOAP client (based on php_soap extension) which uses Google AdService,
today, I tried to create sample Ad using AdService::addAds() and discovered that my SOAP library
does not pass
"headline", "description1", "description2" parameters in SOAP
request.
First, I thought that this was something wrong with my data, coz I was getting validation errors
like
"One or more input elements failed validation." Then I decided to take a look at WSDL
description
https://adwords.google.com/api/adwords/v11/AdService?wsdl
And voilà ! I've found this:
<complexType name="Ad" abstract="true">
<sequence>
<element name="adGroupId" type="xsd:int"/>
<element name="adType" nillable="true" minOccurs="0"
type="impl:AdType"/>
<element name="destinationUrl" nillable="true" minOccurs="0"
type="xsd:string"/>
<element name="disapproved" type="xsd:boolean"/>
<element name="displayUrl" nillable="true" minOccurs="0"
type="xsd:string"/>
<element name="exemptionRequest" nillable="true" minOccurs="0"
type="xsd:string"/>
<element name="id" type="xsd:long"/>
<element name="status" nillable="true" minOccurs="0"
type="impl:AdStatus"/>
</sequence>
</complexType>
There is no any ''description", "headline1", "headline2", however
there is another complexType
<complexType name="TextAd">
<complexContent>
<extension base="impl:Ad">
<sequence>
<element name="description1" nillable="true" type="xsd:string"/>
<element name="description2" nillable="true" type="xsd:string"/>
<element name="headline" nillable="true" type="xsd:string"/>
</sequence>
</extension>
</complexContent>
</complexType>
So, the thing is when you are working with php_soap be aware of complexType extensions which does
not work in php_soap when you try to do things like:
<?php
$client = new
SoapClient(
"https://adwords.google.com/api/adwords/v11/AdService?wsdl",
array( 'trace' => true,
'exceptions' => true,
)
);
$entropy = substr(md5(rand(0, time())), 0, 10);
//create Ad test structure
$sample_ad = array(
"id" => 0,
"adGroupId" => 0,
"adType" => 'TextAd',
"disapproved" => false,
"destinationUrl" => 'http://test.com',
"displayUrl" => 'www.Test.com',
"status" => "Paused", // Enabled / Disabled
"descr_iption1" => 'D1_'.$entropy,
"des_cription2" => 'D2_'.$entropy,
"head_line" => 'H_'.$entropy
);
$client->addAds(array('ads' => array($sample_ad) );
?>
----
Server IP: 213.186.192.247
Probable Submitter: 91.124.130.96
----
Manual Page -- http://www.php.net/manual/en/function.soap-soapclient-call.php
Edit -- https://master.php.net/note/edit/82453
Del: integrated -- https://master.php.net/note/delete/82453/integrated
Del: useless -- https://master.php.net/note/delete/82453/useless
Del: bad code -- https://master.php.net/note/delete/82453/bad+code
Del: spam -- https://master.php.net/note/delete/82453/spam
Del: non-english -- https://master.php.net/note/delete/82453/non-english
Del: in docs -- https://master.php.net/note/delete/82453/in+docs
Del: other reasons-- https://master.php.net/note/delete/82453
Reject -- https://master.php.net/note/reject/82453
Search -- https://master.php.net/manage/user-notes.php