Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > ResultSet to WebService

Reply
Thread Tools

ResultSet to WebService

 
 
carmelo
Guest
Posts: n/a
 
      10-21-2008
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
 
Reply With Quote
 
 
 
 
carmelo
Guest
Posts: n/a
 
      10-21-2008
On 21 Ott, 14:38, Lew <(E-Mail Removed)> 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...
 
Reply With Quote
 
 
 
 
carmelo
Guest
Posts: n/a
 
      10-21-2008
On 21 Ott, 15:18, Lew <(E-Mail Removed)> wrote:
> carmelo wrote:
> > On 21 Ott, 14:38, Lew <(E-Mail Removed)> 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?
 
Reply With Quote
 
carmelo
Guest
Posts: n/a
 
      10-22-2008
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..
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Select Statements in resultset Joe via DotNetMonster.com ASP .Net 3 03-27-2005 12:43 AM
Web Treeview loaded from resultset example =?Utf-8?B?VGltX2s=?= ASP .Net 0 06-18-2004 04:52 AM
Web Treeview loaded from resultset example =?Utf-8?B?VGltX2s=?= ASP .Net 0 06-18-2004 04:51 AM
How i know the size of "resultset"? matrix ASP .Net 0 04-03-2004 07:30 AM
How i set this resultset size for call oracle package? Matrix ASP .Net 0 04-01-2004 06:38 AM



Advertisments