code: private RmiServiceInvocation getServiceInvocation(Message message, RmiEndpointConfiguration endpointConfiguration) {
          Object payload = message.getPayload();
  
          RmiServiceInvocation serviceInvocation = null;
          if (payload != null) {
              if (payload instanceof RmiServiceInvocation) {
                  serviceInvocation = (RmiServiceInvocation) payload;
              } else if (payload != null && StringUtils.hasText(message.getPayload(String.class))) {
                  serviceInvocation = (RmiServiceInvocation) endpointConfiguration.getMarshaller()
                          .unmarshal(message.getPayload(Source.class));
              } else {
                  serviceInvocation = new RmiServiceInvocation();
              }
          }
  
          return serviceInvocation;
      }
docs: Reads Citrus internal RMI message model object from message payload. Either payload is actually a service invocation object or
  XML payload String is unmarshalled to proper object representation.
  
  @param message
  @param endpointConfiguration
  @return