Posts

Showing posts with the label WebServices

Log All Your Web-method Calls

After a good deal of trial-and-error, and delving into the CXF code, I've found a way to get CXF to log every web-method call -- parameters and all. Put the following into your Tomcat's log4j.xml: <logger name="org.apache.cxf.service.invoker"> <level value="trace"> </level> </logger> The level should be set to "trace" by default; you won't get ton's of output, just a line (maybe 2) every time a web method is called. Unfortunately, the line is a bit wordy, as in Invoking method public boolean com.company.entities.ws.EntityManagementImpl.login(java.lang.String,java.lang.String,java.lang.String) throws java.io.UnsupportedEncodingException on object com.company.entities.ws.EntityManagementImpl@71e6b with params [CLI, arg2, arg3]. but it was either use the built in log statement or write a whole interceptor and add it to the chain processing the call. If we get really annoyed we could always tweak the source and rebuil...

What does: "Fault occurred while processing" in the client mean? and how do you reveal the real exception?

I have this CXF client which sometimes throws normal exceptions but some of the other times it throws me a "Fault occurred while processing", well, what does that mean? When you get back a "Fault occurred while processing" it means that a web service threw an unchecked exception.  The CXF framework catches it and puts together a fault message which it sends back to the client.  The client’s stack trace at that point is pretty-much irrelevant . There may be a way to get CXF to log the server stack trace, but I haven’t found it yet (feel free to comment on the post if you found one).  There may also be a way to stick a handler into the flow to get the exception before constructing the fault message, but I haven’t found that yet either (ditto). If a checked-exception is thrown, then the exception – or at least its message – gets sent back to the client where it’s reconstructed and rethrown to be caught by the client. Debugging a problem like this, o...

WARNING: Can't find the the request for http://127.0.0.1:8080/... 's Observer

When did this stackTrace been thrown? While running a CXF webservice over a tomcat server. Scenario: My client (client software) tries to connect the CXF webservice, but the following line keeps being stacked at my server's console windows: WARNING: Can't find the the request for http://127.0.0.1:8080/... 's Observer What's the problem? After thorough investigation I tried invoking a services list using my web browser - And a list I got! Where I found out that I wrote the wrong endpoint Mystery solved :-)