Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] Troubles with Datashare over XMPP

Thanks for your help, Scott!

I try it on gmail.com only.

I send data from samolisov@xxxxxxxxx to pavel.samolisov@xxxxxxxxx and
add -Dsmack.debugEnabled=true to my run configuration.

But it does not work correct :-(

I send data (over DataSharing API Channel) from samolisov@xxxxxxxxx to
pavel.samolisov@xxxxxxxxx

In Smack Debug Window I can see:

<message id="9Q3m5-4" to="pavel.samolisov@xxxxxxxxx/" type="chat">
  <thread>N4E940</thread>
  <properties xmlns="http://www.jivesoftware.com/xmlns/xmpp/properties";>
    <property>
<name>org.eclipse.ecf.internal.provider.xmpp.smack.ECFConnection.object</name>
      <value
type="java-object">rO0ABXVyAAJbQqzzF/gGCFTgAgAAeHAAAAT1rO0ABXNyADFvcmcuZWNsaXBzZS5lY2YucHJvdmlkZXIuZ2VuZXJpYy5Db250YWluZXJNZXNzYWdlLTM5MzA2OTECAARKAAhzZXF1ZW5jZUwABGRhdGF0ABZMamF2YS9pby9TZXJpYWxpemFibGU7TAAPZnJvbUNvbnRhaW5lcklEdAAiTG9yZy9lY2xpcHNlL2VjZi9jb3JlL2lkZW50aXR5L0lEO0wADXRvQ29udGFpbmVySURxAH4AAnhwAAAAAAAAAABzcgBFb3JnLmVjbGlwc2UuZWNmLnByb3ZpZGVyLmdlbmVyaWMuQ29udGFpbmVyTWVzc2FnZSRTaGFyZWRPYmplY3RNZXNzYWdlLTQwODk2NzECAAJMAARkYXRhcQB+AAFMABJmcm9tU2hhcmVkT2JqZWN0SURxAH4AAnhwdXIAAltCrPMX+AYIVOACAAB4cAAAAK2s7QAFc3IAOW9yZy5lY2xpcHNlLmVjZi5wcm92aWRlci5kYXRhc2hhcmUuQmFzZUNoYW5uZWwkQ2hhbm5lbE1zZ33On1Dn0agYAgABWwALY2hhbm5lbERhdGF0AAJbQncJAAdjaGFubmVseHB1cgACW0Ks8xf4BghU4AIAAHcJAAdjaGFubm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property>
  </properties>
</message>

And not long after:

<message id="9Q3m5-4" to="samolisov@xxxxxxxxx/ecf.samoliF3FE20D2"
from="pavel.samolisov@xxxxxxxxx/" type="error">
  <thread>N4E940</thread>
  <error code="400"/>
  <properties xmlns="http://www.jivesoftware.com/xmlns/xmpp/properties";>
    <property>

<name>org.eclipse.ecf.internal.provider.xmpp.smack.ECFConnection.object</name>
      <value
type="java-object">rO0ABXVyAAJbQqzzF/gGCFTgAgAAeHAAAAT1rO0ABXNyADFvcmcuZWNsaXBzZS5lY2YucHJvdmlkZXIuZ2VuZXJpYy5Db250YWluZXJNZXNzYWdlLTM5MzA2OTECAARKAAhzZXF1ZW5jZUwABGRhdGF0ABZMamF2YS9pby9TZXJpYWxpemFibGU7TAAPZnJvbUNvbnRhaW5lcklEdAAiTG9yZy9lY2xpcHNlL2VjZi9jb3JlL2lkZW50aXR5L0lEO0wADXRvQ29udGFpbmVySURxAH4AAnhwAAAAAAAAAABzcgBFb3JnLmVjbGlwc2UuZWNmLnByb3ZpZGVyLmdlbmVyaWMuQ29udGFpbmVyTWVzc2FnZSRTaGFyZWRPYmplY3RNZXNzYWdlLTQwODk2NzECAAJMAARkYXRhcQB+AAFMABJmcm9tU2hhcmVkT2JqZWN0SURxAH4AAnhwdXIAAltCrPMX+AYIVOACAAB4cAAAAK2s7QAFc3IAOW9yZy5lY2xpcHNlLmVjZi5wcm92aWRlci5kYXRhc2hhcmUuQmFzZUNoYW5uZWwkQ2hhbm5lbE1zZ33On1Dn0agYAgABWwALY2hhbm5lbERhdGF0AAJbQncJAAdjaGFubmVseHB1cgACW0Ks8xf4BghU4AIAAHcJAAdjaGFubmVseHAAAAAfSGVsbG8gZnJvbSBzYW1vbGlzb3ZAZ21haWwuY29tIXNyACZvcmcuZWNsaXBzZS5lY2YuY29yZS5pZGVudGl0eS5TdHJpbmdJRC0xMDcwMTk0AgABTAAFdmFsdWV0ABJMamF2YS9sYW5nL1N0cmluZzt4cgAkb3JnLmVjbGlwc2UuZWNmLmNvcmUuaWRlbnRpdHkuQmFzZUlEqV3U6TB39y4CAAFMAAluYW1lc3BhY2V0AClMb3JnL2VjbGlwc2UvZWNmL2NvcmUvaWRlbnRpdHkvTmFtZXN
wYWNlO3hwc3IAOG9yZy5lY2xpcHNlLmVjZi5jb3JlLmlkZW50aXR5LlN0cmluZ0lEJFN0cmluZ0lETmFtZXNwYWNlbfiysG4/ewsCAAB4cgAnb3JnLmVjbGlwc2UuZWNmLmNvcmUuaWRlbnRpdHkuTmFtZXNwYWNlNzA4NTIyMTgCAARJAAhoYXNoQ29kZVoADWlzSW5pdGlhbGl6ZWRMAAtkZXNjcmlwdGlvbnEAfgAJTAAEbmFtZXEAfgAJeHDM7OAkAXQAElN0cmluZ0lEIE5hbWVzcGFjZXQAJm9yZy5lY2xpcHNlLmVjZi5jb3JlLmlkZW50aXR5LlN0cmluZ0lEdAAHY2hhbm5lbHNxAH4ACHEAfgAPdAATc2Ftb2xpc292QGdtYWlsLmNvbXNyAC1vcmcuZWNsaXBzZS5lY2YucHJvdmlkZXIueG1wcC5pZGVudGl0eS5YTVBQSUQtNDc3MjkxNAIABEkABHBvcnRMAAhob3N0bmFtZXEAfgAJTAAMcmVzb3VyY2VuYW1lcQB+AAlMAAh1c2VybmFtZXEAfgAJeHEAfgAKc3IANG9yZy5lY2xpcHNlLmVjZi5wcm92aWRlci54bXBwLmlkZW50aXR5LlhNUFBOYW1lc3BhY2UtNTYzMzk3NgIAAHhxAH4ADiGuWlsBdAAOWE1QUCBOYW1lc3BhY2V0AAhlY2YueG1wcP////90AAlnbWFpbC5jb21wdAAPcGF2ZWwuc2Ftb2xpc292</value>
    </property>
  </properties>
</message>

I do not understand what is this error?

I have attached my code to the letter. Could you watch it?

Thanks.


Scott Lewis пишет:
> Hi Pavel,
> 
> I cannot currently duplicate this, so we're going to have to figure out
> a way for me to collect enough information to debug.
> 
> One initial thought...could you run both clients with Smack debugging on
> (i.e. system property:  -Dsmack.debugEnabled=true) and capture the sent
> and received packets for both clients?  Please edit out the passwords in
> the xml data.
> 
> Also, what is the XMPP server at samolisov@xxxxx (i.e. what server
> software)?  And who configures it?
> 
> Finally, if you wish you can run the tests in
> org.eclipse.ecf.tests.provider.xmpp with these two accounts.  The tests
> require system properties to specify the account/pw information...i.e.
> here's an example
> 
> -Dusername0=user0@xxxxxxxxx
> -Dpassword0=user0pw
> -Dusername1=user1@xxxxxxxxx
> -Dpassword1=user1pw
> -Dchat.room.name=ecf
> -Dsmack.debugEnabled=true
> 
> You will need to change the username?/password? info appropriately for
> the two accounts.  The test that you should probably run is
> org.eclipse.ecf.tests.provider.xmpp.remoteservice.RemoteServiceTest...many
> of the other tests in that project test the chat room access (and gmail
> has no chat room capability), so those tests aren't relevant.
> 
> Finally, another option is that if you have access to creating an
> account on the ya.ru system for me (e.g. a guest or test account), I
> will try out the tests against my gmail/gtalk account.  So if you are
> able to create an account on ya.ru xmpp server for me (or let me know
> about accessing an existing account) please do so and I'll give it a try
> when I can.
> 
> Thanks,
> 
> Scott
> 
> 
> Samolisov Pavel wrote:
>> I'm sorry for my English, Scott.
>>
>> Yes, you are right. The sender is receiving the message but not the
>> intended receiver.
>>
>>  
>>>> Are these XMPP servers able to communicate/federate?
>>>>       
>>
>> Yes, they are.
>>
>> Scott Lewis пишет:
>>  
>>> Hi Pavel,
>>>
>>> Samolisov Pavel wrote:
>>>    
>>>> -----BEGIN PGP SIGNED MESSAGE-----
>>>> Hash: SHA1
>>>>
>>>> Hello, folks!
>>>>
>>>> I'm playing with Datashare API over XMPP-container and have some
>>>> problems.
>>>>
>>>> I create ecf.xmpp.smack container, connect to my jabber account
>>>> "samolisov@xxxxx" (connect fine, I watch myself online), create channel
>>>> with name "channel"
>>>>
>>>> IChannelContainerAdapter channelContainer = (IChannelContainerAdapter)
>>>> _container.getAdapter(IChannelContainerAdapter.class);  
>>>> channelContainer.createChannel(getNewID(CHANNEL_NAME),
>>>> getChannelListener(), null);
>>>>
>>>> Bundle keep run.
>>>>
>>>> Late, I start this bundle with another config: I create ecf.xmpp.smack
>>>> container, connect to my jabber account "samolisov@xxxxxxxxx" (connect
>>>> fine, I watch myself online) and create channel with name "channel".
>>>>
>>>> And send message over channel to my another account:
>>>>
>>>> IChannel sender = getChannel();
>>>> System.out.println("to = " + System.getProperty(XMPP_TO_ID));
>>>> sender.sendMessage(IDFactory.getDefault().createID(IDFactory.getDefault().getNamespaceByName(XMPP_NAMESPACE),"samolisov@ya,ru")
>>>>
>>>>
>>>> ,"Hello!".getBytes());
>>>>
>>>> Now are running two bundles with two containers.
>>>>
>>>> But! This data has sended to my container (i.e. container that send
>>>> this
>>>> data: "samolisov@xxxxxxxxx") and do not received by container that I
>>>> send this message ("samolisov@xxxxx").
>>>>         
>>> Your phrasing in the description above is a little unclear to me so I
>>> want to check:  are you saying that the "Hello" message is received by
>>> the container that's doing the sending (samolisov@xxxxxxxxx), rather
>>> than the target account/container? (i.e. samolisov@ya,ru  ...I'm not
>>> sure if the comma is a typo, but I assume it is).  So the sender is
>>> receiving the message but not the intended receiver?
>>>
>>> And I can see that the two accounts are on different XMPP servers
>>> (gmail.com and ya.ru).  Are these XMPP servers able to
>>> communicate/federate?
>>>
>>> Thanks,
>>>
>>> Scott
>>>
>>>     
>>
>>
>>   
> 


-- 
Pavel Samolisov

Meet me at:
Vkontakte.ru: http://vkontakte.ru/id3178981
Blog: http://samolisov.blogspot.com
Twitter: http://twitter.com/samolisov
XMPP/Jabber: samolisov@xxxxxxxxx
package name.samolisov.ecf.datashare.xmpp;

import org.eclipse.ecf.core.ContainerConnectException;
import org.eclipse.ecf.core.ContainerFactory;
import org.eclipse.ecf.core.IContainer;
import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.core.identity.IDCreateException;
import org.eclipse.ecf.core.identity.IDFactory;
import org.eclipse.ecf.core.security.ConnectContextFactory;
import org.eclipse.ecf.core.security.IConnectContext;
import org.eclipse.ecf.core.util.ECFException;
import org.eclipse.ecf.datashare.IChannel;
import org.eclipse.ecf.datashare.IChannelContainerAdapter;
import org.eclipse.ecf.datashare.IChannelListener;
import org.eclipse.ecf.datashare.events.IChannelEvent;
import org.eclipse.ecf.datashare.events.IChannelMessageEvent;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

public class Activator implements BundleActivator
{
	public static final String XMPP_NAMESPACE = "ecf.xmpp";

	public static final String XMPP_CONTAINER = "ecf.xmpp.smack";

	public static final String XMPP_ACCOUNT_ID = "account";

	public static final String XMPP_TO_ID = "to";

	public static final String LOGIN = "login";

	public static final String PASSWORD = "password";

	public static final String CHANNEL_NAME = "channel";

	private IContainer _container;

	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
	 */
	public void start(BundleContext context) throws Exception
	{
		_container = ContainerFactory.getDefault().createContainer(XMPP_CONTAINER,
				System.getProperty(XMPP_ACCOUNT_ID));

		connectClient(getNewID(true, System.getProperty(XMPP_ACCOUNT_ID)),
				getConnectContext(System.getProperty(LOGIN), System.getProperty(PASSWORD)));

		addChannelToClient();

		sendMessage();
	}

	protected void connectClient(ID connectID, IConnectContext context) throws ContainerConnectException
	{
		_container.connect(connectID, context);
	}

	protected IConnectContext getConnectContext(String username, String password)
	{
		return ConnectContextFactory.createUsernamePasswordConnectContext(username, password);
	}

	private ID getNewID(boolean namespace, String id) throws IDCreateException
	{
		if (namespace)
			return IDFactory.getDefault().createID(IDFactory.getDefault().getNamespaceByName(XMPP_NAMESPACE), id);
		else
			return IDFactory.getDefault().createStringID(id);
	}

	private void addChannelToClient() throws Exception
	{
		IChannelContainerAdapter channelContainer = (IChannelContainerAdapter) _container
				.getAdapter(IChannelContainerAdapter.class);
		channelContainer.createChannel(getNewID(false, CHANNEL_NAME), getChannelListener(), null);
	}

	private IChannel getChannel()
	{
		IChannelContainerAdapter channelContainer = (IChannelContainerAdapter) _container
			.getAdapter(IChannelContainerAdapter.class);
		return channelContainer.getChannel(getNewID(false, CHANNEL_NAME));
	}

	private void sendMessage() throws ECFException
	{
		IChannel sender = getChannel();
		System.out.println("to = " + System.getProperty(XMPP_TO_ID));
		sender.sendMessage(getNewID(true, System.getProperty(XMPP_TO_ID)),
				("Hello from " + System.getProperty(XMPP_ACCOUNT_ID) + "!").getBytes());
	}

	private IChannelListener getChannelListener() throws Exception
	{
		return new IChannelListener()
		{
			public void handleChannelEvent(IChannelEvent event)
			{
				if (event instanceof IChannelMessageEvent)
				{
					IChannelMessageEvent message = (IChannelMessageEvent) event;
					System.out.println(new String(message.getData()));
					System.out.println("channel = " + message.getChannelID());
					System.out.println("from = " + message.getFromContainerID());
				}
			}
		};
	}

	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
	 */
	public void stop(BundleContext context) throws Exception
	{
		if (_container != null)
		{
			_container.disconnect();
			_container.dispose();
		}
	}
}

Back to the top