Troubles with: soaptoolkit v3.0, VB6 & maxOccurs="unbounded"

223 views
Skip to first unread message

MattD

unread,
Aug 2, 2005, 7:10:35 AM8/2/05
to AdWords API Forum
Hi,

I am trying to write an application to use the Google AdWords API. I am
using the MS soaptoolkit v3.0 and VB6 and I can sucessfully communicate
with the API in most cases however when I try to use the functions such
as:

--XML-----

<element name="getAdGroupStats">
<complexType>
<sequence>
<element name="campaignId" type="xsd:int"/>
<element maxOccurs="unbounded" name="adGroupIds" type="xsd:int"/>
<element name="start" type="xsd:dateTime"/>
<element name="end" type="xsd:dateTime"/>
</sequence>
</complexType>
</element>

--------

I cannot seem to be able to pass more than one value in the adGroupIds
parameter. I have tried in various ways including using an
IXMLDOMNodeList but VB just tells me:

--Error Msg-----

SoapMapper:Converting data for SoapMapper failed inside the typemapper
HRESULT=0x80020005: Type mismatch.
- SoapMapper:Saving SoapMapper campaignIds failed ... ect ...

-------

Here is the code for one of the methods I have tried:

--VB6Code-----

Dim strReturned As IXMLDOMSelection
Dim Dom2 As New DOMDocument30
Dim list As IXMLDOMNodeList
Dim CurrentDate As Date

Set sc = CreateObject("MSSOAP.SoapClient30")

Call
sc.MSSoapInit("https://adwords.google.com/api/adwords/v2/CampaignService?wsdl",
"", "", "")

Set sc.HeaderHandler = New ClientHeaderHandler

CurrentDate = Now()

Dom2.LoadXml
"<getCampaignStats><campaignIds>1234567</campaignIds><campaignIds>1234568</campaignIds></getCampaignStats>"

Set list = Dom2.documentElement.childNodes
Set strReturned = sc.getCampaignStats(list, CurrentDate,
CurrentDate)

-------

Anybody know what I am doing wrong?

Thanks.

Patrick Chanezon

unread,
Aug 3, 2005, 10:26:45 AM8/3/05
to MattD, AdWords API Forum
Hi Matt, glad to see some VB users out there.
The problem looks quite simple to me.

 Dom2.LoadXml
"<getCampaignStats><campaignId
s>1234567</campaignIds><campaignIds>1234568</campaignIds></getCampaignStats>"

should be

 Dom2.LoadXml
"<getCampaignStats><campaignId
>1234567</campaignId><campaignId>1234568</campaignId></getCampaignStats>"

The element name is campaignId not campaignIds
Your SOAP toolkit rightfully complains that it does not know how to map campaignIds.
Hope this helps.

P@
--
-- Patrick Chanezon, AdWords API evangelist
http://blog.chanezon.com/
http://www.google.com/apis/adwords/

MattD

unread,
Aug 3, 2005, 11:49:10 AM8/3/05
to AdWords API Forum
Thanks Patrick, I am glad there are other VB developers in here, I
think I would go insane otherwise.

Unfortunately it appears I accidentally posted the wrong WSDL data in
my original post, it should have read:

-------

<element name="getCampaignStats">
<complexType>
<sequence>
<element maxOccurs="unbounded" name="campaignIds"


type="xsd:int"/>
<element name="start" type="xsd:dateTime"/>
<element name="end" type="xsd:dateTime"/>
</sequence>
</complexType>
</element>

-------

If you have anymore ideas they would be greatly appreciated.

Patrick Chanezon

unread,
Aug 3, 2005, 1:22:09 PM8/3/05
to MattD, AdWords API Forum
Sorry Matthew I don't have my VB environment setup to test that yet.
Coming up with better VB samples in on my todo list:-)

Did you try making the same call with a start and and dates?

P@
Reply all
Reply to author
Forward
0 new messages