code: protected org.opensaml.saml2.ecp.RelayState captureRelayState(org.opensaml.ws.soap.soap11.Envelope soapEnvelope) 
      {
      	RelayState relayState = null;
          if (!soapEnvelope.getHeader()
                  .getUnknownXMLObjects(RelayState.DEFAULT_ELEMENT_NAME).isEmpty()) {
              relayState = (RelayState) soapEnvelope.getHeader()
                      .getUnknownXMLObjects(RelayState.DEFAULT_ELEMENT_NAME).get(0);
              relayState.detach();
              log.trace("Relay state: captured");
          }
          return relayState;
      }
docs: Captures the ECP relay state in a SAML SOAP message
  @param soapEnvelope the SOAP message to check for the ECP relay state
  @return relayState the ECP relay state in the SOAP message