3
votes

I'm having some real trouble here regarding a Lotus Notes webservice consumer (written in lotus script).
The thing is that I'm sending an array (as a Class) to type XSD_Anytype, see below.

***************************************
**** Snippet from WebService **********
%INCLUDE "lsxsd.lss"
Class ArrayOfString_n1 As XSD_ANYTYPE

  Public string() As XSD_STRING

  Sub NEW
  End Sub


End Class

Const n1 = "http://xx.xx.x.xx/XXX/Statistic/Account/"
Class UserIDSoap_n1 As PortTypeBase

  Sub NEW
    Call Service.Initialize ("HttpxxxxxxxXXXStatisticAccountUserID", _
    "UserID.UserIDSoap", "http://xx.xx.x.xx/XXX/Statistic/Account/Account.asmx", _
    "UserIDSoap_n1")

  End Sub

  Function setAccount(IV_list As ArrayOfString_n1) As ArrayOfString_n1
    Set setAccount = Service.Invoke("setAccount", IV_list)
  End Function

End Class



Class XXXsetAccount As UserIDSoap_n1 

  Sub NEW
    Call Service.Initialize ("HttpxxxxxxxXXXStatisticAccountUserID", _
    "UserID.UserIDSoap", "http://xx.xx.x.xx/XXX/Statistic/Account/Account.asmx", _
    "UserIDSoap_n1")

End Sub

  Function setAccount(IV_list As ArrayOfString_n1) As ArrayOfString_n1
    Set setAccount = Service.Invoke("setAccount", IV_list)
  End Function

End Class



**** Snippet from WebService **********
***************************************

In my program I'm trying to populate an array of the class above.
When I assign a value to the array, Im able to send and get correct answer back from the called URI.

My problem is assigning different values to the array.
It seems that mmm is a reference and therefore it alters the whole array (LA_String).

***************************************
**** Snippet from program *************

Dim mmm         As XSD_STRING 
Dim LA_string   As New ArrayOfString_n1()
ReDim Preserve LA_string.String( CInt( view.Entrycount ) - 1 )

Dim i As Integer

i = 0
Do While Not ( dok Is Nothing )
  mmm.setValueFromString( dok.FieldWithValue( 0 ) )
  set LA_string.string(i) = mmm
  i = i + 1
  Set dok = View.GetNextDocument( dok )
Loop

**** Snippet from program *************
***************************************
1

1 Answers

1
votes

Yes, the mmm is reference, so you need to create new XSD_String object each time in your cycle.
Here is example:

Dim mmm         As XSD_STRING 
Dim LA_string   As New ArrayOfString_n1()
ReDim Preserve LA_string.String( CInt( view.Entrycount ) - 1 )

Dim i As Integer

i = 0
Do While Not ( dok Is Nothing )
  Set mmm = New XSD_STRING() ' <= Create new object here.
  mmm.setValueFromString( dok.FieldWithValue( 0 ) )
  set LA_string.string(i) = mmm
  i = i + 1
  Set dok = View.GetNextDocument( dok )
Loop