Click here to Skip to main content
15,894,825 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I'm using the below code to call the wcf method without adding service reference. With this code the methods are getting called but I'm not able to get the passed parameter values in the wcf method. Please help me how to resolve the issue.
C#
BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.None);
IChannelFactory<irequestchannel> factory = binding.BuildChannelFactory<irequestchannel>(new BindingParameterCollection());
factory.Open();

EndpointAddress address = 
    new EndpointAddress("http://localhost:2193/Service1.svc");
IRequestChannel irc = factory.CreateChannel(address);
using (irc as IDisposable)
{
    irc.Open();
    
    XmlReader reader = XmlReader.Create(new StringReader(
@"<getdatausingdatacontract xmlns="http://tempuri.org/">
<composite xmlns:a="http://schemas.datacontract.org/2004/07/">
xmlns:i='http://www.w3.org/2001/XMLSchema-instance'>
<a:boolvalue>true</a:boolvalue>
<a:stringvalue>test values</a:stringvalue>
</composite>
</getdatausingdatacontract>"));
    Message m = Message.CreateMessage(MessageVersion.Soap11,
        "http://tempuri.org/IService/GetDataUsingDataContract", reader);
    
    Message ret = irc.Request(m);
    reader.Close();
    
    Console.WriteLine(ret);    
}

//close the factory
factory.Close();

Thanks in advance.
Regards
Seema
Posted
Updated 6-Sep-12 21:46pm
v2

1 solution

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