2011-09-12 3 views
0

웹 서비스에 SOAP 요청을 보내고 어떤 응답을 받았는지 확인하고 싶습니다. 이것을 달성하는 방법?libcurl을 사용하여 SOAP 응답을 확인하는 방법

내 코드는 다음과 같습니다

#include <stdio.h> 
#include <curl/curl.h> 

int main(void) 
{ 
    CURL *curl; 
    CURLcode res; 


const char *temp = "<?xml version=\"1.0\" encoding=\"utf-8\"?> <S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"xmlns:tns=\"http://ThermodynamicProperties/\"><S:Body> <tns:getSpeciesInformation> <speciesSymbol>CO2</speciesSymbol> <phase>GAS</phase> </tns:getSpeciesInformation> </S:Body> </S:Envelope>"; 

printf("%s",temp); 

curl = curl_easy_init(); 
    if(curl) { 
    /* First set the URL that is about to receive our POST. This URL can 
     just as well be a https:// URL if that is what should receive the 
     data. */ 
    curl_easy_setopt(curl, CURLOPT_URL, "http://thermo.sdsu.edu/servlet/ThermodynamicProperties/ThermodynamicPropertiesService"); 
    /* Now specify the POST data */ 
    curl_easy_setopt(curl, CURLOPT_POSTFIELDS, temp); 

    printf("OK \n"); 

    /* Perform the request, res will get the return code */ 
    res = curl_easy_perform(curl); 

     /* always cleanup */ 
    curl_easy_cleanup(curl); 
    } 
    return 0; 
} 

는 지금 내가 무엇입니까 응답은 다음과 같습니다

보내기 요청. 응답을 읽는 중입니다. 수신 된 123 바이트.

내가받는 것을 인쇄하는 방법 ??

답변

0

응답을 전달하는 콜백 함수를 사용할 수 있습니다. example here을 찾을 수 있습니다.

관련 문제