curl-library
How to get a Soap reply message in http replay package
Date: Tue, 9 Oct 2007 16:51:10 +0800
hi,guys:
I am a fresh guy and first to use the curl lib to develope a samll
program that send/receive soap messages on http. However, i have a little
confuse how to get a soap replay message after invloving curl_peform
fucntion. Following is the souce code to send a SOAP request envelop to web
service and i want get the SOAP response content from the HTTP return
package. how to do? Thanks
/*
URL is the destination of web service provider
message is the soap envelop message contains the request info
*/
void sendRequest(const char* url, char* message)
{
Init the curl handle.....
CURLcode ret = CURLE_OK;
if (easyHandle != NULL)
{
/*output the debug info*/
curl_easy_setopt(easyHandle,CURLOPT_VERBOSE,1);
/*tell CURL the destination*/
curl_easy_setopt(easyHandle,CURLOPT_URL,url);
/*using the POST model to send data*/
curl_easy_setopt(easyHandle,CURLOPT_POST,1);
/*tell CURL what message will be sent*/
curl_easy_setopt(easyHandle,CURLOPT_POSTFIELDS,message);
/*post message*/
ret = curl_easy_perform(easyHandle);
if (ret != CURLE_OK) //get error info
fprintf(stdout, "CURL send message is failed: %d\n",
curl_easy_strerror(ret));
}
else
fprintf(stdout, "CURL handle is not initialized!\n");
free the curl handle....
}
-- 我的私人邮件箱 MSN:small_hammer_at_hotmail.com Cell:13817045204Received on 2007-10-09