code: public static EndpointRef getSourceEndpoint(Trace fragment) {
          Node rootNode = fragment.getNodes().isEmpty() ? null : fragment.getNodes().get(0);
          if (rootNode == null) {
              return null;
          }
          // Create endpoint reference. If initial fragment and root node is a Producer,
          // then define it as a 'client' endpoint to distinguish it from the same
          // endpoint representing the server
          return new EndpointRef(rootNode.getUri(), rootNode.getOperation(),
                      fragment.initialFragment() && rootNode instanceof Producer);
      }
docs: This method determines the source URI that should be attributed to the supplied
  fragment. If the top level fragment just contains a Producer, then prefix with
  'client' to distinguish it from the same endpoint for the service.
  
  @param fragment The trace fragment
  @return The source endpoint