Thanks for yout reply, I'm new to this dorum and to Webservices in
Java, sorry if my post was not clear.
I was asked to do this:
Our teacher gives us a JAVA Application, which is a WebService developed in Eclipse, running with Apache
Tomcat 6.0 no framework included.
So, the WebService process creation was like this:
New Dynamic Web Project -> new Java Class -> SumService.java
The code is like this:
To get the WebService, just click over the SumService.java in Project Explorer, WebService, create WebService.
Now, this is the tricky part for me, I have to manage Exceptions using SOAP 1.1 Standard with SOAP FAULTS and, in order to shoe that it really works, I have to force my application to throw that SoapFault.
I googled about the topic and many people recommended the following:
1. Use Spring
2. @WebFault annotation
3. SoapFaultException
My first option is discarded, 'cause we can't use frameworks. I tried with @Webfault annotation as I mentioned before and my process was like this:
1. Create a class that manage Exceptions with the annotation
@Webfault(name="SoapException" namespace="mynamespace.com")
public class ExceptionHandler extends Exception{
public ExceptionHandler(
String message){super(message);}
public ExceptionHandler(String message,Throwable cause){super(message,cause);}
}
[/code]
2. In the class which is my web Service, I forced like this:
Then, I create the WebService again, based on that class. And when I go to the
http://localhost.....?wsdl
I get what I show you previously.
I expected to receive the SOAP Fault, but as soon as you told me that I have to test with SOAPMonitor or with SOAPui, I did it with TCPMonitor and SOAPMonitor, but what I only get is the same that is in my wsdl, even when I forced my application.
Actually, I didn't even know that I was using AXIS.
3. I use the SoapFault class which is included in java.xml... library
And I added something like this:
And in my WebService class I throw that Exception
But neither of them seems to work.
There's a way in which I can receive this expected result when a Exception is launched?
1. <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
2. <SOAP-ENV:Header/>
3. <SOAP-ENV:Body>
4. <SOAP-ENV:Fault>
5. <faultcode>SOAP-ENV:Server</faultcode>
6. <faultstring xml:lang="en">FaultMsg</faultstring>
7. <detail>
8. <ServiceFault xmlns="http://stevideter.com/webservice">
9. <errorCode xmlns="">SERVICE-ERR</errorCode>
10. <errorDescription xmlns="">you can't do that!</errorDescription>
11. </ServiceFault>
12. </detail>
13. </SOAP-ENV:Fault>
14. </SOAP-ENV:Body>
15. </SOAP-ENV:Envelope>
I will be very grateful if you can help me or tell me how can I implement this functionality.
Thank you in advance