07-19-2008 08:38
Hi guys...

I am experimenting with opensim and try to use xmlrpc to push some data into my opensim. Unfortunately my java programm always tells me, that the channel is invalid although I copy the id direct from the opensim into the programm. Does anybody have any idea what can cause such a problem? different mime-types?

I just scripted/copied simple code to test... but it doesn't work :-/

here the java part :

import java.util.*;
import org.apache.xmlrpc.*;

public class SLClient
{
public static void main (String [] args)
{
try
{
System.out.println("moin";);
Hashtable theData = new Hashtable();
XmlRpcClient server = new XmlRpcClient("http://localhost:20800";);
theData.put("Channel", "80447442-7713-4ca7-a740-6d77512910f6";);
theData.put("IntValue", 2483);
theData.put("StringValue", "How are you?";);
Vector params = new Vector();
params.add(theData);
//server.setBasicAuthentication(user, password)

Object result = server.execute("llRemoteData", params );

if ( result != null )
System.out.println( "Successfully pinged guest account." );


}
catch (Exception exception)
{
System.err.println("SL_Client: " + exception);
exception.printStackTrace();
}
}
}

and the lsl part :

key gChannel; // my llRemoteData channel

default
{ // initialize XML-RPC
state_entry() {
llOpenRemoteDataChannel(); // create an XML-RPC channel
// this will raise remote_data event REMOTE_DATA_CHANNEL when created
}

remote_data(integer type, key channel, key message_id, string sender, integer ival, string sval) {
if (type == REMOTE_DATA_CHANNEL) { // channel created
llSay(DEBUG_CHANNEL,"1 " + (string)channel + " " + (string)message_id + " " + (string)sender
+ " " + (string)ival + " " + (string)sval);
gChannel = channel;
llSay(0, "Ready to receive requests on channel \"" + (string)channel + "\"";);
state go; // start handling requests
} else llSay(DEBUG_CHANNEL,"2 " + (string)channel + " " + (string)message_id + " " + (string)sender
+ " " + (string)ival + " " + (string)sval);

}
}

state go { // handle requests
remote_data(integer type, key channel, key message_id, string sender, integer ival, string sval) {
if (type == REMOTE_DATA_REQUEST) { // handle requests sent to us
llSay(DEBUG_CHANNEL,"3 " + (string)channel + " " + (string)message_id + " " + (string)sender
+ " " + (string)ival + " " + (string)sval);


// handle request
if (sval == "How are you?";) { // we do something special on that string parameter
// send a reply to this request, referencing the senders message id
llRemoteDataReply(channel, message_id, "Fine, thanks!", 1);
} else { // IMPORTANT: a reply MUST always be sent
llRemoteDataReply(channel, message_id, "", 0);
}
} else llSay(DEBUG_CHANNEL,"4 " + (string)channel + " " + (string)message_id + " " + (string)sender
+ " " + (string)ival + " " + (string)sval);

}

state_exit() {
llCloseRemoteDataChannel(gChannel); // clean up when you no longer want to handle requests
}
}

btw. needed ports are open. It just can be a software prob.

Thanks in advance.