protected int doProcessResponseCode() throws IOException { Exchange exchange = outMessage.getExchange(); int rc = getResponseCode(); if (rc == -1) { LOG.warning("HTTP Response code appears to be corrupted"); } if (exchange != null) { exchange.put(Message.RESPONSE_CODE, rc); if (rc == 404 || rc == 503) { exchange.put("org.apache.cxf.transport.service_not_available", true); } } // "org.apache.cxf.transport.no_io_exceptions" property should be set in case the exceptions // should not be handled here; for example jax rs uses this // "org.apache.cxf.transport.process_fault_on_http_400" property should be set in case a // soap fault because of a HTTP 400 should be returned back to the client (SOAP 1.2 spec) if (rc >= 400 && rc != 500 && !MessageUtils.getContextualBoolean(outMessage, NO_IO_EXCEPTIONS) && (rc > 400 || !MessageUtils.getContextualBoolean(outMessage, PROCESS_FAULT_ON_HTTP_400))) { throw new HTTPException(rc, getResponseMessage(), url.toURL()); } return rc; }
private static boolean isServiceRemovalException(Throwable throwable) { LOG.info("Checking for Service Removal Exception: " + throwable.getClass().getName()); if (getServiceRemovalExceptions().contains(throwable.getClass())) { LOG.info("Found a Service Removal Exception: " + throwable.getClass().getName()); return true; } else if (throwable instanceof org.kuali.rice.ksb.messaging.HttpException) { org.kuali.rice.ksb.messaging.HttpException httpException = (org.kuali.rice.ksb.messaging.HttpException)throwable; if (getServiceRemovalResponseCodes().contains(httpException.getResponseCode())) { LOG.info("Found a Service Removal Exception because of a " + httpException.getResponseCode() + " " + throwable.getClass().getName()); return true; } } else if (throwable instanceof org.apache.cxf.transport.http.HTTPException) { org.apache.cxf.transport.http.HTTPException httpException = (org.apache.cxf.transport.http.HTTPException)throwable; if (getServiceRemovalResponseCodes().contains(httpException.getResponseCode())) { LOG.info("Found a Service Removal Exception because of a " + httpException.getResponseCode() + " " + throwable.getClass().getName()); return true; } } if (throwable.getCause() != null) { LOG.info("Unwrapping Throwable cause to check for service removal exception from: " + throwable.getClass().getName()); return isServiceRemovalException(throwable.getCause()); } return false; }
@Test public void testNoAuth() throws Exception { URL wsdl = getClass().getResource("../greeting.wsdl"); assertNotNull("WSDL is null", wsdl); SOAPService service = new SOAPService(wsdl, serviceName); assertNotNull("Service is null", service); Greeter mortimer = service.getPort(mortimerQ, Greeter.class); assertNotNull("Port is null", mortimer); TestUtil.setAddress(mortimer, "http://localhost:" + PORT + "/digestauth/greeter"); try { String answer = mortimer.sayHi(); Assert.fail("Unexpected reply (" + answer + "). Should throw exception"); } catch (Exception e) { Throwable cause = e.getCause(); assertEquals(HTTPException.class, cause.getClass()); HTTPException he = (HTTPException)cause; assertEquals(401, he.getResponseCode()); } }
throw new HTTPException(responseCode, getResponseMessage(), url.toURL());
protected int doProcessResponseCode() throws IOException { Exchange exchange = outMessage.getExchange(); int rc = getResponseCode(); if (rc == -1) { LOG.warning("HTTP Response code appears to be corrupted"); } if (exchange != null) { exchange.put(Message.RESPONSE_CODE, rc); if (rc == 404 || rc == 503) { exchange.put("org.apache.cxf.transport.service_not_available", true); } } // "org.apache.cxf.transport.no_io_exceptions" property should be set in case the exceptions // should not be handled here; for example jax rs uses this // "org.apache.cxf.transport.process_fault_on_http_400" property should be set in case a // soap fault because of a HTTP 400 should be returned back to the client (SOAP 1.2 spec) if (rc >= 400 && rc != 500 && !MessageUtils.getContextualBoolean(outMessage, NO_IO_EXCEPTIONS) && (rc > 400 || !MessageUtils.getContextualBoolean(outMessage, PROCESS_FAULT_ON_HTTP_400))) { throw new HTTPException(rc, getResponseMessage(), url.toURL()); } return rc; }
protected int doProcessResponseCode() throws IOException { Exchange exchange = outMessage.getExchange(); int rc = getResponseCode(); if (rc == -1) { LOG.warning("HTTP Response code appears to be corrupted"); } if (exchange != null) { exchange.put(Message.RESPONSE_CODE, rc); if (rc == 404 || rc == 503) { exchange.put("org.apache.cxf.transport.service_not_available", true); } } // "org.apache.cxf.transport.no_io_exceptions" property should be set in case the exceptions // should not be handled here; for example jax rs uses this // "org.apache.cxf.transport.process_fault_on_http_400" property should be set in case a // soap fault because of a HTTP 400 should be returned back to the client (SOAP 1.2 spec) if (rc >= 400 && rc != 500 && !MessageUtils.isTrue(outMessage.getContextualProperty("org.apache.cxf.transport.no_io_exceptions")) && (rc > 400 || !MessageUtils.isTrue(outMessage .getContextualProperty("org.apache.cxf.transport.process_fault_on_http_400")))) { throw new HTTPException(rc, getResponseMessage(), url.toURL()); } return rc; }
throw new HTTPException(responseCode, getResponseMessage(), url.toURL());
throw new HTTPException(responseCode, getResponseMessage(), url.toURL());