You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Swetta Bhaskar <sb...@csidentity.com> on 2011/04/05 20:59:53 UTC

server class

Hello,

Can I not return Resultset as a return type from my Java class(Server.)

 

I am getting error with following response.

 

 

-
<http://127.0.0.1:50669/wse/wsdl/soap_envelope_xml.jsp?soapEnvelopeType=
1>  <soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

-
<http://127.0.0.1:50669/wse/wsdl/soap_envelope_xml.jsp?soapEnvelopeType=
1>  <soapenv:Body>

-
<http://127.0.0.1:50669/wse/wsdl/soap_envelope_xml.jsp?soapEnvelopeType=
1>  <soapenv:Fault>

  <faultcode>soapenv:Server</faultcode> 

  <faultstring>org.apache.axis2.AxisFault: Mapping qname not fond for
the package: com.mysql.jdbc</faultstring> 

  <detail /> 

  </soapenv:Fault>

  </soapenv:Body>

  </soapenv:Envelope>

 

If yes please let me know:

 

   Java Class I have commented code using ArrayList, ArrayList worked
fine for me but I should not use it so:

package sdsdd;

 

import java.sql.*;

import java.util.ArrayList;

import java.util.List;

 

public class add {

                

                public ResultSet res(String group){

                                Connection con;

                                List result = null;

                                String query;

                                ResultSet rs=null;

                                ArrayList<Object> arr=new
ArrayList<Object>();

                                                try {

                                                                

                                                                

Class.forName("com.mysql.jdbc.Driver");

String url = "jdbc:mysql://localhost:3306/test";

con = DriverManager.getConnection(url, "root", "abcd1234");

Statement st = con.createStatement();

query="select * from detail where group1='"+ group + "'";

rs = st.executeQuery(query);

ResultSetMetaData col=rs.getMetaData();

int numCol=col.getColumnCount();

System.out.println(numCol);

while(rs.next())

         {

//ArrayList<Object> l=new ArrayList<Object>();

//

//

//      l.add(rs.getInt(1));

//      l.add(rs.getString(2));

//      l.add(rs.getString(3));

//  

//

//

//     arr.addAll(l);

                rs.getInt(1);

         }

 

 

 

                                                } catch
(ClassNotFoundException e) {

                                                                // TODO
Auto-generated catch block

 
e.printStackTrace();

                                                } catch (SQLException e)
{

                                                                // TODO
Auto-generated catch block

 
e.printStackTrace();

                                                }

                                                return rs;

}

 

}

 

 

 

If not which is the best possible way to return a  resultset.


Re: server class

Posted by Android MD <an...@gmail.com>.
A ResultSet is a complex structure.. Anyway, it is a data tier related
object, which should not be exposed through the web service. Any data
retrieved from the database should be packaged into SIMPLE business domain
objects before being sent down the wire through the web service. So you
might have to redesign your app..

On Wed, Apr 6, 2011 at 6:15 AM, Deepal Jayasinghe <de...@opensource.lk>wrote:

>  Yes, probably it is hard to serialize ResultSet. You need to use something
> like data services for this.
>
> Deepal
>
>
>  Hello,
>
> Can I not return Resultset as a return type from my Java class(Server.)
>
>
>
> I am getting error with following response.
>
>
>
>
>
> *-*<http://127.0.0.1:50669/wse/wsdl/soap_envelope_xml.jsp?soapEnvelopeType=1>
> <soapenv:Envelope xmlns:soapenv="*
> http://schemas.xmlsoap.org/soap/envelope/*">
>
> *-*<http://127.0.0.1:50669/wse/wsdl/soap_envelope_xml.jsp?soapEnvelopeType=1>
> <soapenv:Body>
>
> *-*<http://127.0.0.1:50669/wse/wsdl/soap_envelope_xml.jsp?soapEnvelopeType=1>
> <soapenv:Fault>
>
>   <faultcode>soapenv:Server</faultcode>
>
>   <faultstring>org.apache.axis2.AxisFault: Mapping qname not fond for the
> package: com.mysql.jdbc</faultstring>
>
>   <detail />
>
>   </soapenv:Fault>
>
>   </soapenv:Body>
>
>   </soapenv:Envelope>
>
>
>
> If yes please let me know:
>
>
>
>    Java Class I have commented code using ArrayList, ArrayList worked fine
> for me but I should not use it so:
>
> package sdsdd;
>
>
>
> import java.sql.*;
>
> import java.util.ArrayList;
>
> import java.util.List;
>
>
>
> public class add {
>
>
>
>                 public ResultSet res(String group){
>
>                                 Connection con;
>
>                                 List result = null;
>
>                                 String query;
>
>                                 ResultSet rs=null;
>
>                                 ArrayList<Object> arr=new
> ArrayList<Object>();
>
>                                                 try {
>
>
>
>
>
> Class.forName("com.mysql.jdbc.Driver");
>
> String url = "jdbc:mysql://localhost:3306/test";
>
> con = DriverManager.getConnection(url, "root", "abcd1234");
>
> Statement st = con.createStatement();
>
> query="select * from detail where group1='"+ group + "'";
>
> rs = st.executeQuery(query);
>
> ResultSetMetaData col=rs.getMetaData();
>
> int numCol=col.getColumnCount();
>
> System.out.println(numCol);
>
> while(rs.next())
>
>          {
>
> //ArrayList<Object> l=new ArrayList<Object>();
>
> //
>
> //
>
> //      l.add(rs.getInt(1));
>
> //      l.add(rs.getString(2));
>
> //      l.add(rs.getString(3));
>
> //
>
> //
>
> //
>
> //     arr.addAll(l);
>
>                 rs.getInt(1);
>
>          }
>
>
>
>
>
>
>
>                                                 } catch
> (ClassNotFoundException e) {
>
>                                                                 // TODO
> Auto-generated catch block
>
>
> e.printStackTrace();
>
>                                                 } catch (SQLException e) {
>
>                                                                 // TODO
> Auto-generated catch block
>
>
> e.printStackTrace();
>
>                                                 }
>
>                                                 return rs;
>
> }
>
>
>
> }
>
>
>
>
>
>
>
> If not which is the best possible way to return a  resultset.
>
>

Re: server class

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Yes, probably it is hard to serialize ResultSet. You need to use
something like data services for this.

Deepal

> Hello,
>
> Can I not return Resultset as a return type from my Java class(Server.)
>
>  
>
> I am getting error with following response.
>
>  
>
>  
>
> *-*
> <http://127.0.0.1:50669/wse/wsdl/soap_envelope_xml.jsp?soapEnvelopeType=1>
> <soapenv:Envelopexmlns:soapenv="*http://schemas.xmlsoap.org/soap/envelope/*">
>
> *-*
> <http://127.0.0.1:50669/wse/wsdl/soap_envelope_xml.jsp?soapEnvelopeType=1>
> <soapenv:Body>
>
> *-*
> <http://127.0.0.1:50669/wse/wsdl/soap_envelope_xml.jsp?soapEnvelopeType=1>
> <soapenv:Fault>
>
>  <faultcode>soapenv:Server</faultcode>
>
>  <faultstring>org.apache.axis2.AxisFault: Mapping qname not fond for
> the package: com.mysql.jdbc</faultstring>
>
>  <detail />
>
>  </soapenv:Fault>
>
>  </soapenv:Body>
>
>  </soapenv:Envelope>
>
>  
>
> If yes please let me know:
>
>  
>
>    Java Class I have commented code using ArrayList, ArrayList worked
> fine for me but I should not use it so:
>
> package sdsdd;
>
>  
>
> import java.sql.*;
>
> import java.util.ArrayList;
>
> import java.util.List;
>
>  
>
> public class add {
>
>                
>
>                 public ResultSet res(String group){
>
>                                 Connection con;
>
>                                 List result = null;
>
>                                 String query;
>
>                                 ResultSet rs=null;
>
>                                 ArrayList<Object> arr=new
> ArrayList<Object>();
>
>                                                 try {
>
>                                                                
>
>                                                                
>
> Class.forName("com.mysql.jdbc.Driver");
>
> String url = "jdbc:mysql://localhost:3306/test";
>
> con = DriverManager.getConnection(url, "root", "abcd1234");
>
> Statement st = con.createStatement();
>
> query="select * from detail where group1='"+ group + "'";
>
> rs = st.executeQuery(query);
>
> ResultSetMetaData col=rs.getMetaData();
>
> int numCol=col.getColumnCount();
>
> System.out.println(numCol);
>
> while(rs.next())
>
>          {
>
> //ArrayList<Object> l=new ArrayList<Object>();
>
> //
>
> //
>
> //      l.add(rs.getInt(1));
>
> //      l.add(rs.getString(2));
>
> //      l.add(rs.getString(3));
>
> // 
>
> //
>
> //
>
> //     arr.addAll(l);
>
>                 rs.getInt(1);
>
>          }
>
>  
>
>  
>
>  
>
>                                                 } catch
> (ClassNotFoundException e) {
>
>                                                                 //
> TODO Auto-generated catch block
>
>                                                                
> e.printStackTrace();
>
>                                                 } catch (SQLException e) {
>
>                                                                 //
> TODO Auto-generated catch block
>
>                                                                
> e.printStackTrace();
>
>                                                 }
>
>                                                 return rs;
>
> }
>
>  
>
> }
>
>  
>
>  
>
>  
>
> If not which is the best possible way to return a  resultset.
>

Re: server class

Posted by Afkham Azeez <af...@gmail.com>.
Try http://wso2.com/products/data-services-server/ which is built on Axis2.


On Wed, Apr 6, 2011 at 12:29 AM, Swetta Bhaskar <sb...@csidentity.com>wrote:

> Hello,
>
> Can I not return Resultset as a return type from my Java class(Server.)
>
>
>
> I am getting error with following response.
>
>
>
>
>
> *-*<http://127.0.0.1:50669/wse/wsdl/soap_envelope_xml.jsp?soapEnvelopeType=1>
> <soapenv:Envelope xmlns:soapenv="*
> http://schemas.xmlsoap.org/soap/envelope/*">
>
> *-*<http://127.0.0.1:50669/wse/wsdl/soap_envelope_xml.jsp?soapEnvelopeType=1>
> <soapenv:Body>
>
> *-*<http://127.0.0.1:50669/wse/wsdl/soap_envelope_xml.jsp?soapEnvelopeType=1>
> <soapenv:Fault>
>
>   <faultcode>soapenv:Server</faultcode>
>
>   <faultstring>org.apache.axis2.AxisFault: Mapping qname not fond for the
> package: com.mysql.jdbc</faultstring>
>
>   <detail />
>
>   </soapenv:Fault>
>
>   </soapenv:Body>
>
>   </soapenv:Envelope>
>
>
>
> If yes please let me know:
>
>
>
>    Java Class I have commented code using ArrayList, ArrayList worked fine
> for me but I should not use it so:
>
> package sdsdd;
>
>
>
> import java.sql.*;
>
> import java.util.ArrayList;
>
> import java.util.List;
>
>
>
> public class add {
>
>
>
>                 public ResultSet res(String group){
>
>                                 Connection con;
>
>                                 List result = null;
>
>                                 String query;
>
>                                 ResultSet rs=null;
>
>                                 ArrayList<Object> arr=new
> ArrayList<Object>();
>
>                                                 try {
>
>
>
>
>
> Class.forName("com.mysql.jdbc.Driver");
>
> String url = "jdbc:mysql://localhost:3306/test";
>
> con = DriverManager.getConnection(url, "root", "abcd1234");
>
> Statement st = con.createStatement();
>
> query="select * from detail where group1='"+ group + "'";
>
> rs = st.executeQuery(query);
>
> ResultSetMetaData col=rs.getMetaData();
>
> int numCol=col.getColumnCount();
>
> System.out.println(numCol);
>
> while(rs.next())
>
>          {
>
> //ArrayList<Object> l=new ArrayList<Object>();
>
> //
>
> //
>
> //      l.add(rs.getInt(1));
>
> //      l.add(rs.getString(2));
>
> //      l.add(rs.getString(3));
>
> //
>
> //
>
> //
>
> //     arr.addAll(l);
>
>                 rs.getInt(1);
>
>          }
>
>
>
>
>
>
>
>                                                 } catch
> (ClassNotFoundException e) {
>
>                                                                 // TODO
> Auto-generated catch block
>
>
> e.printStackTrace();
>
>                                                 } catch (SQLException e) {
>
>                                                                 // TODO
> Auto-generated catch block
>
>
> e.printStackTrace();
>
>                                                 }
>
>                                                 return rs;
>
> }
>
>
>
> }
>
>
>
>
>
>
>
> If not which is the best possible way to return a  resultset.
>



-- 
*Afkham Azeez*
Senior Software Architect & Senior Manager; WSO2, Inc.; http://wso2.com,
*
*
*Member; Apache Software Foundation;
**http://www.apache.org/*<http://www.apache.org/>
*
email: **azeez@wso2.com* <az...@wso2.com>* cell: +94 77 3320919
blog: **http://blog.afkham.org* <http://blog.afkham.org>*
twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez>
*
linked-in: **http://lk.linkedin.com/in/afkhamazeez*
*
*
*Lean . Enterprise . Middleware*
*
*