VB6 Soap Type mismatch Error
I am trying to use VB6 and the MS Soap toolkit 3.0 (I know I should use .NET but that is not an option right now.) to connect to the Google AdWords API, I can get my call to getCampaignStats to work successfully when I pass one id as a string but when I try to pass multiple ids (using the method suggested by the MSSoap documentation) I just get a type conversion error.
Here is the bit of the code where the troubles are occurring:
VB Code:
Dim strReturned As IXMLDOMSelection
Dim CurrentDate As Date
Dim Dom2 As New DOMDocument30
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 ("<cam><campaignIds>123456</campaignIds><campaignIds>123457</campaignIds></cam>")
Set strReturned = sc.getCampaignStats(Dom2.childNodes.Item(0).childNodes, CurrentDate, CurrentDate)
And here is the error:
Code:
: Detail : "SoapMapper:Converting data for SoapMapper failed inside the typemapper HRESULT=0x80020005: Type mismatch.
- SoapMapper:Saving SoapMapper campaignIds failed HRESULT=0x80020005: Type"
And the WSDL for the function:
Code:
<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 anybody knows what I am doing wrong (I'm sure it’s probably fairly simple) your suggestions would be greatly appreciated.
Thanks,