Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
|
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 26th, 2007, 06:56 AM
Authorized User
 
Join Date: Jan 2006
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default invoke webmethod using System.Net.WebRequest

Hi,
I have a webmethod public string ReceiveRequestMessage(string RequestXML). It takes request and sends response. I need to call this webmethod from webapplication using System.Net.WebRequest to get the response.

please give me the solution for task...

Thanks in advance,

veeruu

 
Old November 26th, 2007, 10:28 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Stupid question: If this is a .NET to .NET interaction, why not just set up a web reference and let .NET handle all the request/response plumbing?

-Peter
 
Old November 27th, 2007, 12:47 AM
Authorized User
 
Join Date: Jan 2006
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello Peter,
Thanks for the reply,i have implemeted the following functionality for WebApplication. And in the same way im looking to implement for a Webservice, but how to call webmethod.

Sample Code of WebApp :

             WebRequest req = null;
             string uri = "http://localhost/webApp/webpage.aspx";
                req = WebRequest.Create(uri);
                req.Method = "POST"; [t
                req.ContentType = "text/xml";

                using (StreamWriter writer = new StreamWriter(req.GetRequestStream()))
                {
                    writer.WriteLine(request);
                }


                 WebResponse response = req.GetResponse();





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to invoke the dll in ASP.NET 2.0 kanmani .NET Framework 2.0 0 January 15th, 2007 11:34 PM
Return datatable from a webmethod josemanjusha ASP.NET 2.0 Basics 0 September 21st, 2006 07:52 AM
how to programmatically invoke MMC in asp.net? s3ng ASP.NET 1.x and 2.0 Application Design 0 June 22nd, 2005 02:09 AM
Webrequest ?? Any equiv. for xmlhttppost in .net?? rajeevcv ASP.NET 1.0 and 1.1 Professional 0 May 3rd, 2004 01:00 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.