473,386 Members | 1,820 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Web Request

Hi,

I am trying to write a class to interface with a payment gateway (via an XML
string). I have managed to get this to work using the VB6 version of code,
but would rather like to use the .net webrequest/response techniques.

The VB6 style code I am using that works is as follows:

Dim xbroker As New MSXML2.ServerXMLHTTP

xbroker.open("POST", "http://127.0.0.1:5001/", False)
xbroker.send(stXML)
MsgBox(xbroker.responseText)

.............

The VB.NET code that is currently coming back with "(100) Timeout reading
from socket" is as follows:

Dim req As WebRequest
Dim rsp As WebResponse
Dim stResult As String

req = WebRequest.Create("http://127.0.0.1:5001/")
req.Method = "POST"
req.ContentType = "text/xml"

rsp = req.GetResponse

reader = New StreamReader(rsp.GetResponseStream)

MsgBox(reader.ReadToEnd)

reader = Nothing

If Not rsp Is Nothing Then rsp.GetResponseStream.Close()
..............................

Any ideas please?

Thanks in anticipation,

Carl
Nov 18 '05 #1
1 1092
Carl Howarth wrote:
Hi,

I am trying to write a class to interface with a payment gateway (via
an XML string). I have managed to get this to work using the VB6
version of code, but would rather like to use the .net
webrequest/response techniques.

The VB6 style code I am using that works is as follows:

Dim xbroker As New MSXML2.ServerXMLHTTP

xbroker.open("POST", "http://127.0.0.1:5001/", False)
xbroker.send(stXML)
MsgBox(xbroker.responseText)

............

The VB.NET code that is currently coming back with "(100) Timeout
reading from socket" is as follows:

Dim req As WebRequest
Dim rsp As WebResponse
Dim stResult As String

req = WebRequest.Create("http://127.0.0.1:5001/")
req.Method = "POST"
req.ContentType = "text/xml"

rsp = req.GetResponse

reader = New StreamReader(rsp.GetResponseStream)

MsgBox(reader.ReadToEnd)

reader = Nothing

If Not rsp Is Nothing Then rsp.GetResponseStream.Close()
.............................

Any ideas please?


You don't send anything. The web server waits forever to get the HTTP
request's body, but there's none. You must write your payload (e.g. XML
string) to the request stream.

Cheers,
--
Joerg Jooss
jo*********@gmx.net

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Jack | last post by:
Hi, I am trying to get a thorough understanding of a code where a addition or deletion of records can be done from a list of records. For addition part of the form, data is being obtained from set...
4
by: SP | last post by:
Hi I have a problem with a customer's XML being submitting to me in a non-well-format XML. They said that there are 18 other partners who has been able to tweak the XML to make it work. So I...
7
by: Shapiro | last post by:
I have a scenario where I log a resquest to a database table and update the request with a corresponding response including the response time. I am using an HttpModule to do this. My challenge...
4
by: Nalaka | last post by:
Hi, I have some request specific data that gets created in a "early event", that I need to pass around to many other events. I need access to this data during that request. (and more importantly...
5
by: dougwig | last post by:
I'm trying to handle the scenario where a user's session times out and and their ajax request triggers a redirection by the webserver (302 error?). I'm using Prototype 1.4 and the my works great...
4
by: Michael Kujawa | last post by:
I am using the following to create an SQL statement using the names and values from request.form. The loop goes through each item in request.form The issue comes in having an additional "and" at...
6
by: santhoskumara | last post by:
How to request to servlet from Ajax and also I got the DOM object in the servlet through Business Logic. Now how will i pass the DOM object from serlvet to Clientside. Where in the client Side i am...
2
by: MDANH2002 | last post by:
Hi From VB.NET I want to simulate the POST request of the following HTML form <html> <title>HTTP Post Testing</title> <body> <form action=http://www.example.com/postdata ...
5
by: chromis | last post by:
Hi there, I've recently been updating a site to use locking on application level variables, and I am trying to use a commonly used method which copies the application struct into the request...
3
by: Joseph Geretz | last post by:
I'm using the Request Filter documentation which can be found here: http://msdn.microsoft.com/en-us/library/system.web.httprequest.filter.aspx In this example, two filters are installed, one...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.