Click here to Skip to main content
15,891,777 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I need to consume WCF Services without using Web References and Svcutil(which provides wsdl class ).
I want to develope a programme in which users can type a url and the method-name and define its input and output parameter datatypes.
How can I consume WCF Services prgrammatically(or consume at runtime ) and not to use those ways(I mean Web References and svcutill).

any idea whoud be appreciated.
I wish I asked clearly.
sorry, english is not my first language.
Thanks in advance.
Posted

1 solution

You can't. You either need the service reference, or you need to use svcutil to generate the appropriate files for you. It sounds like you're trying to use a web service without permission from its owner.
 
Share this answer
 
Comments
Jamal Seyedi 6-Dec-10 10:14am    
I used to use below code to consume web services
string soap =
@"
<soap12:envelope xmlns:xsi="" http:="" www.w3.org="" 2001="" xmlschema-instance""="" xmlns:xsd="" xmlschema""="" xmlns:soap12="" 2003="" 05="" soap-envelope""="">
<soap12:body>
<sum xmlns="" http:="" tempuri.org="" ""="">
<p1>1000</p1>
<p2>4</p2>


";

HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://localhost/Calc-WebService/Service1.asmx");
req.ContentType = "text/xml;charset=\"utf-8\"";
req.Accept = "text/xml";
req.Method = "POST";

using (Stream stm = req.GetRequestStream())
{
using (StreamWriter stmw = new StreamWriter(stm))
{
stmw.Write(soap);
}
}

WebResponse response = req.GetResponse();
And now I need to call WCF Services like this or some thing like thsis
Quinton Viljoen 13-Jul-11 2:20am    
Hi, did you manage to resolve this? I have also been looking for a similair way to consume WCF and can't seem to do it either. Every solution even JavaScript solutions require the wsdl generated proxy :[

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900