Re: Array params in VB Script w/Soap Toolkit 3.0

Harris Stein <[email protected]> Fri, 24 Jan 2003 11:17:48 -0500
Newsgroups gmane.comp.windows.devel.soap.general
Message-ID <OFF919B0F9.92A6CDF4-ON85256CB8.005927A2-85256CB8.0059853F@oscorp.osinternal.net>
The error that comes back from the web service is that the periods
parameter was not supplied (and if I debug it, the array is of size 0). All
the other params are .net strings, and those get sent fine. I can't send
over a string of XML, because the Soap Toolkit tries to bind the parameter
as an array, and create XML nodes for each array item.
I have captured the HTTP request, and the main difference between the one
created by Soap Toolkit and .net is that the Soap Toolkit puts namespace
qualifiers on each param.
Here is the one that WORKS, created by a .net app:
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap
="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi
="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd
="http://www.w3.org/2001/XMLSchema"><soap:Body><company xmlns
="http://api.onesource.com/AppLink/types">19147</company><report xmlns
="http://api.onesource.com/AppLink/types">BalanceSheet</report><periods
xmlns
="http://api.onesource.com/AppLink/types"><Period>A0</Period></periods><taxonomy
 xmlns="http://api.onesource.com/AppLink/types">usfr</taxonomy><currency
xmlns="http://api.onesource.com/AppLink/types">USD</currency><product xmlns
="http://api.onesource.com/AppLink/types">USBBAPPLINK</product></soap:Body></soap:Envelope>

Here is the vbscript one that doesn't work:
<?xml version="1.0" encoding="UTF-8" standalone="no"?><SOAP-ENV:Envelope
xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema" xmlns:SOAPSDK2
="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAPSDK3
="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV
="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAPSDK4:company
 xmlns:SOAPSDK4
="http://api.onesource.com/AppLink/types">19147</SOAPSDK4:company><SOAPSDK5:report
 xmlns:SOAPSDK5
="http://api.onesource.com/AppLink/types">BalanceSheet</SOAPSDK5:report><SOAPSDK6:periods
 xmlns:SOAPSDK6
="http://api.onesource.com/AppLink/types"><Period>A0</Period></SOAPSDK6:periods><SOAPSDK7:taxonomy
 xmlns:SOAPSDK7
="http://api.onesource.com/AppLink/types">usfr</SOAPSDK7:taxonomy><SOAPSDK8:currency
 xmlns:SOAPSDK8
="http://api.onesource.com/AppLink/types">USD</SOAPSDK8:currency><SOAPSDK9:product
 xmlns:SOAPSDK9
="http://api.onesource.com/AppLink/types">USBBAPPLINK</SOAPSDK9:product></SOAP-ENV:Body></SOAP-ENV:Envelope>

Hope this helps!
Harris Stein



|---------+---------------------------->
|         |           "Bruns, Tom"     |
|         |           <tomb@gasullivan.|
|         |           com>             |
|         |                            |
|         |           01/24/2003 11:03 |
|         |           AM               |
|         |                            |
|---------+---------------------------->
  >--------------------------------------------------------------------------------------------------------------|
  |                                                                                                              |
  |       To:       <[email protected]>                                                                 |
  |       cc:                                                                                                    |
  |       Subject:  RE: [SOAP] Array params in VB Script w/Soap Toolkit 3.0                                      |
  >--------------------------------------------------------------------------------------------------------------|




What is the error message?

Is the WSDL file auto generated from the C# web service using
http://url.asmx?wsdl

Have you considered passing the array as a string of xml?

Tom Bruns
Consultant
G.A. Sullivan
Suite 100
10200 Alliance Rd
Cincinnati, Ohio 45242
Ph: (513) 745-2100


-----Original Message-----
From: Harris Stein [mailto:[email protected]]
Sent: Friday, January 24, 2003 10:12 AM
To: [email protected]
Subject: [SOAP] Array params in VB Script w/Soap Toolkit 3.0


Hi, I have a web service written in C#, which has some string[]
parameters. I can successfully create web references to this using C# or
VB.NET and call the service. However, using Microsoft's Soap Toolkit
3.0, I am having trouble. Here's the code I am trying:

Option Explicit

Dim Report
Dim appLinkService
Dim Answer
Dim WsdlFile
Dim FSO
Dim periods
'Dim Request

Set FSO = CreateObject("Scripting.FileSystemObject")

WsdlFile = FSO.BuildPath(FSO.GetParentFolderName
(WScript.ScriptFullName), "AppLinkFinancials.wsdl")

Set appLinkService = CreateObject("MSSOAP.SoapClient30")

WsdlFile, "", "Reports", "ReportsSoap",
"http://api.onesource.com/AppLink"
appLinkService.MSSoapInit WsdlFile, "", "", ""

periods = Array("A0")


Set Report = appLinkService.GetFinancialReportByProduct
("19147","BalanceSheet",periods,"usfr","USD","USBBAPPLINK")

For Each node in Report

 WScript.Echo "Report:" & Report
Next


In the WSDL, the periods param is defined as:
<xs:simpleType name="PeriodType">
    <xs:restriction base="xs:string">
     <xs:pattern value="([0-9]{4}(Q[1- 4])?)|((A|Q)(0|[-][1-5]))"/>
    </xs:restriction>
   </xs:simpleType>
<xs:complexType name="ArrayOfPeriod">
    <xs:sequence>
     <xs:element name="Period"
type="t:PeriodType" minOccurs="1" maxOccurs="unbounded"/>
    </xs:sequence>
   </xs:complexType>

So, my thoughts are either the WSDL definition is wrong, the VB code is
wrong, or both. Any ideas? Thanks! Harris Stein

You can read messages from the SOAP archive, unsubscribe from SOAP, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the SOAP archive, unsubscribe from SOAP, or subscribe to other
DevelopMentor lists at http://discuss.develop.com.