9/8/2010 3:18:07 AM
Title:
Laishram
While connecting webservices from flex client using axis with Java, is it possible to get data from the java program (in Object format )?
9/8/2010 5:12:11 AM
you can load the data as text or variables only. Flex does not support loading objects. To load a data it should be formatted in the GET request format separated by & character :
var1=value1&var2=value2
9/8/2010 6:32:47 AM
Actually the issue is when I am trying to communicate with java using axis.I am trying to get the hashMap values from java and decode it in flex. It's not working.
Thanks
import java.sql.*;
import java.util.*;
public class PowerplantWebServices {
public String name ="";
public String severityLevel = "";
public String geeksType = "";
public String post = "";
public int age =0;
public List records;
public List mouseOver(){
System.out.println("Getting All Rows from a table!");
Connection con = null;
String url = "jdbc:mysql://localhost:3306/";
String db = "ppdb";
String driver = "com.mysql.jdbc.Driver";
String user = "root";
String pass = "root";
List ls = null;
try{
Class.forName(driver).newInstance();
con = DriverManager.getConnection(url+db, user, pass);
try{
Statement st = con.createStatement();
ResultSet res = st.executeQuery("SELECT * FROM mouseOver");
//System.out.println("Emp_code: " + "\t" + "Emp_name: ");
records = new ArrayList();
int i =0;
while (res.next()) {
Map hm = new HashMap();
name = res.getString("name");
severityLevel = res.getString("severityLevel");
geeksType = res.getString("geeksType");
post = res.getString("post");
age = res.getInt("age");
hm.put("name", name);
hm.put("severityLevel", severityLevel);
hm.put("geeksType", geeksType);
hm.put("post", post);
hm.put("age", age);
records.add(hm);
// records.add(severityLevel);
// records.add(geeksType);
// records.add(post);
// records.add(age);
System.out.println("name:::"+hm.get("name")+" severityLevel"+hm.get("severityLevel")+" geekdType"+geeksType+" post"+post+" age"+hm.get("age"));
}
con.close();
}
catch (SQLException s){
System.out.println("SQL code does not execute.");
}
}
catch (Exception e){
e.printStackTrace();
}
ls = records;
return ls;
}
public String hello(String name) {
return "Hello "+name;
}
public static void main(String[] args){
PowerplantWebServices pws = new PowerplantWebServices();
pws.mouseOver();
}
}