Creating budget via WCF Connected service failing with error

63 views
Skip to first unread message

Martin Rode

unread,
Jan 10, 2018, 5:55:36 PM1/10/18
to AdWords API Forum
Hi,

I'm trying to create a budget via WCF Connected service in VS2017 (netcore 2.0) app. I'm using v201710 version. 

Code:

            /// Create the campaign budget.
            Budget budget = new Budget
            {
                deliveryMethod = BudgetBudgetDeliveryMethod.STANDARD,
                amount = new Money { microAmount = 50000000 },
                isExplicitlyShared = false
            };

            BudgetOperation budgetOperation = new BudgetOperation();
            budgetOperation.@operator = Operator.ADD;
            budgetOperation.operand = budget;
            var operations = new BudgetOperation[] { budgetOperation };

            try
            {                
                BudgetReturnValue budgetRetval = Client.mutateAsync(_soapHeader, operations).Result.rval;
                //Client.CloseAsync();
                return budgetRetval.value[0];
            }
            catch (Exception e)
            {
                throw new System.ApplicationException("Failed to add budget.", e);
            }

It is failing with  - [RangeError.TOO_LOW @ operations[0].operand.amount, RequiredError.REQUIRED @ operations[0].operator] - even though both amount and operator are assigned.

The client is constructed via Activator.CreateInstance<T>() where T is BudgetServiceInterfaceClient from WCF generated class.

For example, the same setup but getAsync for the budget works fine. 

Any ideas what could be wrong? When I use .NET 4.6.1 ad AdWords client library, the budget creation works fine. 

Any help appreciated.

Thanks,
Martin


Vincent Racaza (AdWords API Team)

unread,
Jan 11, 2018, 1:16:13 AM1/11/18
to AdWords API Forum
Hi Martin,

The RangeError.TOO_LOW means that the value is too low or is not acceptable as a value for a field. For an instance, if you are setting a negative value for your budget, then it will generate this error.

Since this happens only in your WCF Connected Service, and not in your .NET 4.6.1 version of the AdWords client library, then the reason could be that an invalid value of the number was being sent in the request instead of the actual value that you set in your code (e.g. instead of 50000000, the value being sent is 49999999). This could probably be an issue in the WCF itself. Can you provide to me your SOAP request and response logs instead via Reply privately to author option so I can further check if the values being sent are correct?

Thanks,
Vincent
AdWords API Team

Vincent Racaza (AdWords API Team)

unread,
Jan 17, 2018, 3:17:48 AM1/17/18
to AdWords API Forum
Hi Martin,

A gentle follow up on this. If you still have issues regarding this, then kindly provide the details that I asked previously via Reply privately to author option.
Reply all
Reply to author
Forward
0 new messages