ResultSet to WebService

C

carmelo

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
 
C

carmelo

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...
 
C

carmelo

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.

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?
 
C

carmelo

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..
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top