开发者

How to call a WCF Windows service as a raw TCP request

I've got a problem. I've been googling and I can't figure out what to do so any help would very much be appreciated. Basically I have a Windows Wcf service on the App Tier (which doesnt and wont ever have IIS installed on it)开发者_JAVA百科. As part of security testing, I need to send a manually created TCP request to a Wcf service. The Windows service ONLY has a NetTcpBinding and nothing else. My solution needs to create a TCP request as part of a SOAP message, send it to the Wcf service and get the response back. I have no problems when using the Wcf Test Client so I know the Wcf service works. Could somebody please help??

From what I gather after reading around the msdn website etc.... I need to use sockets and create a SOAP request, but all the examples focus around a wsHttpBinding when mine has to be a netTcpBinding.

Thanks


Check out this link: Build raw soap messages

You can build un-typed messages and send the over the wire.

Cheers,

Gilad


Based on your comments, I think it's as simple as using a ChannelFactory with a NetTcpBinding. So something like this:

NetTcpBinding binding = new NetTcpBinding();
EndpointAddress address = new EndpointAddress("Your URI");

ChannelFactory<IContract> factory = new ChannelFactory<IContract>(binding, address);
IContract channel = factory.CreateChannel();

channel.YourOperation();

((ICommunicationObject)channel).Close();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜