Return-Path: Delivered-To: apmail-ws-axis-user-archive@www.apache.org Received: (qmail 5382 invoked from network); 27 Oct 2008 16:15:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 Oct 2008 16:15:14 -0000 Received: (qmail 68414 invoked by uid 500); 27 Oct 2008 16:15:11 -0000 Delivered-To: apmail-ws-axis-user-archive@ws.apache.org Received: (qmail 67469 invoked by uid 500); 27 Oct 2008 16:15:05 -0000 Mailing-List: contact axis-user-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-user@ws.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-user@ws.apache.org Received: (qmail 67458 invoked by uid 99); 27 Oct 2008 16:15:05 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Oct 2008 09:15:05 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of muthana@gmx.de designates 213.165.64.20 as permitted sender) Received: from [213.165.64.20] (HELO mail.gmx.net) (213.165.64.20) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 27 Oct 2008 16:13:49 +0000 Received: (qmail invoked by alias); 27 Oct 2008 16:14:24 -0000 Received: from lbck-4dbaf02f.pool.einsundeins.de (EHLO tuhhnbkv3124) [77.186.240.47] by mail.gmx.net (mp066) with SMTP; 27 Oct 2008 17:14:24 +0100 X-Authenticated: #6119033 X-Provags-ID: V01U2FsdGVkX1+WfIwbP06WVH7YW1/AsdU3k3awrjSJa8hSWzt9jE NNZFGlHVAKiLW3 From: "Muthana Al-Temimi" To: Subject: need help in axis Date: Mon, 27 Oct 2008 17:14:21 +0100 Message-ID: <003201c9384f$1293fcb0$37bbf610$@de> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0033_01C93857.745864B0" X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Ack4TxJHAc2crqhlS66iihIvmdFGHg== Content-Language: de X-Y-GMX-Trusted: 0 X-FuHaFi: 0.49,0.49 X-Virus-Checked: Checked by ClamAV on apache.org ------=_NextPart_000_0033_01C93857.745864B0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Hello there, i'm new in Axis and i wrote the following code in java package logistic.ws.serverside; import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; import java.sql.ResultSet; public class AnimalService { final int idVal = 0; private String name ; private String category; private String[] retVal = new String[2]; Connection conn = null; public AnimalService () {} public String getAnimals() { return name+category; } public String[] findAnimal(int idVal) { try { String userName = "root"; String password = "muthana"; String url = "jdbc:mysql://localhost:3306/logit"; try { Class.forName ("com.mysql.jdbc.Driver").newInstance (); }catch (ClassNotFoundException e){ System.out.println ( " Unable to load Driver Class "); } conn = DriverManager.getConnection (url, userName, password); System.out.println ("Database connection established"); Statement s = conn.createStatement (); String query = "SELECT name,category FROM animal where id="+ idVal +""; System.out.println(query); ResultSet rs = s.executeQuery(query); while (rs.next ()) { // animals = rs.getString(1); // category=rs.getString(2); /* String nameVal = rs.getString ("name"); String catVal = rs.getString ("category"); System.out.println ( "id = " + idVal + ", name = " + nameVal + ", category = " + catVal); */ String X1 = rs.getString(1); String X2 = rs.getString(2); System.out.println (X1); System.out.println (X2); this.name = X1 ; this.category = X2 ; // I think that my problem is here 2 string in array String[] retVal= {X1,X2}; } rs.close (); s.close (); }catch (Exception e) { System.err.println ("Cannot connect to database server"); System.err.println ("Error message: " + e.getMessage ()); } finally { if (conn != null) { try { conn.close (); System.out.println ("Database connection terminated"); } catch (Exception e) { /* ignore close errors */ } } } return retVal; } /* public static void main (String[] args) { AnimalService animalws = new AnimalService(); animalws.findAnimal(1); } // end main method */ } The response is wrong as follow: The request is correct: 2 I think my problem is how to map array into string I need help to fix that to get the result from the database. Any help will be good Thanks muthana ------=_NextPart_000_0033_01C93857.745864B0 Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable

Hello there,

 

i’m new in Axis and i = wrote the following code in java

package logistic.ws.serverside;

 

 

 

 

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.Statement;

import java.sql.ResultSet;

 

 

public class AnimalService {

 

     

         &= nbsp;  final int idVal =3D 0;

         &= nbsp;  private String name ;

      =       private String category;

      =       private String[] retVal =3D new String[2];

      =      

      =      

      =      

      =      

      =       Connection conn =3D null;

         &= nbsp; 

      =       public  AnimalService () {}

      =      

      =      

      =       public String getAnimals() {

         &= nbsp;        return name+category;

         &= nbsp;  }

 

      =      

      =      

          =

      =         public String[] findAnimal(int idVal) = {

      =        

      =         try

      =         {

      =             String userName =3D "root";

      =             String password =3D "muthana";

      =             String url =3D "jdbc:mysql://localhost:3306/logit";

      =             try {

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

      =             }catch (ClassNotFoundException = e){

      =                   System.out.println ( " Unable to load Driver Class ");     =

      =                  

      =             }

      =             conn =3D DriverManager.getConnection (url, userName, password);

      =             System.out.println ("Database connection established");

      =             Statement s =3D conn.createStatement ();

      =            

      =            

      =             String query =3D "SELECT name,category FROM animal = where id=3D"+ idVal +"";

      =            

      =             System.out.println(query);

      =             =

      =             ResultSet rs =3D s.executeQuery(query);

      =            

      =             while (rs.next ())

      =             {

      =             &= nbsp; 

      =             &= nbsp;  

      =             &= nbsp; 

      =             &= nbsp; 

         &= nbsp;           &n= bsp;       // animals =3D rs.getString(1);

         &= nbsp;           &n= bsp;       // category=3Drs.getString(2);

 

         &= nbsp;           &n= bsp;       /*

         = ;            =         String nameVal =3D rs.getString ("name");

      =             &= nbsp;   String catVal =3D rs.getString ("category");

      =             &= nbsp;   System.out.println ( "id =3D " + idVal + ", name =3D = " + nameVal  + ", category =3D " + catVal);

      =             &= nbsp;          

      =         =         */

         &= nbsp;           &n= bsp;      

         &= nbsp;           &n= bsp;       String X1 =3D rs.getString(1);

         &= nbsp;           &n= bsp;       String X2 =3D rs.getString(2);

         &= nbsp;           &n= bsp;       System.out.println (X1);

         &= nbsp;           &n= bsp;       System.out.println (X2);

         &= nbsp;           &n= bsp;      

         &= nbsp;           &n= bsp;       this.name =3D  X1 ;

         &= nbsp;           &n= bsp;       this.category =3D  X2 ;

         &= nbsp;           &n= bsp;      

         &= nbsp;           &n= bsp;      

           &= nbsp;           &n= bsp;     // I think that my problem is here 2 string in array

         &= nbsp;           &n= bsp;       String[] retVal=3D {X1,X2};

         &= nbsp;           &n= bsp;      

      =             }

      =             rs.close ();

      =             s.close ();

      =            

      =            

      =           

 

      =         }catch (Exception e)

      =         {

      =             System.err.println ("Cannot connect to database server");

      =             System.err.println ("Error message: " + e.getMessage ());

         &= nbsp;    

      =            =

      =         = }

      =         finally

      =         {

      =             if (conn !=3D null)

      =             {

      =             &= nbsp;   try

      =             &= nbsp;   {

      =             &= nbsp;       conn.close ();

      =             &= nbsp;       System.out.println ("Database connection terminated");

      =             &= nbsp;   }

      =             &= nbsp;   catch (Exception e) { /* ignore close errors */ }

      =             }

      =         }

          =

      =         return retVal;

      =        

      =       

 

}    

      =        

      =        

      =       

      =        

      /*

      =      

         = ;         public static void main (String[] args)

         = ;       {

         = ;      AnimalService animalws =3D new AnimalService();

         = ;      animalws.findAnimal(1);

      =         }  // end main method

      =        

      =    */   

}     =

 

 

      =

 

 

The response is wrong as = follow:

 

<?xml = version=3D"1.0" encoding=3D"utf-8" = standalone=3D"no"?>

<soapenv:Envelope xmlns:soapenv=3D"http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema" xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance">

<soapenv:Body>

<findAnimalResponse xmlns=3D"http://serverside.ws.logistic">

<findAnimalReturn xsi:nil=3D"true"/>

<findAnimalReturn xsi:nil=3D"true"/>

</findAnimalResponse>

</soapenv:Body>

</soapenv:Envelope>

 

The request is = correct:

 

<?xml = version=3D"1.0" encoding=3D"UTF-8" = standalone=3D"no"?>

<soapenv:Envelope xmlns:soapenv=3D"http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema" xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance">

<soapenv:Body>

<findAnimal xmlns=3D"http://serverside.ws.logistic">

<idVal>2</idVal>

</findAnimal>

</soapenv:Body>

</soapenv:Envelope>

 

I think my problem is how to map = array into string

I need help to fix that to get = the result from the database.

 

Any help will be = good

 

Thanks

muthana

------=_NextPart_000_0033_01C93857.745864B0--