2
votes

I'm currently trying to implement XML RPC via XMPP. I'm using Smack as client library and Vysper as XMPP server. Simplified, my setup looks as follows:

[client1] — [server] — [client2]

I want to invoke a method on Client 2 from Client 1. I create an IQ with type set, and from and to elements and the query content as described in [1]. Simplified example:

<iq type='set' from='client1@localhost' to='client2@localhost' id='1'>
  <query xmlns='jabber:iq:rpc'>
    <methodCall>
      <methodName>foo</methodName>
    </methodCall>
  </query>
</iq>

The problem is, when sending the IQ from client1 I receive back an error IQ, and nothing is submitted to client2. Investigating the problem, I came across this statement in the specs [2]:

A server MUST ignore any 'to' address on a roster "set", and MUST treat any roster "set" as applying to the sender. […]

Am I correct, that in this constellation Jabber-RPC is not possible between two clients? Or do I have a fundamental misunderstanding of Jabber-RPC?

[1] http://xmpp.org/extensions/xep-0009.html

[2] http://xmpp.org/rfcs/rfc3921.html#roster

1

1 Answers

3
votes

It looks like you are sending the Iq stanza to the client's bare JID instead of a full JID, i.e., [email protected] instead of [email protected]/resource.

Iq stanzas sent to a bare JID are handled by the server and are not routed to clients. You are in essence querying the user's account, not interacting with a particular connected agent. Typically, you always want to specify the recipient's full JID.