You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by mi...@apache.org on 2008/07/08 23:53:43 UTC
svn commit: r674990 -
/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java
Author: midon
Date: Tue Jul 8 14:53:43 2008
New Revision: 674990
URL: http://svn.apache.org/viewvc?rev=674990&view=rev
Log:
better logging
Modified:
ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java
Modified: ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java?rev=674990&r1=674989&r2=674990&view=diff
==============================================================================
--- ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java (original)
+++ ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java Tue Jul 8 14:53:43 2008
@@ -197,10 +197,6 @@
}
public Void call() {
- return callOneWay();
- }
-
- public Void callOneWay() {
try {
// simply execute the http method
HttpClient client = new HttpClient(connections);
@@ -212,6 +208,7 @@
// as a result the connection might be closed before the body processing (see the finally clause below).
byte[] responseBody = method.getResponseBody();
// ... and process the response
+ if (log.isDebugEnabled())log.debug("Received response for MEX " + odeMex);
processResponse(statusCode);
} catch (final IOException e) {
// Shit happened, recording the failure
@@ -234,11 +231,10 @@
try {
// log the URI since the engine may have moved on while this One Way request was executing
if (statusCode >= 400) {
- if (log.isWarnEnabled())
- log.warn("OneWay http request [" + method.getURI() + "] failed with status: " + method.getStatusLine());
+ log.error("OneWay HTTP Request failed, Status-Line: " + method.getStatusLine()+ " for "+ method.getURI());
} else {
if (log.isDebugEnabled())
- log.debug("OneWay http request [" + method.getURI() + "] status: " + method.getStatusLine());
+ log.debug("OneWay HTTP Request, Status-Line: " + method.getStatusLine()+ " for "+ method.getURI());
}
} catch (URIException e) {
if (log.isDebugEnabled()) log.debug(e);
@@ -272,7 +268,7 @@
}
private void unmanagedStatus() throws IOException {
- String errmsg = "Unmanaged Status Code! " + method.getStatusLine();
+ String errmsg = "Unmanaged Status Code! Status-Line: " + method.getStatusLine()+ " for "+ method.getURI();
log.error(errmsg);
odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpClientHelper.prepareDetailsElement(method));
}
@@ -283,23 +279,23 @@
* @throws IOException
*/
private void _5xx_serverError() throws IOException {
- String errmsg = "Internal Server Error! " + method.getStatusLine();
- log.error(errmsg);
+ String errmsg = "Status-Line: " + method.getStatusLine()+ " for "+ method.getURI();
+ if(log.isWarnEnabled()) log.warn(errmsg);
Operation opDef = odeMex.getOperation();
BindingOperation opBinding = portBinding.getBindingOperation(opDef.getName(), opDef.getInput().getName(), opDef.getOutput().getName());
String body = method.getResponseBodyAsString();
if (opDef.getFaults().isEmpty()) {
- errmsg = "Operation " + opDef.getName() + " has no fault. This 500 error will be considered as a failure.";
- if (log.isDebugEnabled()) log.debug(errmsg);
+ errmsg = "Operation [" + opDef.getName() + "] has no fault. This 500 error will be considered as a failure.";
+ log.error(errmsg);
odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpClientHelper.prepareDetailsElement(method));
} else if (opBinding.getBindingFaults().isEmpty()) {
errmsg = "No fault binding. This 500 error will be considered as a failure.";
- if (log.isDebugEnabled()) log.debug(errmsg);
+ log.error(errmsg);
odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpClientHelper.prepareDetailsElement(method));
} else if (StringUtils.isEmpty(body)) {
errmsg = "No body in the response. This 500 error will be considered as a failure.";
- if (log.isDebugEnabled()) log.debug(errmsg);
+ log.error(errmsg);
odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpClientHelper.prepareDetailsElement(method));
} else {
try {
@@ -308,13 +304,13 @@
Fault faultDef = WsdlUtils.inferFault(opDef, bodyName);
if (faultDef == null) {
- errmsg = "Unknown Fault " + bodyName + " This 500 error will be considered as a failure.";
- if (log.isDebugEnabled()) log.debug(errmsg);
+ errmsg = "Unknown Fault Type [" + bodyName + "] This 500 error will be considered as a failure.";
+ log.error(errmsg);
odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpClientHelper.prepareDetailsElement(method));
} else if (!WsdlUtils.isOdeFault(opBinding.getBindingFault(faultDef.getName()))) {
// is this fault bound with ODE extension?
- errmsg = "Fault " + bodyName + " is not bound with " + new QName(Namespaces.ODE_HTTP_EXTENSION_NS, "fault") + ". This 500 error will be considered as a failure.";
- if (log.isDebugEnabled()) log.debug(errmsg);
+ errmsg = "Fault [" + bodyName + "] is not bound with " + new QName(Namespaces.ODE_HTTP_EXTENSION_NS, "fault") + ". This 500 error will be considered as a failure.";
+ log.error(errmsg);
odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpClientHelper.prepareDetailsElement(method));
} else {
// a fault must have only one part
@@ -335,30 +331,31 @@
// extract and set headers
httpMethodConverter.extractHttpResponseHeaders(response, method, faultDef.getMessage(), opBinding.getBindingOutput());
// finally send the fault. We did it!
+ if(log.isWarnEnabled()) log.warn("Fault response: faultType=" + faultType + "\n" + DOMUtils.domToString(odeMsgEl));
odeMex.replyWithFault(faultType, response);
}
} catch (Exception e) {
errmsg = "Unable to parse the response body as xml. This 500 error will be considered as a failure.";
- if (log.isDebugEnabled()) log.debug(errmsg, e);
+ log.error(errmsg, e);
odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpClientHelper.prepareDetailsElement(method, false));
}
}
}
private void _4xx_badRequest() throws IOException {
- String errmsg = "Bad Request! " + method.getStatusLine();
+ String errmsg = "HTTP Status-Line: " + method.getStatusLine()+ " for "+ method.getURI();
log.error(errmsg);
odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpClientHelper.prepareDetailsElement(method));
}
private void _3xx_redirection() throws IOException {
- String errmsg = "Redirections disabled! " + method.getStatusLine();
+ String errmsg = "Redirections disabled! HTTP Status-Line: " + method.getStatusLine()+ " for "+ method.getURI();
log.error(errmsg);
odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, HttpClientHelper.prepareDetailsElement(method));
}
- private void _2xx_success() {
- if (log.isDebugEnabled()) log.debug("Http Status Line=" + method.getStatusLine());
+ private void _2xx_success() throws IOException {
+ if (log.isDebugEnabled()) log.debug("HTTP Status-Line: " + method.getStatusLine()+ " for "+ method.getURI());
if (log.isDebugEnabled()) log.debug("Received response for MEX " + odeMex);
Operation opDef = odeMex.getOperation();
@@ -399,7 +396,7 @@
try {
if (log.isInfoEnabled())
- log.info("Response:\n" + (odeResponse.getMessage() != null ? DOMUtils.domToString(odeResponse.getMessage()) : "empty"));
+ log.info("Response: " + (odeResponse.getMessage() != null ? DOMUtils.domToString(odeResponse.getMessage()) : "empty"));
odeMex.reply(odeResponse);
} catch (Exception ex) {
String errmsg = "Unable to process response: " + ex.getMessage();