×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Nov 2013
    Posts
    1

    help me please..How to call web service method in j2me??

    here is my web service..

    Code:
     import ahsanfile.webservice.util.DataBase;
    import ahsanfile.webservice.model.Karyawan;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.util.ArrayList;
    import java.util.List;
    import javax.jws.WebMethod;
    import javax.jws.WebParam;
    import javax.jws.WebService;
     /**
     *
     * @author ahsanfile
     */
    @WebService()
    public class DataKaryawan {
     /**
     * Web service operation
     */
     @WebMethod(operationName = "getKaryawan")
     public List<Karyawan> getKaryawan() {
     List<Karyawan> lk = new ArrayList<Karyawan>();
     DataBase db = new DataBase();
     try {
     String sql = "select * from tbl_karyawan";
     PreparedStatement ps = db.getConnection().prepareStatement(sql);
     ResultSet rs = ps.executeQuery();
     while (rs.next()) {
     Karyawan karyawan = new Karyawan();
     karyawan.setErrorMessage("");
     karyawan.setIdKaryawan(rs.getInt("id_karyawan"));
     karyawan.setNamaKaryawan(rs.getString("nama_karyawan"));
     karyawan.setAlamatKaryawan(rs.getString("alamat_karyawan"));
     karyawan.setEmailKaryawan(rs.getString("email_karyawan"));
     karyawan.setTeleponKaryawan(rs.getString("telepon_karyawan"));
     lk.add(karyawan);
     }
     return lk;
     } catch (Exception e) {
     Karyawan karyawan = new Karyawan();
     karyawan.setErrorMessage(e.getMessage());
     lk.add(karyawan);
     return lk;
     } finally {
     db.closeConnection();
     db = null;
     }
     }
     /**
     * Web service operation
     */
     @WebMethod(operationName = "cariKaryawan")
     public List<Karyawan> cariKaryawan(@WebParam(name = "namKaryawan")
     final String namKaryawan) {
     List<Karyawan> lk = new ArrayList<Karyawan>();
     DataBase db = new DataBase();
     try {
     String sql = "select * from tbl_karyawan where nama_karyawan like ?";
     PreparedStatement ps = db.getConnection().prepareStatement(sql);
     ps.setString(1, "%" + namKaryawan + "%");
     ResultSet rs = ps.executeQuery();
     while (rs.next()) {
     Karyawan karyawan = new Karyawan();
     karyawan.setErrorMessage("");
     karyawan.setIdKaryawan(rs.getInt("id_karyawan"));
     karyawan.setNamaKaryawan(rs.getString("nama_karyawan"));
     karyawan.setAlamatKaryawan(rs.getString("alamat_karyawan"));
     karyawan.setEmailKaryawan(rs.getString("email_karyawan"));
     karyawan.setTeleponKaryawan(rs.getString("telepon_karyawan"));
     lk.add(karyawan);
     }
     return lk;
     } catch (Exception e) {
     Karyawan karyawan = new Karyawan();
     karyawan.setErrorMessage(e.getMessage());
     lk.add(karyawan);
     return lk;
     } finally {
     db.closeConnection();
     db = null;
     }
     }
    }
    then i make java me web service client in my mobile project..
    [IMG]C:\Users\Master\Pictures\wsdl.png[/IMG]
    then what must i do??
    thx for your suggestions..

  2. #2
    Registered User
    Join Date
    Dec 2012
    Location
    India
    Posts
    264

    Re: help me please..How to call web service method in j2me??

    See if this article helps : http://developer.nokia.com/Community...ent_in_Java_ME

    For more web service based articles, check under : http://developer.nokia.com/Community...ces_on_Java_ME

    For sharing a picture,what I do is that I upload it to a hosting site and share that link.As you can see,the IMG tag is not helpful in this case.

Similar Threads

  1. Nokia SDK WEB Service Method Request
    By salginci in forum Qt
    Replies: 28
    Last Post: 2010-11-13, 11:25
  2. Background Service and Call In J2ME
    By devdattac in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2010-01-28, 13:37
  3. Method to lauch web browser, telephone call, GPS, video call etc
    By rayabhik in forum Symbian User Interface
    Replies: 4
    Last Post: 2009-06-26, 10:34
  4. [moved] how to call a web service from Http connection in j2me?
    By mindIt in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2009-02-10, 09:17
  5. Nothing Received From Web Service (JSR 172) Method
    By napperley in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2007-04-30, 02:02

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •