This Question is Answered

9 Replies Last post: Dec 19, 2007 8:21 PM by chris Malcolm  
chris Malcolm Bronze 6 posts since
Dec 17, 2007
Currently Being Moderated

Dec 17, 2007 6:55 PM

problem sending file with filetransfer

Hi I'm just playing around with smack and testing it out for future apps and I have run into a problem sending a file from one user to another. my code is below.

 

import org.jivesoftware.smack.\*;

import org.jivesoftware.smack.packet.Message;

import java.io.\*;

import org.jivesoftware.smackx.filetransfer.\*;

public class RsUfClient

{

 

 

 

     public RsUfClient()

     {

         

 

     }

 

     public static void main (String[] args) {

 

         XMPPConnection connection = new XMPPConnection("gmail.com");

         try

         {

        

         connection.connect();

         connection.login("rsuftesting@gmail.com", "

\");

         Chat chat = connection.getChatManager().createChat("chrisishere@gmail.com", new MessageListener() {

        

             public void processMessage(Chat chat, Message message) {

             &n bsp;   System.out.println("Received message: " \ message);+

             }

         });

        

    chat.sendMessage("Howdy!");

    }

   

   

catch (Exception e) {

    System.out.println(e);

}

          // Create the file transfer manager

      FileTransferManager manager = new FileTransferManager(connection);

+          System.out.println( "working so far");+

      // Create the outgoing file transfer

      OutgoingFileTransfer transfer = manager.createOutgoingFileTransfer("chrisishere@gmail.com");

+          +

      // Send the file

      try

      {

      transfer.sendFile(new File("blah.txt"), "You won't believe this!");

}catch (Exception e)

{

System.out.println(e);

     }

}

 

 

everything compiles properly but when ran, it gets the following error: Exception in thread "main" java.lang.IllegalArgumentException: The provided user id was not fully qualified. It is having problems with the jabber id: chrisishere@gmail.com but not sure why. Ive tried other usernames and same problem so I can only assume my code is having issues. anyone know the reason? much help is appreciated, thanks

}

keith.lirette Bronze 33 posts since
Mar 29, 2006
Currently Being Moderated
Dec 18, 2007 10:16 AM in response to: chris Malcolm
Re: problem sending file with filetransfer

 

You need to specify a fully qualified JID.  A fully qualified JID includes a resource value.

 

 

 

 

For example: bill.smith@jabber.com/Spark

 

 

 

 

-Pony

 

 

Chris Ward Silver 89 posts since
Aug 16, 2005
Currently Being Moderated
Dec 19, 2007 10:30 AM in response to: chris Malcolm
Re: problem sending file with filetransfer

I think (503) service unavailable means the server you are using does not support the implementation of the feature you are trying to use.  So for example, the server may support file transfer, but it may not be using the same specification or version of the specification that Smack has implemented.  I am using Openfire, and file transfer is working with Smack in that case for me.  So you need to determine if both Smack and the server are using the same thing.

 

Chris

Chris Ward Silver 89 posts since
Aug 16, 2005
Currently Being Moderated
Dec 19, 2007 12:52 PM in response to: chris Malcolm
Re: problem sending file with filetransfer

Well, Smack already determines whether it is compatible with the server using a service discovery protocol extension, hence the "service unavailable" error (I think).  There could be another reason for the error too as I don't have a lot of experience with that.  The file transfer implementation is based on XEP-0096.  So you need to see if Google uses that XEP and even if they do, it is possible there are deviations in Smack or Google that could cause it to not work.  Every feature beyond the basic chat and presence in the XMPP protocol is specified by a XEP, which Smack implements a few of them.  Here is a list of the Smack Extensions and a link to the corresponding XEP.

 

The other servers you are trying must not support secure authentication (SASL), you can tell Smack not to do that using the ConnectionConfiguration#setSASLAuthenticationEnabled method.

 

Finally, the server hosted here (igniterealtime.org) is running Openfire and allows you to create an account so that should work for you if nothing else.

 

Chris

Chris Ward Silver 89 posts since
Aug 16, 2005
Currently Being Moderated
Dec 19, 2007 5:32 PM in response to: chris Malcolm
Re: problem sending file with filetransfer

I think for the igniterealtime.org server you want to leave SASL authentication turned on and you should only use the username to login, not the full JID with the domain.

 

Chris

More Like This

  • Retrieving data ...