【问题标题】:XMPP: Ejabberd not forwarding custom IQ with namespace prefix to userXMPP:Ejabberd 未将具有命名空间前缀的自定义 IQ 转发给用户
【发布时间】:2013-09-11 12:52:11
【问题描述】:

我必须使用我自己的命名空间 http://www.test.com/testeva@pc377/Smack 向特定用户 bob@pc377/Smack 发送自定义 IQ。当我使用 OpenFire 时一切正常,但 Ejabberd 不会将此 IQ 转发给用户。在我看到的日志文件中,IQ 由服务器接收,内部分派给会话管理器,但未转发给用户。如果我发送Message,它会被正确转发。我正在使用基于 Java 的 Smack-Client。

Ejabberd 是否需要特定配置来转发自定义 IQ?

    =INFO REPORT==== 2013-09-11 13:55:36 ===
    D(<0.658.0>:ejabberd_receiver:320) : Received XML on stream = 
    "<iq id=\"0j8w6-8\" to=\"bob@pc377/Smack\" type=\"set\">
        <ts:register-request xmlns:ts=\"http://www.test.com/test\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">
           <ts:node-id>550e8400-e29b-11d4-a716-446655440000</ts:node-id>
           <ts:properties>
              <ts:path>.</ts:path>
              <ts:delivery-mode>1</ts:delivery-mode>
           </ts:properties>
       </ts:register-request>
    </iq>"


    =INFO REPORT==== 2013-09-11 13:55:36 ===
    D(<0.659.0>:ejabberd_router:313) : route
from {jid,"eva","pc377","Smack","eva","pc377","Smack"}
to {jid,"bob","pc377","Smack","bob","pc377","Smack"}
packet {xmlelement,"iq",
               [{"id","0j8w6-8"},
                {"to","bob@pc377/Smack"},
                {"type","set"}],
               [{xmlelement,"ts:register-request",
                    [{"xmlns:ts","http://www.test.com/test"},
                     {"xmlns:xs","http://www.w3.org/2001/XMLSchema"},
                     {"xmlns:xsi",
                      "http://www.w3.org/2001/XMLSchema-instance"}],
                    [{xmlelement,"ts:node-id",[],
                         [{xmlcdata,
                              <<"550e8400-e29b-11d4-a716-446655440000">>}]},
                     {xmlelement,"ts:properties",[],
                         [{xmlelement,"ts:path",[],[{xmlcdata,<<".">>}]},
                          {xmlelement,"ts:delivery-mode",[],
                              [{xmlcdata,<<"1">>}]}]}]}]}


    =INFO REPORT==== 2013-09-11 13:55:36 ===
    D(<0.659.0>:ejabberd_local:300) : local route
from {jid,"eva","pc377","Smack","eva","pc377","Smack"}
to {jid,"bob","pc377","Smack","bob","pc377","Smack"}
packet {xmlelement,"iq",
                       [{"id","0j8w6-8"},{"to",[...]},{[...],...}],
                       [{xmlelement,[...],...}]}


    =INFO REPORT==== 2013-09-11 13:55:36 ===
    D(<0.659.0>:ejabberd_sm:411) : session manager
from {jid,"eva","pc377","Smack","eva","pc377","Smack"}
to {jid,"bob","pc377","Smack","bob","pc377","Smack"}
packet {xmlelement,"iq",
                       [{"id","0j8w6-8"},{"to",[...]},{[...],...}],
                       [{xmlelement,[...],...}]}


    =INFO REPORT==== 2013-09-11 13:55:36 ===
    D(<0.659.0>:ejabberd_sm:510) : sending to process <0.656.0>

【问题讨论】:

    标签: xmpp ejabberd


    【解决方案1】:

    用更简单的 XML 试试:

    <iq id="0j8w6-8" to="bob@pc377/Smack" type="set">
        <register-request xmlns="http://www.test.com/test">
           <node-id>550e8400-e29b-11d4-a716-446655440000</node-id>
           <properties>
              <path>.</path>
              <delivery-mode>1</delivery-mode>
           </properties>
       </register-request>
    </iq>
    

    如果这不起作用,请尝试重命名 register-requestdelivery-mode 以删除破折号。这些更改都不是必需的,但任何一个都可以帮助 ejabberd 团队找到错误。

    【讨论】:

    • 好建议...我试过了,智商转发!经过一些测试,在我看来 ejabberd 无法处理 XML 中的命名空间前缀。
    • 我已经提交了一个错误报告。可以在这里找到:support.process-one.net/i#browse/EJAB-1661
    猜你喜欢
    • 2016-07-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-16
    相关资源
    最近更新 更多