ResultSet to WebService

Discussion in 'Java' started by carmelo, Oct 21, 2008.

  1. carmelo

    carmelo Guest

    Hi everybody,
    I've got a ResultSet, selected by a query, which I should send to a
    Web Service. I thought to loop on it for sending one record at time.
    I'm trying to encapsulate each record fields on an ArrayList<String>.
    What do you think about it?
    Would you suggest me Eclipse or Netbeans to create the WebService and
    a Client for it?


    I hope you can help me
    Thank you very much in advance
    Carmelo
     
    carmelo, Oct 21, 2008
    #1
    1. Advertising

  2. carmelo

    carmelo Guest

    On 21 Ott, 14:38, Lew <> wrote:
    > carmelo wrote:
    > > I've got a ResultSet, selected by a query, which I should send to a
    > > Web Service. I thought to loop on it for sending one record at time.
    > > I'm trying to encapsulate each record fields on an ArrayList<String>.
    > > What do you think about it?

    >
    > I think that 'String' is about the worst choice for sending binary data.


    What do you suggest?

    > > Would you suggest me Eclipse or Netbeans [sic] to create the WebService and
    > > a Client for it?

    >
    > Oh, absolutely.  Both are fine IDEs.  You'll probably find that one suits your
    > style better than the other.


    I'm seeing that Netbeans make things easier for developing WebServices
    and Clients...
     
    carmelo, Oct 21, 2008
    #2
    1. Advertising

  3. carmelo

    carmelo Guest

    On 21 Ott, 15:18, Lew <> wrote:
    > carmelo wrote:
    > > On 21 Ott, 14:38, Lew <> wrote:
    > >> carmelo wrote:
    > >>> I've got a ResultSet, selected by a query, which I should send to a
    > >>> Web Service. I thought to loop on it for sending one record at time.
    > >>> I'm trying to encapsulate each record fields on an ArrayList<String>.
    > >>> What do you think about it?
    > >> I think that 'String' is about the worst choice for sending binary data.

    >
    > > What do you suggest?

    >
    > Use the standard type-to-XML mappings supported by various web-service
    > libraries.  So if a column in the result set is a Date, for example, send it
    > as a Date.
    >
    > Yes, XML is a string, but that's not what I was talking about.
    >
    > --
    > Lew


    Please make me an example or tell me where can I find these info.

    The code I'm trying to run is this:


    - WebService

    package dbws;

    public class DBWS {
    public String insert(ArrayList<String> fields)
    {
    //fields extraction
    String f1 = fields.get(0);
    String f2 = fields.get(1);
    return f1+f2;
    }
    }

    - Client

    package dbws_client;

    public class Main {
    public static void main(String[] args) {

    String f1="A";
    String f2="B";
    try { // Call Web Service Operation

    dbws.DBWS service = new dbws.DBWS();
    dbws.DBWSPortType port =
    service.getDBWSHttpSoap12Endpoint();
    // initialize WS operation arguments here
    ArrayList<String> fields = new ArrayList<String>();
    fields.add(f1);
    fields.add(f2);
    // process result here
    java.lang.String result = port.insert(fields);
    System.out.println("Result = " + result);
    } catch (Exception ex) {
    // handle custom exceptions here
    }

    }

    }


    What's going wrong?
     
    carmelo, Oct 21, 2008
    #3
  4. carmelo

    carmelo Guest

    I'm trying to send MyData class to the WebService. I created a Client
    using Netbeans, which made automatic binding for this class.

    The following is the code I'm trying to use:

    - WebService

    package dbws;

    public class DBWS {
    public String insert(MyData myd)
    {
    return myd.getVal();
    }

    }

    - Client

    package dbws_client;

    public class Main {
    public static void main(String[] args) {

    try { // Call Web Service Operation

    dbws.DBWS service = new dbws.DBWS();
    dbws.DBWSPortType port =
    service.getDBWSHttpSoap12Endpoint();
    // initialize WS operation arguments here
    dbws.xsd.MyData gpd = new dbws.xsd.MyData();

    gpd.setValue(new JAXBElement(null, String.class, new
    String("my_value")));

    // process result here
    java.lang.String result = port.insert(gpd);
    System.out.println("Result = " + result);
    } catch (Exception ex) {
    // handle custom exceptions here
    }

    }

    }


    The problem seems to be on gpd.setValue().
    This method is declared as follows: public void
    setValue(JAXBElement<String> value)


    I hope you can help me, I don't know how to continue..
     
    carmelo, Oct 22, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matrix
    Replies:
    0
    Views:
    579
    Matrix
    Apr 1, 2004
  2. matrix ¿ìÀÖÄñ

    How i know the size of "resultset"?

    matrix ¿ìÀÖÄñ, Apr 3, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    3,441
    matrix ¿ìÀÖÄñ
    Apr 3, 2004
  3. =?Utf-8?B?VGltX2s=?=

    Web Treeview loaded from resultset example

    =?Utf-8?B?VGltX2s=?=, Jun 18, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    342
    =?Utf-8?B?VGltX2s=?=
    Jun 18, 2004
  4. =?Utf-8?B?VGltX2s=?=

    Web Treeview loaded from resultset example

    =?Utf-8?B?VGltX2s=?=, Jun 18, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    259
    =?Utf-8?B?VGltX2s=?=
    Jun 18, 2004
  5. Joe via DotNetMonster.com

    Multiple Select Statements in resultset

    Joe via DotNetMonster.com, Mar 26, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    8,199
    Jim via DotNetMonster.com
    Mar 27, 2005
Loading...

Share This Page