Index: trunk/autoquest-plugin-http/src/main/java/de/ugoe/cs/autoquest/plugin/http/SOAPUtils.java
===================================================================
--- trunk/autoquest-plugin-http/src/main/java/de/ugoe/cs/autoquest/plugin/http/SOAPUtils.java	(revision 1992)
+++ trunk/autoquest-plugin-http/src/main/java/de/ugoe/cs/autoquest/plugin/http/SOAPUtils.java	(revision 1993)
@@ -40,4 +40,5 @@
 import de.ugoe.cs.autoquest.plugin.http.eventcore.SOAPEventType;
 import de.ugoe.cs.autoquest.plugin.http.eventcore.SimpleSOAPEventType;
+import de.ugoe.cs.autoquest.plugin.http.eventcore.SimpleSOAPEventType.CallType;
 
 /**
@@ -220,6 +221,6 @@
      * @return body of the SOAP event
      */
-    public static Element getSoapRequestBodyFromEvent(Event event) {
-        return getSoapRequestBodyFromEvent(event, false);
+    public static Element getSoapBodyFromEvent(Event event) {
+        return getSoapBodyFromEvent(event, false);
     }
 
@@ -235,5 +236,5 @@
      * @return body of the SOAP event
      */
-    public static Element getSoapRequestBodyFromEvent(Event event, boolean useRandomRequestBodies) {
+    public static Element getSoapBodyFromEvent(Event event, boolean useRandomRequestBodies) {
         Element requestBody = null;
         if (event.getType() instanceof SOAPEventType) {
@@ -242,8 +243,8 @@
         else if (event.getType() instanceof SimpleSOAPEventType) {
             if (useRandomRequestBodies) {
-                requestBody = ((SimpleSOAPEventType) event.getType()).getRandomSoapRequestBody();
+                requestBody = ((SimpleSOAPEventType) event.getType()).getRandomSoapMsgBody();
             }
             else {
-                requestBody = ((SimpleSOAPEventType) event.getType()).getSoapRequestBody();
+                requestBody = ((SimpleSOAPEventType) event.getType()).getSoapMsgBody();
             }
         }
@@ -382,5 +383,5 @@
                         new Event(new SimpleSOAPEventType(methodName, eventType.getServiceName(),
                                                           eventType.getClientName(),
-                                                          eventType.getSoapRequestBody(),
+                                                          eventType.getSoapMsgBody(),
                                                           eventType.getEqualSOAPDataMap()),
                                   event.getTarget());
@@ -457,15 +458,99 @@
         return sortedSequences;
     }
-    
+
+    /**
+     * <p>
+     * Sorts the sequences by the orderingId of the requests/responses. This function only supports
+     * the ordering of {@link Event}s with a {@link SOAPEventType}.
+     * </p>
+     * 
+     * @param sequences
+     *            sequences to be order
+     * @param orderType
+     *            determines if sequences are ordered by request or response
+     * @return sorted sequences
+     */
+    public static Collection<List<Event>> sortAndConvertSequences(Collection<List<Event>> sequences,
+                                                                  boolean keepRequests,
+                                                                  boolean keepResponse)
+    {
+        Collection<List<Event>> sortedSequences = new LinkedList<>();
+        EqualSOAPDataMap equalSOAPDataMap = new EqualSOAPDataMap();
+        for (List<Event> sequence : sequences) {
+            // use insertion sort
+            List<Event> sortedSequence = new LinkedList<>();
+            long lastOrderId = Long.MIN_VALUE;
+            long selectedOrderId;
+            Event selectedEvent;
+            CallType selectedCallType = CallType.RESPONSE;
+            do {
+                selectedEvent = null;
+                selectedOrderId = Long.MAX_VALUE;
+                for (Event event : sequence) {
+                    if (!(event.getType() instanceof SOAPEventType)) {
+                        throw new RuntimeException(
+                                                   "Can only order SOAPEventTypes. SimpleSOAPEvent is also not supported. Event type found: " +
+                                                       event.getType().getClass().getName());
+                    }
+                    SOAPEventType soapEventType = (SOAPEventType) event.getType();
+                    long requestOrderId = soapEventType.getExchange().getRequest().getOrderingId();
+                    long responseOrderId =
+                        soapEventType.getExchange().getResponse().getOrderingId();
+
+                    if (requestOrderId > lastOrderId && requestOrderId < selectedOrderId) {
+                        selectedOrderId = requestOrderId;
+                        selectedEvent = event;
+                        selectedCallType = CallType.REQUEST;
+                    }
+                    if (responseOrderId > lastOrderId && responseOrderId < selectedOrderId) {
+                        selectedOrderId = responseOrderId;
+                        selectedEvent = event;
+                        selectedCallType = CallType.RESPONSE;
+                    }
+                }
+                if (selectedEvent != null) {
+                    SOAPEventType eventType = (SOAPEventType) selectedEvent.getType();
+                    Element soapMsgBody;
+                    switch (selectedCallType)
+                    {
+                        case REQUEST:
+                            soapMsgBody = eventType.getSoapRequestBody();
+                            break;
+                        case RESPONSE:
+                            soapMsgBody = eventType.getSoapResponseBody();
+                            break;
+                        default:
+                            throw new RuntimeException("unsupported call type: " + selectedCallType);
+                    }
+                    if ((keepRequests && selectedCallType == CallType.REQUEST) ||
+                        (keepResponse && selectedCallType == CallType.RESPONSE))
+                    {
+                        sortedSequence.add(new Event(new SimpleSOAPEventType(eventType
+                            .getCalledMethod(), eventType.getServiceName(), eventType
+                            .getClientName(), soapMsgBody, equalSOAPDataMap, selectedCallType)));
+                    }
+                    lastOrderId = selectedOrderId;
+                }
+                
+            } while(selectedEvent!=null);
+            sortedSequences.add(sortedSequence);
+        }
+        return sortedSequences;
+    }
+
     /**
      * <p>
      * Removes calls to and from all ignored services from the sequences.
      * </p>
-     *
-     * @param sequences sequences where the ignored services are removed
-     * @param ignoredServicesString comma separted string that defines the ignored services
+     * 
+     * @param sequences
+     *            sequences where the ignored services are removed
+     * @param ignoredServicesString
+     *            comma separted string that defines the ignored services
      * @return sequences without events that reference the ignored services
      */
-    public static Collection<List<Event>> removeCallsToIgnoredServices(Collection<List<Event>> sequences, String ignoredServicesString) {
+    public static Collection<List<Event>> removeCallsToIgnoredServices(Collection<List<Event>> sequences,
+                                                                       String ignoredServicesString)
+    {
         Set<String> ignoredServices = new HashSet<>();
         if (ignoredServicesString != null) {
@@ -476,15 +561,19 @@
         return removeCallsToIgnoredServices(sequences, ignoredServices);
     }
-    
+
     /**
      * <p>
      * Removes calls to and from all ignored services from the sequences.
      * </p>
-     *
-     * @param sequences sequences where the ignored services are removed
-     * @param ignoredServices set with all ignored service names
+     * 
+     * @param sequences
+     *            sequences where the ignored services are removed
+     * @param ignoredServices
+     *            set with all ignored service names
      * @return sequences without events that reference the ignored services
      */
-    public static Collection<List<Event>> removeCallsToIgnoredServices(Collection<List<Event>> sequences, Set<String> ignoredServices) {
+    public static Collection<List<Event>> removeCallsToIgnoredServices(Collection<List<Event>> sequences,
+                                                                       Set<String> ignoredServices)
+    {
         Collection<List<Event>> onlyAcceptedServicesSequences = new LinkedList<>();
         for (List<Event> sequence : sequences) {
@@ -493,5 +582,6 @@
                 SimpleSOAPEventType eventType = (SimpleSOAPEventType) event.getType();
                 if (!ignoredServices.contains(eventType.getServiceName()) &&
-                    !ignoredServices.contains(eventType.getClientName()) ) {
+                    !ignoredServices.contains(eventType.getClientName()))
+                {
                     onlyAcceptedServicesSequence.add(event);
                 }
