0
我正在通过HTTP将POST内容从Access VBA发送到Web方法,在MSXML中使用XMLHTTP对象。这是守则。在通过HTTP发送XML时编码“<" and ">”Post
Dim objXmlHttp As Object
Set objXmlHttp = CreateObject("MSXML2.ServerXMLHTTP")
objXmlHttp.Open "POST", webServicePath, False
objXmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
Dim Response As String
objXmlHttp.send wrt.output
'OK status
If objXmlHttp.Status = 200 Then
Response = objXmlHttp.responseText
End If
Set objXmlHttp = Nothing
我正在用 “& LT” 和 “& GT”,而不是<和>的XML。 如果我尝试进行URL编码,则在收件人一侧以ASCII文本形式接收所有内容。 你能指导我需要做什么来获得有效的XML格式。
我没有看到你的URL编码输出。 – 2009-09-10 16:57:15
VBA没有URL编码机制。我只是使用通用代码。 功能的URLEncode(strData是) 昏暗I,strTemp,strChar,斯特劳特,intAsc strTemp = TRIM(strData是) 对于i = 1至LEN(strTemp) strChar = MID(strTemp,I,1) intAsc = Asc(strChar) 如果(intAsc> = 48且intAsc <= 57)或(intAsc> = 97且intAsc <= 122)或(intAsc> = 65并且intAsc <= 90)然后 strOut = strOut&strChar Else 斯特劳特=斯特劳特& “%” &十六进制(intAsc) 结束如果 接着 的URLEncode =斯特劳特 端功能 请问这个SOLV我的问题? – Seshan 2009-09-10 17:30:57