Wednesday, February 13, 2008

Calling .net web service through HTTP Post

Below are the steps how you would call a web service from .net code through HTTP POST -

Dim oXmlhttpCaller as Object;

' Create Object of MSXml2.XMLHTTP
Set oXmlhttpCaller = Server.CreateObject("Msxml2.XMLHTTP")

'oXmlhttpCaller.open "GET","http://localhost/HelloWorld/Service.asmx/HelloWorldWit'hCustomMessage?s_msg= Hope you like this article.", False

oXmlhttpCaller.open "POST","http://localhost/HelloWorld/Service.asmx/
HelloWorldWithCustomMessage", False

oXmlhttpCaller.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
oXmlhttpCaller.send("Msg= Hello World!")

HTH, in my next post i wiill try and show how to send XML message as part of your input paramter. Thanks - Dj

No comments: