| Posted on 2006-03-01 18:11:40-08 by rfaist |
| RPCCall - no auth |
|
I can successfully make an RPC method call with Jabber::RPC::Client
but I would rather use Net::Jabber::Client but the authorization seems
to fail. Any ideas?
######################################################
Using Jabber::RPC::Client
use Jabber::RPC::Client;
my $client = Jabber::RPC::Client->new(server=>'localhost',
identauth=>'emsng:emsng',
endpoint=>'dst@localhost/XMLRPC',
);
my $response = $client->call('CreateContext', {
ApplicationName=>'EMSng', MaxIdleDuration=>'5' } );
print $response || $client->lastfault, "\n";
########################################################
########################################################
Using Net::Jabber::Client
use Net::Jabber qw( Client );
my $client = Net::Jabber::Client->new();
my $status;
$client->Connect(hostname=>'localhost');
if($client->Connected()) {
$status = $client->AuthSend(username=>'emsng', password=>'emsng');
my @response = $client->RPCCall(to=>'dst@localhost/XMLRPC',
methodname=>'CreateContext',
params=>[ {
ApplicationName=>'EMSngTEST', MaxIdleDuration=>'5' } ]
);
die Dumper(\@response);
}
Response when use Net::Jabber::Client
<packet xmlns="http://www.jivesoftware.org" streamID="94d182bf"
status="connected" timestamp="Mar 1, 2006 11:36:52 AM"><iq xmlns=""
type="error" id="netjabber-0"
to="localhost/94d182bf"><query
xmlns="jabber:iq:rpc"><methodCall><methodName>CreateContext</methodName><param
s><param><value><struct><member><name>MaxIdleDuration</name><value><i4>5</i4></value></member><memb
+er><name>Ap
plicationName</name><value><string>EMSngTEST</string></value></member></struct></value></param></pa
+rams></meth
odCall></query><error code="401" type="auth"><not-authorized
xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></er
ror></iq></packet>
|
| Direct Responses: Write a response |