This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
Hi. I have an Axis2 web service and a web service client which is not based on Axis2. I wrote the client from scratch without using any 3rd party API (I'm using URLConnection). I have a login method in my web service which returns the user information if login is successful and an AxisFault containing a message if login failed. When I try to connect in my web service using the client I made, I was able to get the XML response of my web service if my login is successful. However, if my login failed, I am only able to receive IOException.
Here are my questions: 1. Does Java treat AxisFault as SOAPFault? I included SOAPFaultException in my try catch statement before the IOException but the exception still goes to IOException.
2. When I try to invoke exception.getMessage(), I only get a "Server returned HTTP response code: 500 for URL: ..." error message instead of the "Login failed. The username and password does not match." which is the message I set on my AxisFault. How do I get the error message I set on the server?
Some facts: 1. I am using Java both for my web service and web service client.
2. I am not using Axis2 API for my client. I'm writing it from scratch.
3. I am calling the web service in my client in REST style. (http://ip:port/services/webService/login?username=value1&password=value2)
4. I am able to view the AxisFault if I call my web service using my browser (Firefox and Chrome). Browser displays an XML:
5. If login fails and I'm using Internet Explorer to call the web service, I only get an HTTP 500 error message without the XML.
6. The TCP/IP Monitor of Eclipse shows that my web service was able to return a response containing a soap envelope of the fault. Below is the response displayed in TCP/IP Monitor:
Below is a code snippet from the client: