3

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 *************
***************************************
nempoBu4
  • 6,521
  • 8
  • 35
  • 40
Lars Hansen
  • 155
  • 1
  • 2
  • 16

1 Answers1

1

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
nempoBu4
  • 6,521
  • 8
  • 35
  • 40
  • Thank you very much :-). Actually I tried this approach - somehow - , but I must have done something slightly different/wrong, as your solution works 100%. If Im supposed to give your answer a rating, Im not aware of how, so please forgive me in that case. Again thanks for your quick answer. – Lars Hansen Oct 19 '15 at 09:06
  • 1
    @LarsHansen You should have enough reputation to gain some [privileges](http://stackoverflow.com/help/privileges) as voting, flaging, etc. – nempoBu4 Oct 19 '15 at 09:18
  • @LarsHansen By marking as useful comment you claim that the comment is useful. There are no reputation from this action. [Here](http://stackoverflow.com/help/whats-reputation) is the list of actions on which you can gain/lose your reputation. – nempoBu4 Oct 19 '15 at 10:19