Excuse my ignorance, after read your examples a bit more, I had only more questions... why not exchanging well-formed XML messages for each request and response like SIP?? for some reason this partial conversation style of XMPP looks pretty unnatural?? Why is
XMPP this way??
----- Original Message ----- From: "Jimmy Zhang" <[EMAIL PROTECTED]>
To: "Jabber software development list" <[email protected]>
Sent: Friday, May 19, 2006 12:25 AM
Subject: Re: [jdev] Re: VTD-XML version 1.6


I like xmpp a lot better than SIP ... it ought to replace SIP in the future.... ----- Original Message ----- From: "Alexander Gnauck" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, May 18, 2006 11:31 PM
Subject: [jdev] Re: VTD-XML version 1.6


[EMAIL PROTECTED] schrieb:
 you confused me even more...
I thought IM apps exchange xml messages (usually small),

let me explain XMPP with this small example of a session:

the client connects, open the socket and the XML Document
C->S: <?xml version="1.0"?>
C->S: <stream:stream xmlns:stream="http://etherx.jabber.org/streams"; xmlns="jabber:client" to="jabber.org" >

server accepts the socket and opens the XML document
S->C: <stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' from='jabber.org' id='596931'>

the client starts to authenticate
C->S: <iq type="get" to="jabber.org" id="auth_1" >
<query xmlns="jabber:iq:auth">
<username>alex</username>
</query>
</iq>

S->C: <iq type="result" id="auth_1" >
<query xmlns="jabber:iq:auth">
<username>gnauck</username>
<password/>
<digest/>
<resource/>
</query>
      </iq>

C->S: <iq type="set" to="jabber.org" id="auth_2" >
<query xmlns="jabber:iq:auth">
<username>gnauck</username>
<password>secret</password>
<resource>Psi</resource>
</query>
      </iq>


S->C: <iq type="result" id="auth_2" />

C->S: <message type="chat" to="[EMAIL PROTECTED]" > <body>Test</body>
     </message>

Client closes the connection, which means it closes the XML Document
C->S: </stream:stream>

Server is closing the XML Doc too
S->C: </stream:stream>

you see we have 2 complete XML Documents. The client doc and the server doc. Our messages, also called stanzas are the 1st level child elements of the document. If you see the stanzas as a single xml doc and not in the context of the whole document you loose the namespace of the stanzas, and your software is not namespace correct. This is why parsing XMPP XML is a bit tricky and the most out of the box parsers don't work very well without modifying them. My exapmple shows the old jabber style authentication. It gets even more complicated when using SASL, START-TLS and other stuff which resets the stream and opens the document again.

> why do they exchange huge XML docs? It sounds not just bad, but
> unnecessary...

i don' think so. Because of this XMPP is a very clean and solid protocol. Clean, simple, powerful, extensible.....

Alex







Reply via email to