sample http webrequest using c#

  • Thread starter Thread starter vipin
  • Start date Start date
V

vipin

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
 
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/d...WebServicesDescriptionLanguageToolWsdlexe.asp

Hope this helps.
 
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 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):
url=/library/en-
us/cptools/html/cpgrfWebServicesDescriptionLanguageToolWsdl
exe.asp

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

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


.
 
Back
Top