mandar xml ra direccion remota

miguel
30 de Octubre del 2004
como se puede mandar un String que tiene un xml a una direccion remota???urgente

mramirez
30 de Octubre del 2004
yo estoy tratando de hacer algo similar.
lo que tengo que hacer es hacer una consulta a una base de datos, convertir los resultados a XML, y enviar el documento como una cadena a traves de sockets.

si alguien sabe como puedo pasar un objeto a XML se lo agradeceria.

Aqui esta un ejemplo de sockets:

para el

mramirez
30 de Octubre del 2004
perdon !!!!
para el servidor el codigo es:


import java.net.*;
import java.io.*;

public class TalkReceiver
{
public static void main(String args[]) throws Exception
{


System.out.println("Receiver ready ...");
ServerSocket ss = new ServerSocket(9000);
while (true)
{
//System.out.println("Recibido cliente");
Socket socket = ss.accept();
System.out.println("Recibido cliente");
new TalkThread(socket).start();
//new TalkThread(socket).enumerate(Thread[] tarray);
}
}
}

y para un cliente es:



import java.net.*;
import java.io.*;

public class Talk2
{
public static void main(String args[]) throws Exception
{

Socket socket = new Socket("127.0.0.1",9000);
OutputStream out = socket.getOutputStream();

PrintStream salida = new PrintStream(out);
BufferedReader teclado = new BufferedReader(new InputStreamReader(System.in));
String line;
System.out.println("Sender Ready ...");

System.out.print(">>");
while (!(line=teclado.readLine()).equals("quit"))
{
salida.println(line);
System.out.print(">>");

}
salida.println("quit");
out.close();
}

}