Return-Path: Delivered-To: apmail-ws-axis-user-archive@www.apache.org Received: (qmail 23451 invoked from network); 5 Mar 2009 04:54:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Mar 2009 04:54:08 -0000 Received: (qmail 82739 invoked by uid 500); 5 Mar 2009 04:54:00 -0000 Delivered-To: apmail-ws-axis-user-archive@ws.apache.org Received: (qmail 82695 invoked by uid 500); 5 Mar 2009 04:53:59 -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 82686 invoked by uid 99); 5 Mar 2009 04:53:59 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Mar 2009 20:53:59 -0800 X-ASF-Spam-Status: No, hits=2.6 required=10.0 tests=DNS_FROM_OPENWHOIS,SPF_HELO_PASS,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Mar 2009 04:53:50 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1Lf5aL-0003hI-Rq for axis-user@ws.apache.org; Wed, 04 Mar 2009 20:53:29 -0800 Message-ID: <22345253.post@talk.nabble.com> Date: Wed, 4 Mar 2009 20:53:29 -0800 (PST) From: riveraej To: axis-user@ws.apache.org Subject: Question about exposing a database as a web service... MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: riveraej@gmail.com X-Virus-Checked: Checked by ClamAV on apache.org Hi everyone! I come to you asking for help. I'm trying to mount a web service which consults a MySQL Database. I have already done the consult, but I can show all data contained in the database, or I can show data according to conditions setting these conditions manually in the code of the Java Class. Nevertheless I need to pass in some way to my class a value in order to make the SQL consult according to this. Talking in code terms... I have the next code: public class poDBService{ public OrderData orderDetails(){ Connection conn = (Connection) MessageContext.getCurrentMessageContext().getProperty( poDataServiceLifeCycle.DB_CONNECTION); if (conn!=null){ try{ String SQL = "SELECT * FROM `porder` WHERE order_id=1"; PreparedStatement statement = conn.prepareStatement(SQL); ResultSet result = statement.executeQuery(); if (result.next()){ OrderData orderData = new OrderData(); orderData.setOrderId(result.getInt("order_id")); orderData.setSoldTo(result.getInt("soldTo")); orderData.setShipTo(result.getInt("shipTo")); I can access to my service through my browser in the address: http://localhost:8080/axis2/services/poDataService/orderDetails It correctly displays the corresponding data contained in the table porder But I need to define my SQL sentence allowing to pass it the needed parameter for the WHERE clause. I already found that some people makes it with code like the next: public class poDBService{ public OrderData orderDetails(int id){ Connection conn = (Connection) MessageContext.getCurrentMessageContext().getProperty( poDataServiceLifeCycle.DB_CONNECTION); if (conn!=null){ try{ String SQL = "SELECT * FROM `porder` WHERE order_id = " + id ; PreparedStatement statement = conn.prepareStatement(SQL); ResultSet result = statement.executeQuery(); if (result.next()){ OrderData orderData = new OrderData(); orderData.setOrderId(result.getInt("order_id")); orderData.setSoldTo(result.getInt("soldTo")); orderData.setShipTo(result.getInt("shipTo")); With this code theoretically it would be possible to pass paramete id to the service in the URL address: http://localhost:8080/axis2/services/poDataService/orderDetails?id=1 But when I try to do it in this way Axis returns in my web browser a Soap message like this: unknown No error is thorwn in JBoss console window. I'm using: - JBoss-4.2.2.G.A. - Axis2-1.3 - jdk1.5.0_17 - mysql-connector-java-5.1.7 - MySQL Server 5.1 Any ideas what is happening? or is there another way to do this? Thanks in advance! Ernesto J. Rivera -- View this message in context: http://www.nabble.com/Question-about-exposing-a-database-as-a-web-service...-tp22345253p22345253.html Sent from the Axis - User mailing list archive at Nabble.com.