views:

49

answers:

2

Hi! I have a function that need to accept two parameters- user and folder! I call that function from VBscript, and parameters need to be send with post method. This is the Vbscript function code from where I want to post data:

Sub loadDocument()
Const HOST = "http://192.168.0.144/webservice13/service1.asmx/Lock?User="& PC\User & "folder="&c:\foldername
Set xmlhttp = CreateObject("Microsoft.XMLHTTP")
xmlhttp.open  "POST",HOST 
xmlhttp.send ""
End Sub

Now when i try to execute this function i getting error message that i have syntax error! I assume that error is in this line:

Const HOST = "http://192.168.0.144/webservice13/service1.asmx/Lock?User="& PC\User & "folder="&c:\foldername

How I can resolve this, how i can post two variables to this function? Thanks!

+1  A: 

Have you made sure the PC\User and c:\foldername paremeters you are using when constructing your HOST variable are propery URL Encoded?

You should also prepend an & to any additional parameter. You have not done this with your "folder=" paramenter, which should be "&folder=".

Oded
All parameters are properly encoded. But somewhere in syntax a have error!
Comii
@Comii - Updated my answer.
Oded
+1  A: 

I think you cannot declare a Const variable with variable parts. Change the line to

dim userVar, folderVar, HOST

userVar = "PC\User"
folderVar = "c:\foldername"

HOST = "http://192.168.0.144/webservice13/service1.asmx/Lock?User=" & userVar & "&folder=" & folderVar
edosoft