I'm trying to use libcurl to do a SOAP http post to a web service. I have the SOAP requests already formed in XML files which I generate. Now I need to transefer these XML files to the webservice. N.B. I'm pretty new to writing webservices (especially in C).
Is there a way do send the SOAP requests straight from the XML file using libcurl? Or do I have to read the contents into a string? I'm restricted to using the C programming language to complete the task.
I've been looking through documentation and different code snippets but I can't seem to开发者_运维百科 locate anything to do the requested. This curl link does it through a string http://curl.haxx.se/libcurl/c/post-callback.html). FOr speed purposes I would greatly prefer to not have to pass to a string before sending it.
you use curl_easy_setopt()? then you may want to take a look at CURLOP_WRITEFUNCTION and CURLOPT_WRITEDATA.
The way I do this:
* Get TinyXML, load the file into a TiXmlDocument
and use the TiXmlPrinter
to get the XML file as string
* Set the value of the string in the body of the post request( also, set headers, but they are the same as HTTP standard headers)
* Take a look at curl_easy_setopt() for callback and other stuff (:
Good Luck (:
精彩评论