Let me try to answer your questions:
First of all: You don't really need knowledge of JSP and HTML for creating WebServices. If you are interested in additional knowledge rather have a look in subjects like SOAP, WSDL or XML (on which SOAP and WSDL files are based). You can find good informations at w3schools.
As said in your assignments requirement you'll have combine your service with a database, therefore you'll have to face the fact that WebServices aren't able to send every kind of data. For example, if you intend to use some kind of JPA you wont be able to send entities between Client and Server via WebService easily (though its possible).
For the reason of that my approach would be to send simple datatypes between client and server and, on server side, build my complex objects.
This would force me to code at least 3 classes (one for each webservice and one for communication with the database).
Airline WS:
@WebService
public class Airline {
@WebMethod
public String stuffToDo {
// do your stuff
persistOrSelect(complexObject);
return "success";
}
private boolean persistOrSelectData(Object complex) {
// Database stuff here
DBdao.doStuff(complex);
return true;
}
}
TravelAgent WS:
// same structure as shown above
DB class:
public class DBdao {
public static doStuff(Object complex) {
// get DB connection and INSERT, SELECT, UPDATE
}
}
In this scenario you didn't even have to use a class out of the javax.ejb
package but I understand that this could be necessary :).
I don't really use Netbeans and therefore I can only speculate. I think that your problems 2.) and 3.) relate to each other.
The javax.*
package normally is located in your JDK and should be specified in your IDE inside the server library/target runtime
your using.
- Do you have assigned the
server library
to your project?
- Have you tried to point your Netbeans installation to your JDK path as shown here and here?
- It could also be possible that your project do not have a reference to the
Java System library
.
Last but not least:
There are several ways for testing your webservice:
- You use Netbeans therfore I assume that you deploy your project on an Glassfish server.
After deployment you can navigate to your project inside the admin gui and click the link pointing to view endpoints. In the next window your able to either follow a link pointing to the generated WSDL
or to a tester
- You can write your own client by either following the tutorial provided or, for a more general approach you can use this.
- Use soapUI for testing (it's available as standalone application or as IDE plugin)
I hope this helpes, have Fun!