473,386 Members | 1,668 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.

sample http webrequest using c#


Hi All,
I am looking for a sample c# program which
demonstrates how to create a webrequest(http) and send it
to a webservice (specified using port no.)
thank you
vipin

Nov 15 '05 #1
2 13279
Vipin,

You don't want to use the HttpWebRequest class when trying to connect to
a web service. Rather, you will want to add a "web reference" (by right
clicking on the references folder) in VS.NET. If you do not have VS.NET,
then you can use the WSDL.EXE tool to create a proxy to the exposed web
service (given that you provide the URL for it). You can find the
documentation for the WSDL.EXE tool at (watch for line wrap):

http://msdn.microsoft.com/library/de...oolWsdlexe.asp

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"vipin" <an*******@discussions.microsoft.com> wrote in message
news:08****************************@phx.gbl...

Hi All,
I am looking for a sample c# program which
demonstrates how to create a webrequest(http) and send it
to a webservice (specified using port no.)
thank you
vipin

Nov 15 '05 #2
thanks Nicholas, I installed .NET SDK and was able to
generate c# proxy with the wsdl.exe utility and
low is a relevant snippet in the wsdl generated .cs
file.Can you tell me how to write a c#
client that will call the below interface?, my c#
knowledge is bad.

[return: System.Xml.Serialization.SoapElementAttribute
("CallMeReturn")]
public CallMe1 CallMe
([System.Xml.Serialization.SoapElementAttribute
(DataType="base64Binary")] System.Byte[] param1, string
param2, string param3, int param4) {
object[] results = this.Invoke("CallMe", new object
[] {
param1,
param2,
param3,
param4});
return ((CallMe1)(results[0]));

thank you
vipin
-----Original Message-----
Vipin,

You don't want to use the HttpWebRequest class when trying to connect toa web service. Rather, you will want to add a "web reference" (by rightclicking on the references folder) in VS.NET. If you do not have VS.NET,then you can use the WSDL.EXE tool to create a proxy to the exposed webservice (given that you provide the URL for it). You can find thedocumentation for the WSDL.EXE tool at (watch for line wrap):
http://msdn.microsoft.com/library/default.asp? url=/library/en-
us/cptools/html/cpgrfWebServicesDescriptionLanguageToolWsdl
exe.asp
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"vipin" <an*******@discussions.microsoft.com> wrote in messagenews:08****************************@phx.gbl...

Hi All,
I am looking for a sample c# program which
demonstrates how to create a webrequest(http) and send it to a webservice (specified using port no.)
thank you
vipin

.

Nov 15 '05 #3

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

Similar topics

5
by: Ya Ya | last post by:
I am trying to download a web page using WebRequest. The problem is that this page uses cookies. In IE, I can view this page correctly (since I have the cookie) but when downloading using...
0
by: WIWA | last post by:
Hi, I want to login to a password protected website and fetch the content of the page behind. I have based my code on http://weblogs.asp.net/jdennany/archive/2005/04/23/403971.aspx. When I use...
1
by: Dan W. | last post by:
Does anyone have any experience with this problem. I am trying to post about 20 fields of information to another server using System.Net.WebClient.UploadData. This works fine for some servers but...
5
by: Tyler | last post by:
I am developing an application which will allow me to automatically sign into an external website. I can currently do a screen scrape using HTTPWEBREQUEST. However I want to just redirect to the...
2
by: kkb | last post by:
Hello! First, I'm sorry because of my english... I'll try to be understandable! I've got a strange problem using .NET 2003 C# and I haven't figured it out for a long time. I'm implementing an...
3
by: eSolTec, Inc. 501(c)(3) | last post by:
Thank you in advance for any and all assistance. I'm trying to create a call to a web page to validate and register software. The code I'm using is: Private Sub OK_Click(ByVal sender As...
3
by: Gina_Marano | last post by:
Hey All, I need to download 1 or more files from a secure or unsecure website folder using HTTP. Here is what I have so far: public void GetHTTPImages() { WebClient HTTPClient = new...
1
by: Shashank | last post by:
Hi all, I am a new member of this community. I am making a http request to a html file placed on a Apache server. On this page there is an embeded perl statement which requires reading ...
2
by: =?Utf-8?B?UGF1bA==?= | last post by:
I am using ASP.Net 2.0 and VB.Net (although C#is ok also). I want to create an object/method/function that will take a URL as an input parameter and then return all of the HTML in that page. I...
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.