问题描述
使用匿名登录后,注册总是会返回失败。如果使用实名登录可以注册成功。服务器是openfire,以下是通讯的xmpp报文,不知道那个步骤存在问题。请大拿指教。C:<?xmlversion="1.0"?><stream:streamto="192.168.1.126"xml:lang="en"version="1.0"xmlns="jabber:client"xmlns:stream="http://etherx.jabber.org/streams">S:<?xmlversion='1.0'encoding='UTF-8'?><stream:streamxmlns:stream="http://etherx.jabber.org/streams"xmlns="jabber:client"from="jonnylocal"id="c883ad61"xml:lang="en"version="1.0"><stream:features><starttlsxmlns="urn:ietf:params:xml:ns:xmpp-tls"></starttls><mechanismsxmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>DIGEST-MD5</mechanism><mechanism>PLAIN</mechanism><mechanism>ANONYMOUS</mechanism><mechanism>CRAM-MD5</mechanism></mechanisms><compressionxmlns="http://jabber.org/features/compress"><method>zlib</method></compression><authxmlns="http://jabber.org/features/iq-auth"/><registerxmlns="http://jabber.org/features/iq-register"/></stream:features>C:<authmechanism="ANONYMOUS"xmlns="urn:ietf:params:xml:ns:xmpp-sasl"/>S:<successxmlns="urn:ietf:params:xml:ns:xmpp-sasl"/>C:<?xmlversion="1.0"?><stream:streamto="192.168.1.126"xml:lang="en"version="1.0"xmlns="jabber:client"xmlns:stream="http://etherx.jabber.org/streams">S:<?xmlversion='1.0'encoding='UTF-8'?><stream:streamxmlns:stream="http://etherx.jabber.org/streams"xmlns="jabber:client"from="jonnylocal"id="c883ad61"xml:lang="en"version="1.0"><stream:features><compressionxmlns="http://jabber.org/features/compress"><method>zlib</method></compression><bindxmlns="urn:ietf:params:xml:ns:xmpp-bind"/><sessionxmlns="urn:ietf:params:xml:ns:xmpp-session"/></stream:features>C:<iqid="_xmpp_bind1"type="set"><bindxmlns="urn:ietf:params:xml:ns:xmpp-bind"/></iq>S:<iqtype="result"id="_xmpp_bind1"to="jonnylocal/c883ad61"><bindxmlns="urn:ietf:params:xml:ns:xmpp-bind"><jid>c883ad61@jonnylocal/c883ad61</jid></bind></iq>C:<iqid="_xmpp_session1"type="set"><sessionxmlns="urn:ietf:params:xml:ns:xmpp-session"/></iq>S:<iqtype="result"id="_xmpp_session1"to="c883ad61@jonnylocal/c883ad61"/>C:<iqid="reg1"xmlns="jabber:client"type="get"><queryxmlns="jabber:iq:register"/>S:</iq><iqtype="result"id="reg1"to="c883ad61@jonnylocal/c883ad61"><queryxmlns="jabber:iq:register"><username/><password/><email/><name/><xxmlns="jabber:x:data"type="form"><title>XMPPClientRegistration</title><instructions>Pleaseprovidethefollowinginformation</instructions><fieldvar="FORM_TYPE"type="hidden"><value>jabber:iq:register</value></field><fieldvar="username"type="text-single"label="Username"><required/></field><fieldvar="name"type="text-single"label="Fullname"/><fieldvar="email"type="text-single"label="Email"/><fieldvar="password"type="text-private"label="Password"><required/></field></x></query></iq>C:<iqid="reg2"xmlns="jabber:client"type="set"><queryxmlns="jabber:iq:register"><username>testwhy999</username><password>999</password><email/><name/></query></iq>S:<iqtype="error"id="reg2"to="c883ad61@jonnylocal/c883ad61"><queryxmlns="jabber:iq:register"><username>testwhy999</username><password>999</password><email/><name/></query><errorcode="400"type="modify"><bad-requestxmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></iq>
解决方案
解决方案二:
看报文感觉没有问题,有返回错误码吗?
解决方案三:
有啊,你看服务器最后返回的错误码是400.