First of all thanks for the brilliant support, the response time in this forum is lightning fast. Sorry that I just skipped the most important part, but the solution from Klaus was just the right one.
But now I have another strange thing. When I start compiling I receive the error:
"Index was out of range. Must be non-negative and less than the size of the collection
Line number: 132
Line: WriteVariableInteger(54134, stunde)"
The variable stunde is ok, it doesn´t even work if I replace "stunde" by "1".
And here is the whole code of WriteVariableInteger:
Sub Globals
Dim buffer(0) As Byte
Dim write
URL = "http://192.168.3.2:3773/soap/IIPSVariableManager"
End Sub
Sub App_Start
FileOpen(c2,"write.txt",cRead) 'Read the SOAP message
write = FileReadToEnd(c2)
FileClose(c2)
bit.New1
obj.New1(False)
Sub WriteVariableInteger (id, value)
ErrorLabel(error2)
Request.New1(URL) 'Build the request.
obj.New1(False)
obj.FromLibrary("Main.Request","req",B4PObject(2))
obj.Value = obj.GetProperty("Headers")
SoapAction = "urn:UIPSTypes-
IIPSVariableManager#WriteVariableInteger"
obj.RunMethod3("Add","SoapAction","System.String",Chr(34) _
& SoapAction & Chr(34),"System.String") 'Set the SOAPAction header
Request.Method = "POST"
Request.ContentType = "text/xml"
newWrite = StrReplace(write,"$$1",id) 'Replace the two parameters.
newWrite = StrReplace(newWrite,"$$2",value)
buffer() = bit.StringToBytes(newWrite,0,StrLength(newWrite))
Request.ContentLength = ArrayLen(buffer())
bin.New1(Request.GetStream,True)
bin.WriteBytes(buffer())
Request.TimeOut = 30000 '30 seconds
Response.New1
Response.Value = Request.GetResponse 'Call the server
result = Response.GetString 'Get the string from the response stream.
Response.Close
Return result
error2:
Msgbox("Communication error.")
Return 0
End Sub