I am developing a web service that accepts an array of strings as one of the input parameters. What little documentation I can find on this topic is very sketchy (IBM Developer) but suggests that defining the input parameter as a string array will work in Notes 8 (and presumably 8.5). For example:
function getDetails(arrProduct() as string, strCountryID as string) as ReturnedArray
This compiles without problems and the WSDL looks good with arrProduct defined as a complex type with an unbounded number of elements.
The problem arises when looping through the input array. A ForAll loop through the elements produces nothing except one empty string.
So, the question is: does anyone out there know how to create a web service in Domino 8.5 that accepts an array as an input parameter?
I’m posting this to help anyone else who might have the same problem.
I defined the array input parameter as STRINGARRAY_HOLDER which is a user-defined object from lsxsd.lss. If you look at the definition of STRINGARRAY_HOLDER in lsxsd.lss you will see it has a single public variable called “Value”. All that is required is to loop through the STRINGARRAY_HOLDER.Value variables. N.B. Make sure that the line
%INCLUDE “lsxsd.lss”
is in the Options section of the Web service code.
Here’s how my code looks:
Class PriceGrpMultiDetails
Public Function getMultiDetails (arrPriceGrpRef As STRINGARRAY_HOLDER, strCountryID As String, returnFault As WS_FAULT) As returnedRecordArray
Dim i As Integer
On Error Goto processError
' check that the first input parameter is an array
If Not Isarray( arrPriceGrpRef.Value ) Then
Call throwFault(returnFault, "Price group ref parameter is not an array" )
Exit Function
End If
' loop through the input array
Forall item In arrPriceGrpRef.Value
Print "price group " & Cstr(i) & " = " & item
i = i + 1
End Forall
If i = 0 Then
Call throwFault(returnFault, "Price group array parameter is empty" )
Exit Function
End If
<<<<<< other code goes here but removed to make this easier to read >>>>>>>>>
processError:
Call throwFault(returnFault, "getMultiDetails Error: " & Error$)
Exit Function
End Function
Private Sub throwFault (fault As WS_FAULT, faultText As String)
Call fault.setFault(True)
Call fault.setFaultString(faultText)
End Sub
nugget indeed. just one little question, how can i test the web service with a web service consumer, i’ve tried all variances of XSD_stringarray etc with no luck. also ‘value’ cant be written directly it seems.