Meaningless Drivel is fun!*
The moose likes Web Services and the fly likes Java client doesn't throw exception if endpoint url is incorrect? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Java client doesn Watch "Java client doesn New topic
Author

Java client doesn't throw exception if endpoint url is incorrect?

Dario Rehman
Greenhorn

Joined: Nov 24, 2006
Posts: 18
I am testing a Java Web Service client that is generated with Axis 1.3.
I noticed that if I change the outPort address (endpoint) to a URL that is incorrect, no exception is thrown, but when I look at the TCP traffic, obviously there is a "HTTP 404 Not Found" error.
Why is this happening? How can I check if the call was successful?

Thanks.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41186
    
  45
Well, are you still getting the correct response, or actually any response? Surely there must be some difference if you run the code?


Ping & DNS - my free Android networking tools app
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
With a stub generated with WSDL2Java it throws an org.apache.axis.AxisFault.

sasank ch
Greenhorn

Joined: Nov 07, 2007
Posts: 25
how about inserting code in your program something like this to know if there is an error

if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
Dario Rehman
Greenhorn

Joined: Nov 24, 2006
Posts: 18
This is how I have to invoke my WS (given the code that WSDL2Java generates). If the endpoint URL is incorrect or the authentication fails no exception is thrown with this code. Why is this happening?



Originally posted by Peer Reynders:
With a stub generated with WSDL2Java it throws an org.apache.axis.AxisFault.


[ November 21, 2007: Message edited by: Dario Rehman ]
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
Why are you creating a new stub (with a null endpoint URL nonetheless) ? That is the locator's job.

I would expect the code to look something like this:

Dario Rehman
Greenhorn

Joined: Nov 24, 2006
Posts: 18
You are right, he stub is misplaced. This is the code I am using.
The original problem remains, though...




Originally posted by Peer Reynders:
Why are you creating a new stub (with a null endpoint URL nonetheless) ? That is the locator's job.

I would expect the code to look something like this:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java client doesn't throw exception if endpoint url is incorrect?
 
Similar Threads
Error : Axis Engine Cudn't find the target
Creating web service client
Asynchronious WebService and Callback method
Testing if I can send SOAP Messages
Servlet endpoint Vs EJB endpoint