Calls with no parameters with SOAP::Lite

397 views
Skip to first unread message

leo

unread,
May 12, 2005, 3:01:05 PM5/12/05
to adwor...@googlegroups.com
What's the correct way to make API calls with no parameters? For
instance, I thought this would work:

my $address = $service->getBillingAddress('', @headers);

which results in XML looking like:

... <SOAP-ENV:Body><getBillingAddress
xmlns=""><parameters/></getBillingAddress></SOAP-ENV:Body> ...

But the response is an error: 'operation description is missing
parameter description'

Why is it failing?

Bob B.

unread,
May 18, 2005, 6:25:08 PM5/18/05
to adwor...@googlegroups.com
try putting a dummy value in the parameters tag, like so:

<parameters>1</parameters>

buds...@gmail.com

unread,
May 18, 2005, 9:27:41 PM5/18/05
to adwor...@googlegroups.com
We got rount this using the SOAP::Lite call method. You need to
include the proxy when you create the objecy. i.e.

$svc = SOAP::Lite->service( "$url?wsdl" )
$svc->proxy($url);

my @params = ();
my $call = $svc->call( getBillingAddress => @params, @headers );
@result = ($call->result, $call->paramsout);

pierpaolo

unread,
May 24, 2005, 12:49:14 PM5/24/05
to adwor...@googlegroups.com
Hi I tried your code but I got:
Can't use an undefined value as a HASH reference

here is the code:
my $service = SOAP::Lite->service($url);
$service->proxy($url);

# Disable autotyping.
$service->autotype(0);

# Register a fault handler.
$service->on_fault(\&faulthandler);

my @headers =

(SOAP::Header->name("email")->value($email)->uri($namespace)->prefix("impl"),

SOAP::Header->name("password")->value($password)->uri($namespace)->prefix("impl"),

SOAP::Header->name("useragent")->value($useragent)->uri($namespace)->prefix("impl"),

SOAP::Header->name("token")->value($token)->uri($namespace)->prefix("impl"));

# Call the service method.

my $param=0;
my $call = $service->call( getAccountCurrency => $param, @headers );


@result = ($call->result, $call->paramsout);

could you see something wrong?

japh

unread,
May 24, 2005, 9:32:40 PM5/24/05
to adwor...@googlegroups.com
I don't know if this is relevant. My web server had an older version
of Soap::Lite installed and you have to use different syntax. This may
have nothing to do with your problem though. Here is a link to a
discussion that fixed my problem:


http://groups-beta.google.com/group/adwords-api/browse_frm/thread/c277302ff1555b63/23e960ccf8b9845d

pierpaolo

unread,
May 25, 2005, 9:33:34 AM5/25/05
to adwor...@googlegroups.com
In fact also my SOAP::Lite version is "old" (0.60) and I had a similar
problem for running CustomReportJob.

Unfortunately the problem I have now (impossible to use functions that
do not use parameters) seems to have a different origin....

in any case many thanks!

Bob B.

unread,
May 25, 2005, 8:00:01 PM5/25/05
to adwor...@googlegroups.com
I use the same version of SOAP::Lite with no problem. The problem is
that Google's sample code for scheduling reports in Perl is wrong.
They use the namespace "api" but in their sample code they use the
namespace "impl". Replace this snippet in their code:

$r->attr( {'xsi:type' => 'impl:KeywordReportJob',
'xmlns:impl' => $namespace } );

with this:

$r->attr( {'xsi:type' => 'api:KeywordReportJob',
'xmlns:api' => $namespace } );

buds...@gmail.com

unread,
May 26, 2005, 1:31:39 AM5/26/05
to adwor...@googlegroups.com
The only thing I can see, is that you have to use a slightly different
URL for the service and proxy calls. Service call needs to be the URL
of the wsdl definistion, and the proxy call should just be the the URL
which actually does the work. So in googles case:

my $url = 'https://adwords.google.com/api/adwords/v2/AccountService';
my $wsdl_url = $url . '?wsdl';
my $service = SOAP::Lite->service( $wsdl_url );
$service->proxy($url);

We are using SOAP::Lite version 0.60.
Other than that don't know what the problem would be. Do you know
which line is triggerring the error? Definately works for us, the
getAccountCurrency example was taken from our live system - don't tell
my boss :)

pierpaolo

unread,
May 26, 2005, 1:22:46 PM5/26/05
to adwor...@googlegroups.com
I tried following your suggestion and now I get
SOAP Fault: org.xml.sax.SAXException: operation description is missing
parameter description! for input "" (Error Code )

the line causing the error is (as always):


my $call = $service->call( getAccountCurrency => $param, @headers );

It's interesting to know that the same code with the same version of
SOAP::Lite gives different results for different users....

buds...@gmail.com

unread,
May 29, 2005, 8:47:44 PM5/29/05
to adwor...@googlegroups.com
I built a sample from your code anmd found the problem. You are using
$param instead of @param. The call bit should look like:

my @param = ();
my $call = $service->call( getAccountCurrency => @param, @headers );

I have uploaded my working sample at:

http://www.geocities.com/gerbs_oohay/sod.pl

pierpaolo

unread,
May 30, 2005, 9:37:25 AM5/30/05
to adwor...@googlegroups.com
really many many thanks! Now it works! To say the truth I tried also
with @param but at that time the error was the bad setting of the
proxy, after that I wrongly thought that a list was not needed because
expect no params at all!!!

Now, thanks to you I can associate a currency (and other infos) to an
account, but (maybe you know) when I run a CustomReportJob with
'crossClient' => 'true' (I use an MCC login so I got a report covering
different accounts), it seems that I'm not able to distinguish between
different accounts...in fact if I include the AccountName in the list
of customOptions in the report output I always have: account="Account"
(while in standard reports, for ex. UrlReportJob, there is a different
value of the variable acctname for each account)...

Do you have any idea about how to identify different account in a
CustomReportJob...or maybe the fact that the name of the variable is
different (account instead of acctname) indicates jusy that that kind
of infos is not available in a CustomReport?

sorry to profit again by you...I'm trying to implement a sort of
automatic bidding procedure and it's so hard to get infos using this
forum...

buds...@gmail.com

unread,
May 30, 2005, 11:06:03 PM5/30/05
to adwor...@googlegroups.com
Sorry mate - I don't do the reports, mainly just the content/bid
management. The doco seems to imply you should be able to specify
AccountName in the customOptions, but as I said, I really don't know
sorry.

pierpaolo

unread,
May 31, 2005, 6:25:06 AM5/31/05
to adwor...@googlegroups.com
Thanks a lot again, you really helped me...I'll continue using standard
reports, I definitely can survive without custom reports....

Reply all
Reply to author
Forward
0 new messages