How to debug tomcat webservice? - java

I'm running two instances of tomcat on the same machine for 2 parts of a web application(client app and server app). the client has no datastore and uses the server to interact with the database. The server app uses a wsdl web service to listen for GET requests from the client. I get an invalid login everytime I try to login through the client app. If I try to access the LoginService via browser directly I get this error from the catalina logs.
[PhaseInterceptorChain:369] Interceptor for {http://ws.myoscar_server.oscarehr.org/}LoginWsService has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: No such operation: (HTTP GET PATH_INFO: /myoscar_server/LoginService)

I'm not sure what you mean by "everytime i try to login." I think the error you see in the catalina logs is just saying that you are hitting the web service that is listening for only POST requests, but with a browser, you are sending a GET request. That error might be throwing you off. I would first use something like Firefox Poster to send a POST request to your service and see what the real error is.

Related

WSO2 API Manager Connection Error , "Error occurred while sending the HEAD request to the given endpoint url"

I'm trying to configure the WSO2 API Manager. (version - v4.0.0)
When I try to create REST API and point to the endpoints I"m getting a Connection error message for the given endpoints. I have hosted the API Manager and the back end services on the same server(backend services are running on the tomcat application on the same server in port 8080)
API Manager Log produces the following message :
ERROR {org.wso2.carbon.apimgt.rest.api.publisher.v1.impl.ApisApiServiceImpl} - Error occurred while sending the HEAD request to the given endpoint url: org.apache.commons.httpclient.ConnectTimeoutException: The host did not accept the connection within timeout of 4000 ms
would really like to what has caused the issue.
P.S: I can access the backend services directly without any connection issues using a REST client.
It's difficult to answer the question without knowing the exact details of your deployment and the backend. But let me try. Here is what I think is happening. As you can clearly see, the error is a connection timeout The host did not accept the connection within timeout of 4000 ms.
Let me explain what happens when you click on the Check Endpoint Status button. When you click on the Check Endpoint Status button, the Browser is not directly sending a request to the Backend to validate it. The Backend URL will be passed to the APIM Server, and the Server will perform the validation by sending an HTTP HEAD request to the BE service.
So there can be two causes. First may be your backend doesn't know how to handle a HEAD request which is preventing it from accepting the request. But given the error indicated it's a network issue, I doubt it even reached the BE.
The second one is, that your Backend is not accessible from the place API Manager is running. If you are running API Manager on Server A and trying to access API Manager via browser from Server B(Local Machine). Although you can access the BE from Server B may be from Server A it's not accessible. When I say BE is not accessible from API Manager server, it means it's not accessible with the same URL that was used in API Manager. It doesn't really matter if it runs in the same Server if you are using a different DNS other than localhost to access it. So go to the server API Manager is running and send a request using the same URL that was used in API Manager and see whether it's accessible from there.
First try doing a curl request by login into the server where APIM is running (not from your local machine). Maybe due to some firewall rules within the server, the hostname given in the URL may not be accessible. Also, try sending a HEAD request as well. You might be able to get some idea why this is happening

Why is Springboot server works differently in localhost and heroku host?

I want to handle error response. When I use local server I can get error message when exception is hit but when I use the same hosted app It shows response with error message which is null "message":""
I have noticed that when the excptionerror is thrown the server gets stoped a while and the response error comes empty due to network delay. But for local database there is no delay which leads the server to keep responding no matter which response it has

What could be the cause of 504 error for restful api GET request?

I have a RESTful webservices deployed as war on jboss AS which is hosted on apache web server.
Sometimes I am getting 504 error for GET request of api, where it fetches data from mysql DB hosted on AWS.
On restarting jboss server, it gets resolved.
So what could be the issue with, is it database timeout/connection pool issue or issue with the server?
Maybe you could wire up another GET request that just answers with a small test message, and no DB to test if the API is receiving requests and responding correctly, if so it may be the DB connection. Also if you have logs of either or both that would be helpful to see which one timed out

Invoking Soap service fails in java, works in soapui

I'm trying to consume a soap service in java.
If I import the wsdl url in SOAPUI, I get the :java.net.ConnectException connection timed out exception.
I saved the WSDL to a file and successfully inported it into SOAPUI.
In SOAPUI, I'm able to consume it.
In java however, i still get the java.net.ConnectException connection timed out exception
when trying to consume it, having tried with a number of different libraries that work on other webservices in the same network.
I've also tried putting my entreprise proxy in java with no effect.
However, if i put a local proxy, like Fiddler, in front of java, I cat invoke the webservice successfully. The server where it's hosted has ping (ICMP) blocked.
Event if I make a simple get for the WSDl address I get the java.net.ConnectException connection timed out exception.
Does anyone have any suggestions on how to troubleshoot this?

how to test connectivity to the web service?

In java i have created a JAX- web service, which is up and running, my client connects to the web service.
if web service is up, it works fine. but if my web service is not
up, it should show some message to the client about that issue.
in java how can i implement this functionality.
My server should show a proper message on client side.
If the web service is not up, it cannot provide any functionality. The client will probably recieve an HTTP error (like 404 - not found or 500 - Internal server error) or a timeout.
To display a useful message to the end user you would need to create a client application through which your web service is accessed. The client application could display appropriate messages in case the service could not be reached. An example of creating a simple JAX-WS client can be found here.
If the service is up, but cannot handle the request, then you could provide a meaningful error in the response by throwing a GenericSoapFault with the error message as argument.

Categories