Click here to Skip to main content
15,073,507 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
can any one tell me how to call webservice using C language through linux ?

i have no idea about that

i only know how to write soap request to web service
elgaabeb 15-Nov-11 5:21am
Could you give us more informations about the type of the web-service you want to consume ?
( soap , xml-rpc ... )
amertarekt 16-Nov-11 5:55am
i want to access webservice that has wrote using c# .net 2008
through a pure c code

this code i want to run over a handheld machine that has library to send tcp packets , write something on its screen and so on

You will need to use socket programming to connect to the service, and construct your own HTTP request response handler to manage the protocol. I have done this myself in the past from Windows/Solaris to Solaris/Linux, so I know it is a feasible idea. Use Google to find resources on both these subjects.
amertarekt 16-Nov-11 5:50am
can you send me a very simple code to make a soap client on a machine that use linux as operating system to a .net c# web service?
Richard MacCutchan 16-Nov-11 6:02am
I think you misunderstood my answer. When I said I had done it in the past, I did not mean I have the code to hand. I have given you some suggestions to investigate and write for yourself. There are plenty of samples you can find via Google that will help you get started.

amertarekt 17-Nov-11 4:32am
i found the post samples that is used to call webservice
it appears too in the page of the webservice functions page when i run it in below if the html opened page

but my question is how to send this post over tcp port

will i send it to port 80 as it is the default html port or to the port of the webservice that appears in its link?

and how i convert it to bytes to send over tcp"?

i can not find solution for this
Richard MacCutchan 17-Nov-11 4:41am
Yes send it to port 80 if that is where the service expects to receive web requests. What do you mean "how I convert it to bytes"? The HTTP request string is already bytes.
amertarekt 8-Dec-11 1:52am

so i have xml data

can you give me a string for HTTP POST with this XML data?
Richard MacCutchan 8-Dec-11 3:45am
Here is a good reference on HTTP; there are many others to be found. You really need to get used to using Google for simple research (which is what I just did).
amertarekt 11-Dec-11 8:50am
i found an example for HTTP POST i will try to convert it into string and send it to tcp and show you what is the result
If you use the VS IDE, just add Web Refrence , VS will create the proxy for you
amertarekt 16-Nov-11 5:51am
i use pure c to connect to the webservice

i tried gsoap library but i lost my mind before can using it
You can always use a library for this, off the top of my head, I know gSOAP[^]. The library makes the interfacing into C/C++ relatively simple (but please, read all the documentation FIRST!).
amertarekt 16-Nov-11 5:52am
i did this

and i made a program in pure c using visual studio 6 that connect to my webservice and access function on it '

it works and return good result '

but , do you think it will work on eclipse?
Albert Holguin 16-Nov-11 9:44am
Should work just as well, its just a library.
amertarekt 17-Nov-11 4:28am
i will try it adding to the machine library that i work on
it is a handheld machine work on linux with small library to access LCD , TCP .... and so on
but i think i will not use its TCP i will use this library and wait what will happen
Albert Holguin 17-Nov-11 13:59pm
First look at the documentation and make sure they're not dependent on any Windows specific libraries themselves.
Albert Holguin 17-Nov-11 14:04pm
Actually, just looked through their site and it looks like they do support Linux... primarily it looks like they support Debian (means it should work on Ubuntu, Mint, Knoppix, and any of the other Debian derived distros fine).
amertarekt 8-Dec-11 1:53am
thank you for your help

i tried it and it works well
Albert Holguin 8-Dec-11 10:24am
Great! :)

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