2012-01-24 4 views
0

Я не видел никакой документации для вызова XML-RPC путем ввода определенных строк и получения ответа на некоторые строки в C++ путем подключения к XML API. Это документация, предоставляемая сервером. Я не могу понять, как это сделатьC++ XML-RPC Calling

A client can interact with a Pandorabot by POST'ing to: 

    http://www.pandorabots.com/pandora/talk-xml 
    The form variables the client needs to POST are: 

    botid - see H.1 above. 
    input - what you want said to the bot. 
    custid - an ID to track the conversation with a particular customer. This variable is optional. If you don't send a value Pandorabots will return a custid attribute value in the <result> element of the returned XML. Use this in subsequent POST's to continue a conversation. 
    This will give a text/xml response. For example: 

    <result status="0" botid="c49b63239e34d1d5" custid="d2228e2eee12d255"> 
     <input>hello</input> 
     <that>Hi there!</that> 
    </result> 

    The <input> and <that> elements are named after the corresponding AIML elements for bot 
input and last response. 
If there is an error, status will be non-zero and there will be a human readable <message> element included describing the error. 

For example: 
    <result status="1" custid="d2228e2eee12d255"> 
     <input>hello</input> 
     <message>Missing botid</message> 
    </result> 
+0

Это не похоже на фактический [XML-RPC] (http://en.wikipedia.org/wiki/XML-RPC) протокол для меня. –

ответ

0

Самым простым способ общения через HTTP в C++ является использование библиотеки, предназначенной для этой цели. Например, libcurl предоставляет все возможности, необходимые для отправки и получения запросов и ответов, которые вы указали в вопросе.

+0

cURL для C++ не предоставляет никакой документации. Можете ли вы рассказать, как это сделать? –

+0

Все документы libcurl можно найти на странице [API] (http://curl.haxx.se/libcurl/c/). Вы будете использовать интерфейс C (который также может использоваться на C++). Используйте «Легкий интерфейс», как описано там. –

+0

Я не вижу, как установить строки (для переменных, таких как botid custid) и запросить ответ –