all groups > dotnet sdk > december 2004 >
You're in the

dotnet sdk

group:

.net framework equivalent to MSXML2.XMLHTTP40()


.net framework equivalent to MSXML2.XMLHTTP40() Dave H
12/15/2004 9:41:07 AM
dotnet sdk:
Hello all,

Novice to ASP.NET and am trying to access web service via xml. I declared a
request and DOC object one one using MSXML the other .net framework:

Dim objRequest As New MSXML2.XMLHTTP40()
Dim objXMLDoc As New XmlDocument()

What is the .net equivalent to the MSXML2.XMLHTTP40()?

Thanks,
Re: .net framework equivalent to MSXML2.XMLHTTP40() Buddy Ackerman
12/17/2004 11:54:52 PM
[quoted text, click to view]


[quoted text, click to view]
to POST a request (watch for wrapping in this message). This function will
return the resposne content as a string which you can load into an XMLDocument
object and parse, query via XPath, or transform using XSLT. If the web service
uses SOAP and has a WSDL there is nice capability in VS.NET (or even the free
Webmatrix tool) that will create a class for accessing the web service. BTW,
the params argument need to be in the format of that of a normal form POST
request (i.e. &field1=somevalue&field2=someothervalue&field3=...)



Public Function webFormPost(ByVal myUri As String, ByVal params As
String, ByRef errors As String) As String

Dim retString As String
Dim request As HttpWebRequest = CType(WebRequest.Create(myUri),
HttpWebRequest)
request.Method = "POST"
request.ContentLength = len(params)
request.ContentType = "application/x-www-form-urlencoded"

Dim writer As New StreamWriter(request.GetRequestStream())
Try
writer.write(params)
Catch e As Exception
errors = e.message
Finally
writer.Close()
End Try

Dim response As HttpWebResponse = request.GetResponse()
Dim strmReader As New StreamReader(response.getResponseStream())
retString = strmReader.ReadToEnd()
strmReader.close()
Return retString
AddThis Social Bookmark Button