Can someone help me sort this one out and quick?

B

Brent White

Greatly appreciated in advance.

I am constructing a web service in VB.NET and the primary function
works terrifically, no problems.

Now, I am trying to extend the functionality by having the web service
call a function, also VB.NET, that direct posts a form to an external
page. They are expecting name/value pairs in the request. The first
part of the VB.NET used an API call to the web server outside our
company. The form they are expecting is something along the lines of:

<!--Fixed Values-->
<FORM NAME="samplegettransactionstatus"
ACTION="https://developer.skipjackic.com/scripts/evolvcc.dll?
SJAPI_TransactionStatusReque
st" METHOD=POST>
<INPUT NAME="szSerialNumber" VALUE="123456789102">
<INPUT NAME="szDeveloperSerialNumber" VALUE="123456789102">
<!--Purchase Data-->
<INPUT NAME="szOrderNumber" VALUE="9999999999">

What I am doing is passing the serial number, developer serial number
and the order number to a function within the service1.asmx.vb code.
The code is written right now as follows:

Function GetTransactionStatus(ByVal OrderNumber As String, ByVal
HTMLSerial As String, ByVal Developserial As String, ByVal
WWW_OR_DEVELOPER As String) As String
Dim whrstat As System.Net.HttpWebRequest
whrstat = System.Net.WebRequest.Create("https://" &
WWW_OR_DEVELOPER & ".skipjackic.com/scripts/evolvcc.dll?
SJAPI_TransactionStatusRequest")
Dim sb2 As New StringBuilder()
'Return "Hi, this page is served by Brent White's own system
and can be looked at " & Input1.SecondParam & " times."
'Return Input1.SerialNumber
sb2.Append("szSerialNumber=" & UrlEncode(HTMLSerial) & "&")
'qString = qString & "SerialNumber=" &
HtmlEncode(Input1.SerialNumber) & "&"
'Return Input1.Dev_SerialNumber
sb2.Append("szDeveloperSerialNumber=" &
UrlEncode(Developserial) & "&")
sb2.Append("szOrderNumber=" & UrlEncode(OrderNumber))
Dim datastat
Dim datareqstat As Byte()
Dim encodingstat As New ASCIIEncoding
datastat = ""
'Return sb2.ToString
datareqstat = encodingstat.GetBytes(sb2.ToString)
whrstat.Headers("szSerialNumber") = HTMLSerial
whrstat.Headers("szDeveloperSerialNumber") = Developserial
whrstat.Headers("szOrderNumber") = OrderNumber
whrstat.Method = "POST"
'whrstat.ContentType = "application/x-www-form-urlencoded"
'whrstat.ContentLength = datareqstat.Length
Dim requeststreamstat As System.IO.Stream
requeststreamstat = whrstat.GetRequestStream()
'requeststream.Write(data, 0, datareq.ToString.Length)
requeststreamstat.Write(datareqstat, 0, datareqstat.Length)
requeststreamstat.Close()
'On Error Resume Next
'whr.send(qString)
Dim responsestreamstat As System.Net.HttpWebResponse
responsestreamstat = whrstat.GetResponse
'responsestream.GetResponseStream()
'starttime = DateTime.Now
Dim srstat As System.IO.StreamReader
srstat = New
System.IO.StreamReader(responsestreamstat.GetResponseStream)
Return srstat.ToString


End Function

I know I have something set wrong, but I can't make heads or tails of
what exactly I should be doing. When I run this, calling the function
with the requisite variables, VS2005 goes into a "running" state
forever. Only thing I can figure out, and let me know if I'm wrong,
is that it's not posting properly to the external web application and
never getting a response.

You guys have been great in helping me get a better grasp of VS.NET in
general, and I appreciate it, but I'm very pressed for time and need
to get some kind of code going ASAP. Searching the Internet is futile
because no matter what I enter for the search criteria, I get a ton of
irrelevant pages or no pages at all.

If it helps, this is VB.NET code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top