带有 "feature-not-implemented" 错误消息的 Smack 4.1 响应类型为 'set' 的自定义 IQ
Smack 4.1 response with an "feature-not-implemented" error message to an custom IQ with the type 'set'
如果我向应用程序发送类型为'result' 的XMPP 示例消息,一切都很好。但是,如果我将类型更改为 'set' 或 'get',应用程序会回复一条错误消息 "feature-not-implemented"。
这很奇怪,因为我遵循了生产者方面的教程。
详情:
我从这个页面试过了 http://www.igniterealtime.org/builds/smack/docs/latest/documentation/providers.html
示例 Custom IQProvider 示例.
我使用具有以下依赖项的 Gradle 2.9:
dependencies {
//xjc 'com.github.jaxb-xew-plugin:jaxb-xew-plugin:1.1'
compile 'org.codehaus.groovy:groovy-all:2.3.11'
compile "org.igniterealtime.smack:smack-java7:4.1.0"
// Optional for XMPPTCPConnection
compile "org.igniterealtime.smack:smack-tcp:4.1.0"
// Optional for XMPP-IM (RFC 6121) support (Roster, Threaded Chats, …)
compile "org.igniterealtime.smack:smack-im:4.1.0"
// Optional for XMPP extensions support
compile "org.igniterealtime.smack:smack-extensions:4.1.0"
testCompile group: 'junit', name: 'junit', version: '4.11'
}
我根据描述实现了 类 MyIQProvider 和 MyIQ 并注册了提供者:
ProviderManager.addIQProvider("myiq", "example:iq:foo", new MyIQProvider());
如果我将以下消息 (type='set') 发送到 Smack Java 应用程序:
<iq type='set' from='apfel_vie@jabber.de/colibriVtn' to='birne_vie@jabber.de/colibriVen'>
<myiq xmlns='example:iq:foo' token='secret'>
<user age='42'>John Doe</user>
<location>New York</location>
</myiq>
</iq>
然后 应用程序回复 :
<iq id='time_1' type='error' to='apfel_vie@jabber.de/colibriVtn' from='birne_vie@jabber.de/colibriVen'>
<error type='cancel'>
<feature-not-implemented xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</iq>
type='get' 导致相同的行为。
但如果我只将 type 更改为 'result':
<iq type='result' from='apfel_vie@jabber.de/colibriVtn' to='birne_vie@jabber.de/colibriVen' id='time_1'>
<myiq xmlns='example:iq:foo' token='secret'>
<user age='42'>John Doe</user>
<location>New York</location>
</myiq>
</iq>
Java Smack 应用程序不回复这样的错误消息。
我有什么办法add/change在type等于set的情况下应用程序不回复这个错误信息?
如果我向应用程序发送类型为'result' 的XMPP 示例消息,一切都很好。但是,如果我将类型更改为 'set' 或 'get',应用程序会回复一条错误消息 "feature-not-implemented"。 这很奇怪,因为我遵循了生产者方面的教程。
详情:
我从这个页面试过了 http://www.igniterealtime.org/builds/smack/docs/latest/documentation/providers.html 示例 Custom IQProvider 示例.
我使用具有以下依赖项的 Gradle 2.9:
dependencies {
//xjc 'com.github.jaxb-xew-plugin:jaxb-xew-plugin:1.1'
compile 'org.codehaus.groovy:groovy-all:2.3.11'
compile "org.igniterealtime.smack:smack-java7:4.1.0"
// Optional for XMPPTCPConnection
compile "org.igniterealtime.smack:smack-tcp:4.1.0"
// Optional for XMPP-IM (RFC 6121) support (Roster, Threaded Chats, …)
compile "org.igniterealtime.smack:smack-im:4.1.0"
// Optional for XMPP extensions support
compile "org.igniterealtime.smack:smack-extensions:4.1.0"
testCompile group: 'junit', name: 'junit', version: '4.11'
}
我根据描述实现了 类 MyIQProvider 和 MyIQ 并注册了提供者:
ProviderManager.addIQProvider("myiq", "example:iq:foo", new MyIQProvider());
如果我将以下消息 (type='set') 发送到 Smack Java 应用程序:
<iq type='set' from='apfel_vie@jabber.de/colibriVtn' to='birne_vie@jabber.de/colibriVen'>
<myiq xmlns='example:iq:foo' token='secret'>
<user age='42'>John Doe</user>
<location>New York</location>
</myiq>
</iq>
然后 应用程序回复 :
<iq id='time_1' type='error' to='apfel_vie@jabber.de/colibriVtn' from='birne_vie@jabber.de/colibriVen'>
<error type='cancel'>
<feature-not-implemented xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</iq>
type='get' 导致相同的行为。
但如果我只将 type 更改为 'result':
<iq type='result' from='apfel_vie@jabber.de/colibriVtn' to='birne_vie@jabber.de/colibriVen' id='time_1'>
<myiq xmlns='example:iq:foo' token='secret'>
<user age='42'>John Doe</user>
<location>New York</location>
</myiq>
</iq>
Java Smack 应用程序不回复这样的错误消息。
我有什么办法add/change在type等于set的情况下应用程序不回复这个错误信息?