2015-10-16 51 views
3

我在這裏遇到了一些關於Lotus Notes web服務使用者(用lotus腳本編寫)的麻煩。
事情是我發送一個數組(作爲一個類)來鍵入XSD_Anytype,見下文。Lotus Notes WebService使用者填充數組XSD_STRING

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

在我的程序中,我試圖填充上面的類的數組。
當我給數組賦值時,Im能夠發送並從被調用的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

是的,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 
+0

非常感謝:-)。 其實我嘗試了這種方法 - 不知何故 - 但是我必須做一些稍微不同/錯誤的事情,因爲你的解決方案100%工作。 如果我應該給你的答案評分,林不知道如何,所以請原諒我在這種情況下。 再次感謝您的快速回答。 –

+1

@LarsHansen您應該有足夠的聲望來獲得一些[特權](http://stackoverflow.com/help/privileges)作爲投票,鞭,等。 – nempoBu4

+0

評分通過標記爲有用的評論嗎? –