I have written a simple java file Calculator.java as below
public class Calculator {
public int add(int a, int b) {
return a+b;
}
public int subtract(int a, int b) {
return a-b;
}
}
Now, i renamed it to Calculator.jws and put it in my web application's root directory. (in the same directory as the WEB-INF directory). When i try to access this webservice using http://localhost:8680/webappcontextroot/Calculator.jws i get a message saying
"There is a Web Service here. Click to see the WSDL"
When i click on the link to see the WSDL file i get an error,
AXIS error
Could not generate WSDL!
There is no SOAP service at this location
When i wrote a client to invoke the web service, i get an Axis fault
- Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
Exception in thread "main" AxisFault
faultCode: {http://xml.apache.org/axis/}Server.NoService
faultSubcode:
faultString: The AXIS engine could not find a target service to invoke! targetService is null
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}hostname:D78D46BS
The AXIS engine could not find a target service to invoke! targetService is null
The WSDL file seems to be missing; but the oreilly tutorial tells all you have to do is just copy your java file to a .jws file and put it in your webapp and the webservice is ready to use.
Can someone help me with this?