HttpServletConnection extends AbstractReceiverConnection implements EndpointAwareWebServiceConnection, FaultAwareWebServiceConnection { @Override public void setFaultCode(QName faultCode) throws IOException { if (faultCode != null) { if (SOAPConstants.SOAP_SENDER_FAULT.equals(faultCode)) { getHttpServletResponse().setStatus(HttpTransportConstants.STATUS_BAD_REQUEST); } else { getHttpServletResponse().setStatus(HttpTransportConstants.STATUS_INTERNAL_SERVER_ERROR); } } else { getHttpServletResponse().setStatus(HttpTransportConstants.STATUS_OK); } statusCodeSet = true; } protected  HttpServletConnection(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse); HttpServletRequest getHttpServletRequest(); HttpServletResponse getHttpServletResponse(); @Override void endpointNotFound(); @Override boolean hasError(); @Override String getErrorMessage(); @Override URI getUri(); @Override Iterator<String> getRequestHeaderNames(); @Override Iterator<String> getRequestHeaders(String name); @Override void addResponseHeader(String name, String value); @Override void onClose(); @Override boolean hasFault(); @Override @Deprecated void setFault(boolean fault); @Override void setFaultCode(QName faultCode);  }
@Test public void faultCodes() throws IOException { connection.setFaultCode(SoapVersion.SOAP_11.getClientOrSenderFaultName()); assertEquals(500, httpServletResponse.getStatus()); connection.setFaultCode(SoapVersion.SOAP_11.getServerOrReceiverFaultName()); assertEquals(500, httpServletResponse.getStatus()); connection.setFaultCode(SoapVersion.SOAP_12.getClientOrSenderFaultName()); assertEquals(400, httpServletResponse.getStatus()); connection.setFaultCode(SoapVersion.SOAP_12.getServerOrReceiverFaultName()); assertEquals(500, httpServletResponse.getStatus()); }