2

您好我正在尝试使用为 openfire 安装的搜索插件。我正在使用代码发送 iq 请求,

  NSXMLElement *queryElement = [NSXMLElement elementWithName:@"query" xmlns:@"jabber:iq:search"];
  NSXMLElement *iqElement = [NSXMLElement elementWithName:@"iq"];
  [iqElement addAttributeWithName:@"type" stringValue:@"get"];
  [iqElement addAttributeWithName:@"from" stringValue:@"aravind@gotztools"];
  [iqElement addAttributeWithName:@"to" stringValue:@"gotztools"];
  [iqElement addAttributeWithName:@"id" stringValue:@"search1"];
  [iqElement addAttributeWithName:@"xml:lang" stringValue:@"en"];
  [iqElement addChild:queryElement];
  NSLog(@"%@",[iqElement stringValue] );
  [[self appDelegate].xmppStream sendElement:iqElement];

发送时,发送以下请求,

<iq type="get" from="aravind@gotztools" to="gotztools" id="search1" xml:lang="en">
  <query xmlns="jabber:iq:search"/>
</iq>

我收到一个错误,因为,

 <iq xmlns="jabber:client" type="error" id="search1" from="gotztools" to="aravind@gotztools/9bd01a04"><query xmlns="jabber:iq:search"/><error code="501" type="cancel"><feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></iq>

这有什么问题。请帮我解决这个问题。提前致谢..

4

1 回答 1

2

检查您的搜索插件是否在 openfire 管理员中启用。您正在尝试向 gotztools 发送请求。它只是一个域名。检查您的 openfire 管理控制台的服务器设置中的搜索服务设置中的搜索名称。向该名称发送请求以获得回复。希望这可以帮助你...

于 2012-03-29T05:07:35.943 回答