Freelancers Network
 
skill list top cap
Homepage
Join the Freelancer's Network
Update your details
Find a freelancer
Post a project
Find a project
Projects Archive
Post a job
Find a job
Jobs Archive
See Dan's Pages
See Andy's Pages
Link to this site
Resources
Join/Leave Forum
Forum Messages
+Additions+ Adverts
Advertising
Contact Us
Subscribe to our newsletter - enter your email address and hit return
Freelancers.net is owned and operated by Andy Stowell and Dan Winchester
skill list end cap
guru web hostcom

Find me again on Freelancers.net

FN-FORUM: Help converting MsXml4 call to asp.net 1.1 VB

date posted 10th May 2007 14:36

HI,

I've got the task of incorporating a South African payment gateway into an
ASP.NET V1.1 VB site. All is well apart from the examples they give are for
classic asp using an MsXml4 post. I was wondering if someone could take a
quick look at the way I'm doing it in .NET compared to how they specify it
in classic asp? The actual XML message being sent is ok as I display it when
it's sent so I can check it.

Their example:-

Dim xmlServerHttp
Dim xmlServerStatus
Dim XmlServerResponse

Set xmlServerHttp = Server.CreateObject("MsXml2.ServerXmlHTTP.4.0")

xmlServerHttp.open
"POST","https://www.vcs.co.za/vvonline/ccxmlauth.asp",False
xmlServerHttp.setRequestHeader
"Content-Type","application/x-www-form-urlencoded" xmlServerHttp.send
"xmlmessage=" & XmlDocument
xmlServerStatus = xmlServerHttp.status

if xmlServerStatus = "200" then
xmlServerResponse = xmlServerHttp.responseText
Response.Write (xmlServerResponse)
Else
Response.Appendtolog ".xmlServer status is " & xmlServerStatus
end if

set xmlServerHttp = nothing

My version (it returns a properly formatted XML response from their system
saying "message empty"):-

''''''''''''''
'Send Request
''''''''''''''
Dim HttpRequest As HttpWebRequest = CType(WebRequest.Create(URL),
HttpWebRequest)
HttpRequest.Method = "POST"

HttpRequest.KeepAlive = False
HttpRequest.ProtocolVersion = HttpVersion.Version10
HttpRequest.Method = "POST"

Dim PostBuffer As Byte() = Encoding.Default.GetBytes(XMLRequest)
HttpRequest.ContentLength = PostBuffer.Length
Dim PostDataStream As Stream = HttpRequest.GetRequestStream
PostDataStream.Write(PostBuffer, 0, PostBuffer.Length)
PostDataStream.Close()

''''''''''''''''''
'Receive Response
''''''''''''''''''
Dim WebResponse As HttpWebResponse
Dim ResponseStream As StreamReader
Dim VCSResponse As String
Try
WebResponse = CType(HttpRequest.GetResponse(),
HttpWebResponse)
ResponseStream = New
StreamReader(WebResponse.GetResponseStream)
VCSResponse = ResponseStream.ReadToEnd
WebResponse.Close
Catch ex As Exception
WebResponse.Close

End Try

I'm suspecting the encoding but don't get the option to change it to
URLEncoding.

Any help would be appreciated.

Craig




Messages by Day
May 31st 2007
May 30th 2007
May 29th 2007
May 28th 2007
May 27th 2007
May 26th 2007
May 25th 2007
May 24th 2007
May 23rd 2007
May 22nd 2007
May 21st 2007
May 20th 2007
May 19th 2007
May 18th 2007
May 17th 2007
May 16th 2007
May 15th 2007
May 14th 2007
May 13th 2007
May 12th 2007
May 11th 2007
May 10th 2007
May 9th 2007
May 8th 2007
May 7th 2007
May 6th 2007
May 5th 2007
May 4th 2007
May 3rd 2007
May 2nd 2007
May 1st 2007


Messages by Month
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007


Messages by Year
2008
2007
2006
2005
2004
2003
2002
2001
2000