429 * 430 * @return 431 * null if a {@link Message} doesn't have any payload. 432 */ 433 public abstract @Nullable String getPayloadLocalPart(); 434 435 /** 436 * Gets the namespace URI of the payload element. 437 * 438 * @return 439 * null if a {@link Message} doesn't have any payload. 440 */ 441 public abstract String getPayloadNamespaceURI(); 442 // I'm not putting @Nullable on it because doing null check on getPayloadLocalPart() should be suffice 443 444 /** 445 * Returns true if a {@link Message} has a payload. 446 * 447 * <p> 448 * A message without a payload is a SOAP message that looks like: 449 * <pre><xmp> 450 * <S:Envelope> 451 * <S:Header> 452 * ... 453 * </S:Header> 454 * <S:Body /> 455 * </S:Envelope> 456 * </xmp></pre> 457 */ 458 public abstract boolean hasPayload(); 459 460 /** 461 * Returns true if this message is a fault. 462 * 463 * <p> 464 * Just a convenience method built on {@link #getPayloadNamespaceURI()} 465 * and {@link #getPayloadLocalPart()}. 466 */ 467 public boolean isFault() { 468 // TODO: is SOAP version a property of a Message? 469 // or is it defined by external factors? 470 // how do I compare? 471 String localPart = getPayloadLocalPart(); 472 if(localPart==null || !localPart.equals("Fault")) 473 return false; 474 475 String nsUri = getPayloadNamespaceURI(); 476 return nsUri.equals(SOAPVersion.SOAP_11.nsUri) || nsUri.equals(SOAPVersion.SOAP_12.nsUri); | 429 * 430 * @return 431 * null if a {@link Message} doesn't have any payload. 432 */ 433 public abstract @Nullable String getPayloadLocalPart(); 434 435 /** 436 * Gets the namespace URI of the payload element. 437 * 438 * @return 439 * null if a {@link Message} doesn't have any payload. 440 */ 441 public abstract String getPayloadNamespaceURI(); 442 // I'm not putting @Nullable on it because doing null check on getPayloadLocalPart() should be suffice 443 444 /** 445 * Returns true if a {@link Message} has a payload. 446 * 447 * <p> 448 * A message without a payload is a SOAP message that looks like: 449 * <pre>{@code 450 * <S:Envelope> 451 * <S:Header> 452 * ... 453 * </S:Header> 454 * <S:Body /> 455 * </S:Envelope> 456 * }</pre> 457 */ 458 public abstract boolean hasPayload(); 459 460 /** 461 * Returns true if this message is a fault. 462 * 463 * <p> 464 * Just a convenience method built on {@link #getPayloadNamespaceURI()} 465 * and {@link #getPayloadLocalPart()}. 466 */ 467 public boolean isFault() { 468 // TODO: is SOAP version a property of a Message? 469 // or is it defined by external factors? 470 // how do I compare? 471 String localPart = getPayloadLocalPart(); 472 if(localPart==null || !localPart.equals("Fault")) 473 return false; 474 475 String nsUri = getPayloadNamespaceURI(); 476 return nsUri.equals(SOAPVersion.SOAP_11.nsUri) || nsUri.equals(SOAPVersion.SOAP_12.nsUri); |