简体   繁体   English

C ++ XML-RPC调用

[英]C++ XML-RPC Calling

I haven't seen any documentation for calling XML-RPC by inputing certain strings and get respone of some strings in c++ by connecting to an XML API. 我还没有看过任何有关通过输入某些字符串来调用XML-RPC以及通过连接到XML API来获得c ++中某些字符串的响应的文档。 This is a documentation provided by the server. 这是服务器提供的文档。 I can't figure out how to do this 我不知道该怎么做

    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>

The easiest way to communicate via HTTP in C++ is to use a library designed for that purpose. 在C ++中通过HTTP进行通信的最简单方法是使用为此目的而设计的库。 For example, libcurl provides all the facilities you would need to send and receive the kind of requests and responses you showed in the question. 例如, libcurl提供了发送和接收问题中显示的那种请求和响应所需的所有功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM