Sharad

Sharad

  • NA
  • 846
  • 130.1k

Accessing WCF Service Without Creating Proxy with Contract

Feb 1 2016 11:00 AM

I am facing some issue while passing the data contract values to WCF service without adding a service reference.

WSHttpBinding binding = new WSHttpBinding();
EndpointAddress adress = new EndpointAddress ("http://localhost:8734/BankVerification.svc");  
ChannelFactory<IBankVerification> factory = new ChannelFactory<IBankVerification>(binding, adress);  
IBankVerification channel = factory.CreateChannel();  
var response = await channel.CallBankVerificationSoapService(message);

Here

  1. CallBankVerificationSoapService is the method in my service
  2. IBankVerification is the service contract name.

Every thing is fine if I don't pass any parameter to my service. I am able to call the service.

BUT when I invoke channel.CallBankVerificationSoapService(message);

And I have properties value coming in "message" object but it is not reaching to my invoked WCF service. The receiving object value becomes Null there. I have added [DataContract], [DataMember] Attribute all the required places.

Am I missing something...?

For example : DJ sir wrote some article a long back, BUT in their example he is passing some integer value, I have to pass a DataContract in req and in Response.

http://www.c-sharpcorner.com/UploadFile/dhananjaycoder/accessing-wcf-service-without-creating-proxy/


Answers (1)