Lotus Notes WebService Consumer填充数组XSD_STRING

时间:2015-10-16 14:34:37

标签: lotus-notes lotusscript

我在这里遇到一些关于Lotus Notes webservice使用者的麻烦(用Lotus脚本编写) 问题是我发送一个数组(作为一个类)来输入XSD_Anytype,见下文。

***************************************
**** 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 **********
***************************************

在我的程序中,我正在尝试填充上面一个类的数组 当我为数组赋值时,我能够从被调用的URI发送并获得正确的答案。

我的问题是为数组分配不同的值 mmm似乎是一个引用,因此它会改变整个数组(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 个答案:

答案 0 :(得分:1)

是的,mmm是引用,因此您需要在每次循环中创建新的XSD_String对象。
这是一个例子:

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