Solved

VB.Net Web Client and paramaters

Posted on 2013-06-06
9
406 Views
Last Modified: 2013-06-10
My following snippett creates no errors


But I need to pass in a paramater "command" to the url.

How would I do that?

        Dim Client As New WebClient
        Using Client
            Dim reader As New StreamReader(Client.OpenRead("https://hostedconnect.m5net.com/bobl/bobl"), Encoding.UTF8, True)
            Dim line As String = reader.ReadLine()
            Do While line IsNot Nothing
                Debug.WriteLine(line)
                line = reader.ReadLine()
            Loop
        End Using

Open in new window

0
Comment
Question by:lrbrister
  • 4
  • 2
9 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39226685
How does that resource expect its parameters to be received? Via a POST? A GET? For the latter you might try appending a query string:

Dim reader As New StreamReader(Client.OpenRead("https://hostedconnect.m5net.com/bobl/bobl?command=commandValue"), Encoding.UTF8, True)

Open in new window


...For the former, you'll need to use a different method than OpenRead.
0
 

Author Comment

by:lrbrister
ID: 39226803
kaufmed
This is tied toa very difficult project I'm on

I need to POST XML to a url

I then need to get the response...and keep the connection OPEN because this url I'm posting to will send an unlimited stream of data back to me.
The POST comes back with a reply

A few seconds later another block of data will come back

And then as certain events take place in our system...
THEY will send additional data
0
 

Author Comment

by:lrbrister
ID: 39235329
Thanks
0
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 
LVL 25

Accepted Solution

by:
kevp75 earned 500 total points
ID: 39235357
Hello,
Yes, you will need to change the way you are accessing the service.  WebClient does not have enough features in it's classes and interfaces to do what you need, it's simply a (no offense intended) lazy-man's approach to making a simple GET request.

http://msdn.microsoft.com/en-us/library/vstudio/ba0z6a33(v=vs.100).aspx

http://stackoverflow.com/questions/14964766/posting-xml-to-web-service-in-net-c-sharp-and-recieving-response

Will show you how to do this.
0
 

Author Comment

by:lrbrister
ID: 39235412
kevp75
  Let me review what you posted.

And absolutely no offense taken.  I am NOT experienced in what I'm trying to do here. You guys are the experts.

And oh yeah...to get answers I am not above groveling :-)
0
 

Author Closing Comment

by:lrbrister
ID: 39235447
Thanks
0
 
LVL 25

Expert Comment

by:kevp75
ID: 39235537
:) Any time, glad I could help
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question