【问题标题】:Lotus Notes WebService Consumer populate Array XSD_STRINGLotus Notes Web 服务使用者填充数组 XSD STRING
【发布时间】:2015-10-16 14:34:36
【问题描述】:

我在这里遇到了一些关于 Lotus Notes Web 服务使用者的真正麻烦(用 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 *************
***************************************

【问题讨论】:

    标签: lotus-notes lotusscript


    【解决方案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
    

    【讨论】:

    • 非常感谢:-)。实际上我尝试了这种方法 - 不知何故 - 但我一定做了一些稍微不同/错误的事情,因为你的解决方案 100% 有效。如果我应该给你的答案打分,我不知道如何,所以在这种情况下请原谅我。再次感谢您的快速回答。
    • @LarsHansen 你应该有足够的声望来获得一些privileges 作为投票、标记等。
    • @LarsHansen 通过标记为有用的评论,您声称该评论是有用的。此行为没有声誉。 Here 是您可以获得/失去声誉的操作列表。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多