public String getDestinations(String messageBrokerId) {
    StringBuilder result = new StringBuilder();
    MessageBroker broker = MessageBroker.getMessageBroker(messageBrokerId);
    result.append("<remotingDestinations>");
    if (broker != null) {
      Service remotingService = broker.getServiceByType("flex.messaging.services.RemotingService");
      if (remotingService != null) {
        Map destinations = remotingService.getDestinations();
        Iterator destinationsIterator = destinations.keySet().iterator();
        result.append("<destinations>");
        if (destinationsIterator != null) {
          while (destinationsIterator.hasNext()) {
            RemotingDestination destination =
                (RemotingDestination) destinations.get(destinationsIterator.next());
            if (destination != null) {
              result.append("<destination>");
              result.append(
                  (new StringBuilder("<destinationId>"))
                      .append(destination.getId())
                      .append("</destinationId>")
                      .toString());
              result.append(
                  (new StringBuilder("<adapterName>"))
                      .append(destination.getAdapter().getClass().getName())
                      .append("</adapterName>")
                      .toString());
              result.append(
                  (new StringBuilder("<source>"))
                      .append(destination.getSource())
                      .append("</source>")
                      .toString());
              List channelIds = destination.getChannels();
              Iterator channelIdsIterator = channelIds.iterator();
              result.append("<channels>");
              for (;
                  channelIdsIterator.hasNext();
                  result.append(
                      (new StringBuilder("<channel>"))
                          .append((String) channelIdsIterator.next())
                          .append("</channel>")
                          .toString())) ;
              result.append("</channels>");
              SecurityConstraint secConstraint = destination.getSecurityConstraint();
              result.append("<securityConstraint>");
              if (secConstraint != null) {
                result.append(
                    (new StringBuilder("<securityMethod>"))
                        .append(secConstraint.getMethod())
                        .append("</securityMethod>")
                        .toString());
                result.append(
                    (new StringBuilder("<securityRoles>"))
                        .append(secConstraint.getRoles())
                        .append("</securityRoles>")
                        .toString());
              }
              result.append("</securityConstraint>");
              String className = destination.getSource();
              if (className != null)
                try {
                  Class c = Class.forName("com.adams.dt.util.Abstract");
                  Field fields[] = c.getFields();
                  result.append("<fields>");
                  if (fields != null) {
                    for (int i = 0; i < fields.length; i++)
                      result.append(
                          (new StringBuilder("<field>"))
                              .append(fields[i].toString())
                              .append("</field>")
                              .toString());
                  }
                  result.append("</fields>");

                  Method methods[] = c.getMethods();
                  result.append("<methods>");
                  if (methods != null) {
                    for (int i = 0; i < methods.length; i++)
                      if (methods[i] != null && !methodsExclude.contains(methods[i].getName())) {
                        result.append("<method>");
                        result.append(
                            (new StringBuilder("<methodSignature>"))
                                .append(methods[i].toString())
                                .append("</methodSignature>")
                                .toString());
                        result.append(
                            (new StringBuilder("<methodName>"))
                                .append(methods[i].getName())
                                .append("</methodName>")
                                .toString());
                        result.append(
                            (new StringBuilder("<returnType>"))
                                .append(methods[i].getReturnType().getName())
                                .append("</returnType>")
                                .toString());
                        Class paramClasses[] = methods[i].getParameterTypes();
                        result.append("<params>");
                        if (paramClasses != null) {
                          for (int j = 0; j < paramClasses.length; j++)
                            if (paramClasses[j] != null)
                              result.append(
                                  (new StringBuilder("<param>"))
                                      .append(paramClasses[j].getName())
                                      .append("</param>")
                                      .toString());
                        }
                        result.append("</params>");
                        result.append("</method>");
                      }
                  }
                  result.append("</methods>");
                } catch (ClassNotFoundException e) {
                  System.out.println(e.getMessage());
                }
              result.append("</destination>");
            }
          }
          result.append("</destinations>");
        }
      }
    }
    result.append("</remotingDestinations>");
    return result.toString();
  }