4

I am working with a native C client application (not built with Visual Studio) that needs to call a WCF service. I am creating the WCF service, so I have complete control of it.

Most of the information I have found deal with calling WCF from unmanaged C++ clients.

Has anyone tried WWSAPI?

I am hoping to get some direction on whether this is even possible and what technologies can be used. Any help would be greatly appreciated!

Edward Leno
  • 6,257
  • 3
  • 33
  • 49
  • Can you use a JSON/REST binding with your WCF service? – Simon Mourier Feb 09 '12 at 18:15
  • If the C client is going to be the only client of the service, and you are not going to use any WCF libraries on the client side, maybe you don't want to be creating a WCF service at all? – antlersoft Feb 09 '12 at 18:18
  • @Simon Mourier : I can use any binding ... I am newish to WCF, so would using a JSON/REST binding help? – Edward Leno Feb 09 '12 at 18:19
  • @mekici : All is in Windows and I can have requirements for Windows 7 and above if necessary to get this to work. – Edward Leno Feb 09 '12 at 18:19

2 Answers2

3

you can use gSOAP is a technology that allows you to create stubs for client and server side code from WSDLs. Here is step by step tuttorial and that one for windows

Mustafa Ekici
  • 7,263
  • 9
  • 55
  • 75
2

WCF is very powerful and configurable and allows to use many different bindings (HTTP, Sockets, MSMQ, custom, etc.). Starting from version 3.5 I belive, you can use a JSON/REST bindings and contracts. Here is an official link about this: Overview of REST in WCF, and some samples here: WCF 4 JSON REST Service and here: REST Service with WCF and JSON.

Now, why REST and JSON? because these prococols are very lightweight and do not need huge dependencies or libraries. That was in fact the whole point of REST, as opposed to SOAP.

So, with these, you only need a TCP/HTTP stack and a JSON parser on the client-side wich makes it relatively easy to program in C. Here is a link to a simple JSON library: Jansson

Simon Mourier
  • 132,049
  • 21
  • 248
  • 298
  • My apologies (noob), but I don't understand what the 'TCP/HTTP stack' is? I have control over the WCF bindings and can change that, but how do I connect Jansson to the TCP/HTTP stack? – Edward Leno Feb 09 '12 at 20:48
  • @EdwardLeno - The HTTP stack is a small library that allows C clients to connect to HTTP server. TCP is implied by HTTP. See here on SO for more: http://stackoverflow.com/questions/3243209/http-stack-in-c – Simon Mourier Feb 10 '12 at 09:34
  • I tried a few clients but was unable to get them to work with my situation. I was interested in cURL, and will likely use it for some other projects. Thanks. BTW, I went with gSOAP, which is working. – Edward Leno Feb 23 '12 at 00:48