ASP利用Post呼叫ASP.NET Web Service

03 May 2010 — Written by Sky Chang
#ASP

雖然 ASP已經十年了,但還是有很多地方會用到ASP

而要讓新舊並存,還是有一些方法,

例如透過Service的方式之類的。

而下面就是利用ASP傳一個Post去呼叫一個Service

( 這裡的Service是.NET建構出來的Web Service )

Dim xmlhttp
Dim DataToSend
DataToSend="name=Sanc&text=世界您好"
Dim postUrl
postUrl = "http://localhost/webservice/hello.asmx/helloWorld"
Set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "POST",postUrl,false
xmlhttp.setRequestHeader "Content-Type","application/x-www-form-urlencoded"
xmlhttp.send DataToSend

這樣就可以做最簡單的呼叫了~~

Sky & Study4.TW