【问题标题】:create the object of json and pass data to the server using the VBScipt创建 json 对象并使用 VBScipt 将数据传递给服务器
【发布时间】:2012-03-16 08:11:39
【问题描述】:

我是开发网络服务的初学者,所以请帮助解决我的问题

我需要创建一个 VBS(VBScript) 文件,说明如何创建 json 字符串以及将 json 对象传递给 java restful webservice

以下是我的代码,但它不是 json 形式,所以请帮助创建对象的 json 形式

surl="http://localhost:8080/de.vogella.jersey.first/rest/hello/add"
Set objNetwork = CreateObject("Wscript.Network") 
strComputer = objNetwork.ComputerName 
json="name="+strComputer+"&age=24"
'json="name=strComputer&age=24"
HTTPPost sUrl,json
Function HTTPPost(sUrl,json)

'Microsoft.XMLHTTP
set OHTTP = CreateObject("MSXML2.serverXMLHTTP")
OHTTP.open "POST",surl,false
msgbox(surl & json)


OHTTP.setRequestHeader "Content-Type","application/x-www-form-urlencoded"
OHTTP.setRequestHeader "Content-Length","Len(json)"
OHTTP.setRequestHeader "Pragma","no-cache"
OHTTP.setRequestHeader "Expires","-1"
OHTTP.setRequestHeader "Connection","close"

OHTTP.send json

'HTTPPOST = oHTTP.responseText
msgbox(OHTTP.responseText)
End Function

提前感谢您在我的问题上花费宝贵的时间

【问题讨论】:

    标签: java json vbscript restful-authentication


    【解决方案1】:

    这会很有帮助:

    http://code.google.com/p/aspjson/

    【讨论】:

      猜你喜欢
      • 2015-07-27
      • 1970-01-01
      • 2018-01-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多