Web service newbie, all help appreciated ...

Hi,

Whats the best way to serve data from a MySQL database as a webservice. All I would like to do is run a simple SELECT query and then return the results to the web service client.

I have setup AXIS on TOMCAT on APACHE, and have installed MySQL 5 and the JDBC driver.

Could anyone please give me a step by step example, or point me to a decent tutorial they know of, as googling this topic doesn't really return anything that helpful.

Thanks in advance for any help.

Mic

[510 byte] By [Mic_Pringlea] at [2007-10-2 6:21:15]
# 1
[url= http://java.sun.com/webservices/docs/1.6/tutorial/doc/index.html]Java Web Services Tutorial[/url]
MartinHilperta at 2007-7-16 13:23:02 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2
From what I can see, there is no mention of databases in that tutorial. Could you please be a little more specific !?Mic
Mic_Pringlea at 2007-7-16 13:23:02 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3

I'm not very experienced either and I haven't used AXIS but my guess is that you would need to write a wsdl file to describe your service and then use one of AXIS generators (i think it's called wsdl2java or something like that) to generate all the stubs and skeleton classes.

After that, you need to find the implementation class of your web service (the name should be something lime YourService_Impl.java) and put your code there.

pedroesa at 2007-7-16 13:23:02 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 4

Hi pedroes,

Thanks for that, it's a good start ... but what else I'm looking for is code examples for connecting to and querying the MySQL database using the JDBC connector, and also how exactly I return my results ... ie:

If I have a simple class like the following ...

public class HiWSImpl implements HiWSSEI {

public String sayHi(java.lang.String s) {

return "Hi " + s + "!";

}

}

It simply returns a string as

<item xsi:type="xsd:string"></item>

... but how do I return a result set from executing a query !?

Mic

Mic_Pringlea at 2007-7-16 13:23:02 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 5
I think that you need to convert your result set into some kind of string and then return that. Maybe you can get your data in an xml format from the database and then return that?
pedroesa at 2007-7-16 13:23:02 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...