File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Querying Raspberry Pi Server through XML API (ZigBee Gateway)

 
Henry Sellers
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I'm using a Raspberry Pi as ZigBee Gateway and I have an API from Smartenit which has simple XML queries which are not working for me...it worked yesterday but now......!

The port and IP address are definitely correct...any ideas please?!

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;

public class SimpleSocketServer {

@SuppressWarnings("resource")
public static void main(String args[]) throws Exception {

ServerSocket serverSocket;
int portNumber = 50333;
Socket socket = new Socket("192.168.1.27", portNumber);
String str;

str = "<zbpPacket>";
str += "<Object>ZBP_System</Object>";
str += "<methodName>Sys_Authenticate</methodName>";
str += "<Arguments>";
str += "<Argument type='string'>Smartenit</Argument>";
str += "</Argument>";
str += "</Arguments>";
str += "</zbpPacket>";

System.out.println(str);
serverSocket = new ServerSocket(portNumber);

System.out.println("Waiting for a connection on " + portNumber);

socket = serverSocket.accept();

InputStreamReader isr = new InputStreamReader(socket.getInputStream());
BufferedReader in = new BufferedReader(isr);

String line = "";
while ((line = in.readLine()) != null) {
System.out.println(line);
}


in.close();
isr.close();
socket.close();

}

}
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic