Xmpp扩展协议Xep-0055的工作方式

正在开发的通信工具是基于Qxmpp库的,但Qxmpp没有实现搜索服务器上注册用户的功能,即xep-0055协议(http://xmpp.org/extensions/xep-0055.html)。
于是参照xep-0055协议文档来尝试实现搜索功能。可是按照对协议文档的理解和实现,在和openfire通信中一直无法得到搜索结果。
于是抓了Spark和Openfire进行搜索是的Xml信息,已得到了正确的搜索申请报文格式。
以下是完成一次搜索的报文:
spark发送:

<iq
   id="ouA83-31"
   to="search.192.168.30.223"
   type="get" >
   <query
xmlns="jabber:iq:search">
   </query>

openfire返回:

<iq
   id="ouA83-31"
   from="search.192.168.30.223"
   to="aaa@192.168.30.223/Spark 2.6.3"
   type="result" >

   <query xmlns="jabber:iq:search" >
   <instructions>
The following fields are available for searching. Wildcard (*) characters are allowed as part of the query.
   </instructions>
   <first />
   <last />
   <nick />
   <email />
   <x
   type="form"
   xmlns="jabber:x:data" >
   <title>
Advanced User Search
   </title>
   <instructions>
The following fields are available for searching. Wildcard (*) characters are allowed as part of the query.
   </instructions>
   <field
   type="hidden"
   var="FORM_TYPE" >
   <value>
jabber:iq:search
   </value>
   </field>
   <field
   label="Search"
   type="text-single"
   var="search" >
   <required />
   </field>
   <field
   label="Username"
   type="boolean"
   var="Username" >
   <value>
1
   </value>
   </field>
   <field
   label="Name"
   type="boolean"
   var="Name" >
   <value>
1
   </value>
   </field>
   <field
   label="Email"
   type="boolean"
   var="Email" >
   <value>
1
   </value>
   </field>
   </x>
   </query>

</iq>

Spark发送,搜索“bbb”用户:

<iq
   id="ouA83-35"
   to="search.192.168.30.223"
   type="set" >

   <query xmlns="jabber:iq:search" >
   <x
   type="submit"
   xmlns="jabber:x:data" >
   <field
   type="hidden"
   var="FORM_TYPE" >
   <value>
   jabber:iq:search
   </value>
   </field>
   <field
   type="text-single"
   var="search" >
   <value>
   bbb
   </value>
   </field>
   <field
   type="boolean"
   var="Username" >
   <value>
   1
   </value>
   </field>
   <field
   type="boolean"
   var="Name" >
   <value>
   1
   </value>
   </field>
   <field
   type="boolean"
   var="Email" >
   <value>
   1
   </value>
   </field>
   </x>
   </query>

</iq>

openfire返回结果:

<iq
   id="ouA83-35"
   from="search.192.168.30.223"
   to="aaa@192.168.30.223/Spark 2.6.3"
   type="result" >

   <query xmlns="jabber:iq:search" >
   <x
   type="result"
   xmlns="jabber:x:data" >
   <field
   type="hidden"
   var="FORM_TYPE" />

   <reported>
   <field
   label="JID"
   type="jid-single"
   var="jid" />
   <field
   label="Username"
   type="text-single"
   var="Username" />
   <field
   label="Name"
   type="text-single"
   var="Name" />
   <field
   label="Email"
   type="text-single"
   var="Email" />
   </reported>

   <item>
   <field var="Name" >
   <value>
   bbb
   </value>
   </field>
   <field var="Email" >
   <value>
   </value>
   </field>
   <field var="Username" >
   <value>
   bbb
   </value>
   </field>
   <field var="jid" >
   <value>
   bbb@192.168.30.223
   </value>
   </field>
   </item>
   </x>
   </query>

</iq>