Debt Consolidation - Kamala Harris - Find jobs - Deaf Topics - Wordpress Themes

PDA

View Full Version : ASP call Web Service


Bloody Mary
Nov 3rd 2005, 11:43 pm
I would like to use ASP to call a web service to get and pass the information to a java based system, the web service is provided by the java system.

What setting should I implement to my web server (IIS)?
How can I call the web service using ASP?

Could you please tell me more details, since I have no idea of web service?

Thanks^^

MarkusJ_NZ
Feb 22nd 2007, 2:11 pm
This calls a webservice twice from an ASP page



Dim JobID
Response.Write(StartJob & "<br>")
Response.Write(EndJob & "<br>")

function StartJob()
Dim xmlDOC
Dim HTTP
Set HTTP = CreateObject("MSXML2.XMLHTTP")
Set xmlDOC =CreateObject("MSXML.DOMDocument")
xmlDOC.Async=False
HTTP.Open "GET","http://webserver/MyService.asmx/StartJob?jobDescription=Request sent at:" & Now & "&recordCount=100", False
HTTP.Send()
xmlDOC.load(HTTP.responseXML)
JobID = ParseRootNode(xmlDOC)
set HTTP = nothing
set xmlDoc = nothing
StartJob = JobID
end Function

function EndJob()
Dim endResponse
Dim xmlDOC
Dim bOK
Dim HTTP
Set HTTP = CreateObject("MSXML2.XMLHTTP")
Set xmlDOC =CreateObject("MSXML.DOMDocument")
xmlDOC.Async=False
HTTP.Open "GET","http://webserver/MyService.asmx/JobEnd?jobID=" & JobID, False
HTTP.Send()
xmlDOC.load(HTTP.responseXML)
endResponse = ParseRootNode(xmlDOC)
set HTTP = nothing
set xmlDoc = nothing
EndJob = endResponse
end Function


' Used to extract the elements from the returned XMLDOC.
' For this code there should always only be one element
' returned from the webservice; Any more and the code will
' need to be changed
function ParseRootNode(xmlDoc)
Dim x
Dim returnValue
for each x in xmlDoc.documentElement.childNodes
returnValue = x.text
next
ParseRootNode = returnValue
end function