AnsweredAssumed Answered

Smack-AccountCreation XMPPError: bad-request - modify

Question asked by vivek khare on Apr 1, 2016
Latest reply on Apr 28, 2016 by shdf

 

Hello guys,

 

Need some help with this, steps  i took :-

1.)ConnectToServer Method

 

void ConnectToServer() {

   try {

  DomainBareJid domainBareJid = JidCreate.domainBareFrom("192.168.0.210");

  XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder().allowEmptyOrNullUsernames()

.setHost("192.168.0.210").setPort(5222).setDebuggerEnabled(true).setXmppDomain( domainBareJid)

.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled).setSendPresence (true).build();

mConnection = new XMPPTCPConnection(config);

mConnection.addConnectionListener(this);

mConnection.connect();

} catch (Exception e) {

   // TODO Auto-generated catch block
   e.printStackTrace();

  }

}

 

2.)Register User Method

 

 

private void RegisterUser() {

   // TODO Auto-generated method stub
   try {

    AccountManager accountManager = AccountManager.getInstance(mConnection);

    accountManager.sensitiveOperationOverInsecureConnection(true);

    Localpart localpart = Localpart.from("testUser");

  accountManager.createAccount(localpart,"password");

  } catch (Exception e) {

   // TODO Auto-generated catch block
   e.printStackTrace();

  }

  }

 

 

3.)This always comes in reponse "org.jivesoftware.smack.XMPPException$XMPPErrorException: XMPPError: bad-request - modify"

 

Do i need to change something on server end and it works if i login using my pre-created account, even tried using rest service plugin get requests are working fine but post are causing trouble.

 

Thanks in advance

 

 

 

Android Studio ( LogCat/Response )

 

<iq to='192.168.0.210' id='5pbWM-9' type='set'><query xmlns='jabber:iq:register'><password>fucyvvy</password><username>hchc</username ></query></iq>

04-01 16:23:14.180 8607-10396/com.qspl.admin.paychat D/SMACK: RECV (0): <iq type="error" id="5pbWM-9" from="192.168.0.210" to="android-6/6fo07iug70"><query xmlns="jabber:iq:register"><password>fucyvvy</password><username>hchc</username ></query><error code="400" type="modify"><bad-request xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></iq>

04-01 16:26:14.205 8607-10396/com.qspl.admin.paychat D/SMACK: RECV (0): <iq type="get" id="329-28" from="android-6" to="android-6/6fo07iug70"><ping xmlns="urn:xmpp:ping"/></iq>

04-01 16:26:14.250 8607-10395/com.qspl.admin.paychat D/SMACK: SENT (0): <iq to='android-6' id='329-28' type='result'></iq>

04-01 16:28:50.130 8607-10383/com.qspl.admin.paychat W/System.err: org.jivesoftware.smack.XMPPException$XMPPErrorException: XMPPError: bad-request - modify

04-01 16:28:50.155 8607-10383/com.qspl.admin.paychat W/System.err:     at org.jivesoftware.smack.PacketCollector.nextResultOrThrow(PacketCollector.java:2 32)

04-01 16:28:50.160 8607-10383/com.qspl.admin.paychat W/System.err:     at org.jivesoftware.smack.PacketCollector.nextResultOrThrow(PacketCollector.java:2 07)

04-01 16:28:50.160 8607-10383/com.qspl.admin.paychat W/System.err:     at org.jivesoftware.smackx.iqregister.AccountManager.createAccount(AccountManager. java:286)

04-01 16:28:50.165 8607-10383/com.qspl.admin.paychat W/System.err:     at com.qspl.admin.paychat.LoginActivity.RegisterUser(LoginActivity.java:190)

04-01 16:28:50.165 8607-10383/com.qspl.admin.paychat W/System.err:     at com.qspl.admin.paychat.LoginActivity.onDoInBackGround(LoginActivity.java:223)

04-01 16:28:50.165 8607-10383/com.qspl.admin.paychat W/System.err:     at com.qspl.admin.paychat.BackGroundExecutor.doInBackground(BackGroundExecutor.jav a:27)

04-01 16:28:50.170 8607-10383/com.qspl.admin.paychat W/System.err:     at com.qspl.admin.paychat.BackGroundExecutor.doInBackground(BackGroundExecutor.jav a:7)

Outcomes