protected void handleResultFault(SOAPFault fault) {
    StringBuffer errorMsg = new StringBuffer();
    errorMsg.append("XML/A fault: ");

    String faultString = fault.getFaultString();
    if (faultString != null) {
      errorMsg.append(faultString);
      errorMsg.append("; ");
    }

    String faultActor = fault.getFaultActor();
    if (faultActor != null) {
      errorMsg.append("Actor: ");
      errorMsg.append(faultActor);
      errorMsg.append("; ");
    }

    String faultCode = fault.getFaultCode();
    if (faultCode != null) {
      errorMsg.append("Code: ");
      errorMsg.append(faultCode);
      errorMsg.append("; ");
    }

    throw new JRRuntimeException(errorMsg.toString());
  }
Пример #2
0
 @Validated
 @Test
 public final void testGetFaultCode() throws Exception {
   SOAPFault fault = createEmptySOAPFault();
   String code = fault.getPrefix() + ":Server";
   appendFaultCodeElement(fault).setTextContent(code);
   assertEquals(code, fault.getFaultCode());
 }
Пример #3
0
 /**
  * Test the behavior of {@link SOAPFault#getFaultCode()} if no fault code is present. Note that
  * the reference implementation throws a {@link NullPointerException} in this case and that the
  * SAAJ specification is not clear about the expected behavior. Our implementation returns <code>
  * null</code>.
  *
  * @throws Exception
  */
 @Test
 public final void testGetFaultCodeOnEmptyFault() throws Exception {
   SOAPFault fault = createEmptySOAPFault();
   assertNull(fault.getFaultCode());
 }