[jdev] Cancelling an iq query

Jean-Louis Seguineau jean-louis.seguineau at laposte.net
Mon Aug 29 12:29:32 CDT 2005


Why not use the JEP-050 commands adapted to this case? Better than creating
a new IQ extension.

Jean-Louis


-----Original Message-----
Message: 3
Date: Mon, 29 Aug 2005 13:30:55 +0200
From: Ralph Meijer <jabber.org at ralphm.ik.nu>
Subject: Re: [jdev] Cancelling an iq query
To: Jabber software development list <jdev at jabber.org>
Message-ID: <20050829113055.GA58556 at ik.nu>
Content-Type: text/plain; charset=us-ascii

On Mon, Aug 29, 2005 at 08:12:09PM +1000, Trejkaz wrote:
> On Mon, 29 Aug 2005 19:31, Ralph Meijer wrote:
> > On Sun, Aug 28, 2005 at 11:42:25AM -0700, Ralph Giles wrote:
> > > I'd like to collect suggestions for "cancelling" an in-process iq
> > > transaction.
> >
> > I would also go with a similar approach as yours. An <iq/> for the
> > transaction request and a <message/> with the results when the
> > transaction is completed. The two then matched up by a application
> > specific handle. There is no generic solution to the pattern you
> > describe, yet.
> 
> The difficulty with that approach, of course, is that it can't possibly
with 
> with existing, standard IQ queries.  I don't suppose we need some kind of
<iq 
> type='cancel'/> where you pass the same ID of the query you want to
cancel...

Ehm, yes, that's what Ralph en Ralph said. There is no generic solution,
so far, but you could do this like:

Client sends request:

<iq from='client at example.com/client'
    to='service.example.com'
    type='set' id='H_2'>
  <transaction xmlns='http://example.com/transaction'>
    <query id='query_5'>
      ...
    </query>
  </transaction>
</iq>

Service responds with "Ok, I'm doing this":

<iq from='service.example.com'
    to='client at example.com/client'
    type='result' id='H_2'/>

And, then when the result is done:

<message from='service.example.com'
         to='client at example.com/client'>
  <results xmlns='http://example.com/transaction#results' id='query_5'>
    ...
  </results>
</message>

If you want to cancel in the middle of processing you can just send:

<iq from='client at example.com/client'
    to='service.example.com'
    type='set' id='H_3'>
  <transaction xmlns='http://example.com/transaction'>
    <cancel id='query_5'/>
  </transaction>
</iq>

Yielding:

<iq from='service.example.com'
    to='client at example.com/client'
    type='result' id='H_3'/>

or in case of an error (nicely annotated with a machine readable
construct and a diagnostic text for humans):

<iq from='service.example.com'
    to='client at example.com/client'
    type='error' id='H_3'>
  <transaction xmlns='http://example.com/transaction'>
    <cancel id='query_5'/>
  </transaction>
  <error type='cancel'>
    <item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
    <completed xmlns='http://example.com/transaction#error'/>
    <text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas' xml:lang='en'>
      The referenced query has already been completed and cannot be
      cancelled.
    </text>
  </error>
</iq>

-- 
Groetjes,

ralphm


------------------------------

Message: 4
Date: Mon, 29 Aug 2005 14:31:14 +0200
From: Ben Turner <ext.ben.turner at siemens.be>
Subject: [jdev] S2S
To: Jabber software development list <jdev at jabber.org>
Message-ID: <20050829123114.GE32357 at bturner>
Content-Type: text/plain; charset=us-ascii


Hi,

Are there any libraries one would recommend for setting up server-to-server
communications (preferably in java)? I have been taking a look at Smack, but
it
appears to be client-to-server oriented.

Thanks in advance,

Ben

--
Ben Turner
SIEMENS - COM D MN B
tel: +32 14 252326

~ Scientia Vincere Tenebras ~



------------------------------

Message: 5
Date: Mon, 29 Aug 2005 06:49:05 -0700
From: Chris Chen <ckchris at idream.net>
Subject: Re: [jdev] Error while trying to login into talk.google.com
To: Jabber software development list <jdev at jabber.org>
Message-ID: <8A527201-D4FF-4868-84D8-728A38544FBF at idream.net>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed

Hi,

Just to clarify, Muse does not support SASL and TLS.  Thus, you  
cannot use Muse to connect to Google, neither now nor the future.

However, Feridian, the next generation XMPP API that will replace  
Muse, fully supports SASL and TLS.  In fact, I have used it to  
connect successfully to Google's IM service.  Unfortunately, it does  
not support the X-GOOGLE-TOKEN SASL authentication.  But it does  
support PLAIN.

I am in the stages of writing the documentation for Feridian.  The  
web pages are not yet ready so that's why you don't see anything on  
Echomine about Feridian (except for news).  But as of now, CVS code  
is actually stable and usable.

you can download Feridian's latest SVN codebase off echomine.berlios.de:

http://developer.berlios.de/projects/echomine

I have not yet released an alpha version of Feridian yet, but that  
will be soon.  However, current Feridian code already supports about  
90% of all XMPP required features.  I am just adding a few more  
additional features before I release it.

Download the latest code base and just run the following ant tasks to  
get the proper libraries:

ant jar-xmpp jar-xmpp-examples jar-jabber-compat

The only example file is the SimpleXMPPClient that is located in the  
feridian-xmpp-examples.jar file.  You can read the source file to see  
how to do some connect and login procedures.  Unfortunately, the  
documentation is not ready yet.

Let me know if you have any questions.

SVN checkout instructions are located on the berlios web, but I will  
provide it here.

svn co svn://svn.berlios.de/echomine/feridian/trunk

You will need to have SVN installed.  SVN can be downloaded from:

http://subversion.tigris.org/

Thanks,
Chris



On Aug 28, 2005, at 10:37 PM, Ashutosh wrote:

> I am using muse 0.81 apis to write a jabber/xmpp client.
> I am tring to connect talk.google.com <http://talk.google.com/>
> I am getting follwing error while trying to authenticate.
> Here is my code.
> Pls tell me what is missing.
>  Thanks
> Ashutosh Lawania
>
> *package com.xmppcore;
> import com.echomine.jabber.Jabber;
> import com.echomine.jabber.JabberContext;
> import com.echomine.jabber.JabberSession;
> import com.echomine.jabber.JabberServerService ;
> public class XMPPConsoleClient {
>
> public static void main(String args[])
> {
> JabberSession session = null ;
> try
> {
> Jabber jabber = new Jabber();
> JabberContext context = new JabberContext("username", "password", "
> talk.google.com <http://talk.google.com/>");
>
> session = jabber.createSession(context);
> session.connect("talk.google.com <http://talk.google.com/>",5222);
> session.getUserService ().login();
>
> }
> catch(Exception ex)
> {
> System.out.println("Exception occured");
> ex.printStackTrace();
> }
> finally
> {
> session.disconnect();
> }
> }*
>
> *}
> *
> **
>  DEBUG [jabber/msg/outgoing] - <?xml version='1.0' encoding='UTF-8'
> ?><stream:stream to=' talk.google.com <http://talk.google.com/>'  
> version='
> 1.0' xmlns='jabber:client' xmlns:stream=' http://etherx.jabber.org/ 
> streams'>
>
> DEBUG [jabber/msg/incoming] - <stream:stream
> from="talk.google.com<http://talk.google.com/>"
> id="EC5BB1B5">
>
> DEBUG [jabber/msg/incoming] - <stream:features xmlns:stream="
> http://etherx.jabber.org/streams" id="id_10003"><starttls
> xmlns="urn:ietf:params:xml:ns:xmpp-tls" /></stream:features>
>
> DEBUG [jabber/msg/outgoing] - <iq xmlns="jabber:client" id="id_10004"
> type="get"><query
> xmlns="jabber:iq:auth"><username>ashutosh.lawania</username></ 
> query></iq>
>
> DEBUG [jabber/msg/incoming] - <iq xmlns="jabber:client" id="id_10004"
> type="error"><query
> xmlns="jabber:iq:auth"><username>ashutosh.lawania</username></ 
> query><error
> code="405" type="cancel"><not-allowed
> xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" /><text
> xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">Server does not support
> PLAIN</text></error></iq>
>
> INFO [com.echomine.jabber.parser.JabberJAXPParser] -
> *IOException*: socket closed
>
> at com.echomine.jabber.JabberUserS ervice.login(
> *JabberUserService.java:45*)
>
> at com.xmppcore.XMPPConsoleClient.main(
> *XMPPConsoleClient.java:23*)
>
> Exception occured
> _______________________________________________
> jdev mailing list
> jdev at jabber.org
> http://mail.jabber.org/mailman/listinfo/jdev
>



------------------------------

Message: 6
Date: Sun, 28 Aug 2005 16:01:23 -0600
From: Peter Saint-Andre <stpeter at jabber.org>
Subject: Re: R: R: R: [jdev] about spim techniques
To: Jabber software development list <jdev at jabber.org>
Message-ID: <43123433.2010202 at jabber.org>
Content-Type: text/plain; charset="iso-8859-1"

Ian Paterson wrote:
>>(I should be able to specify the error  message that's
>>returned to you when your message to me is blocked 
>>because you're not in my roster -- at this point we have 
>>something like a challenge-response system
> 
> 
> Yes. IMHO this will be one of the most important anti-SPIM techniques
> (along with the others discussed earlier - regarding registration, s2s,
> etc...).

Hmm, well, I looked at RFC 3921 and it says:

    If a blocked entity attempts to send message or presence stanzas
    to the user, the user's server SHOULD silently drop the stanza
    and MUST NOT return an error to the sending entity.

That seems counter-productive. There might be different reasons to block 
communications, some more personal than others -- I might block the 
message because I don't like you as an individual (in which case I might 
not want you to receive an error, I'm just blowing you off) or I might 
block the message because the sender isn't yet in my roster and in 
general I block all such messages. So I think we might want to adjust 
that in rfc3921bis.

Peter

-- 
Peter Saint-Andre
Jabber Software Foundation
http://www.jabber.org/people/stpeter.shtml

------------------------------

_______________________________________________
jdev mailing list
jdev at jabber.org
http://mail.jabber.org/mailman/listinfo/jdev


End of jdev Digest, Vol 19, Issue 48
************************************




More information about the JDev mailing list