@Test public void testHandleFault() throws Exception { final String mockSoapXml = "<Fault>Xml Message</Fault>\n<Fault.Type>fatal</Fault.Type>"; Answer<Object> writeXml = (invocation) -> { OutputStream stream = (OutputStream) invocation.getArguments()[0]; Streams.write(mockSoapXml, stream, Charset.forName(UTF_8)); return null; }; when(mockSoapMessageContext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY)) .thenReturn(Boolean.FALSE); when(mockSoapMessageContext.getMessage()).thenReturn(mockMessage); Mockito.doAnswer(writeXml).when(mockMessage).writeTo(any(OutputStream.class)); assertTrue(jaxWsSoapContextHandler.handleFault(mockSoapMessageContext)); assertEquals( mockSoapXml, jaxWsSoapContextHandler.getLastResponseInfoBuilder().build().getPayload()); }
@Override public boolean handleFault(SOAPMessageContext context) { captureSoapXml(context); return true; }
JaxWsSoapContextHandler implements SOAPHandler<SOAPMessageContext> { @Override public boolean handleFault(SOAPMessageContext context) { captureSoapXml(context); return true; } }
JaxWsSoapContextHandler implements SOAPHandler<SOAPMessageContext> { @Override public boolean handleFault(SOAPMessageContext context) { captureSoapXml(context); return true; } @Inject  JaxWsSoapContextHandler(
      RequestInfoXPathSet requestInfoXPathSet,
      ResponseInfoXPathSet responseInfoXPathSet); }
JaxWsSoapContextHandler implements SOAPHandler<SOAPMessageContext> { @Override public boolean handleFault(SOAPMessageContext context) { captureSoapXml(context); return true; } @Inject  JaxWsSoapContextHandler(
      RequestInfoXPathSet requestInfoXPathSet,
      ResponseInfoXPathSet responseInfoXPathSet); @Override boolean handleMessage(SOAPMessageContext context); @Override boolean handleFault(SOAPMessageContext context); RequestInfo.Builder getLastRequestInfoBuilder(); ResponseInfo.Builder getLastResponseInfoBuilder(); void addHeader(String namespace, String headerName, SOAPElement headerValue); void clearHeaders(); Set<SOAPElement> getAddedHeaders(); @Override Set<QName> getHeaders(); @Override void close(MessageContext messageContext); }
JaxWsSoapContextHandler implements SOAPHandler<SOAPMessageContext> { @Override public boolean handleFault(SOAPMessageContext context) { captureSoapXml(context); return true; } @Inject  JaxWsSoapContextHandler(
      RequestInfoXPathSet requestInfoXPathSet,
      ResponseInfoXPathSet responseInfoXPathSet); @Override boolean handleMessage(SOAPMessageContext context); @Override boolean handleFault(SOAPMessageContext context); RequestInfo.Builder getLastRequestInfoBuilder(); ResponseInfo.Builder getLastResponseInfoBuilder(); void addHeader(String namespace, String headerName, SOAPElement headerValue); void clearHeaders(); Set<SOAPElement> getAddedHeaders(); @Override Set<QName> getHeaders(); @Override void close(MessageContext messageContext);  }