Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VB.Net Web Client and paramaters

Posted on 2013-06-06
9
Medium Priority
?
412 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Stack Overflow Podcast - Developer Story

Welcome to the Stack Overflow podcast recorded Thursday July 20 at Stack Overflow Headquearters in NYC. Your hosts today are podcast regulars Jay Hanlon, David Fullerton, and Ilana Yitzhaki, plus the quite irregular Matt Sherman (Stack Overflow Engineering Manager extraordinaire)

 
LVL 25

Accepted Solution

by:
kevp75 earned 2000 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

664 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