test_class.declarator: contents =
          "<ns2:ImportantQuestion>" +
          "Camel rules as cigarettes as well.  Do Apache Indians smoke it?" +
          "</ns2:ImportantQuestion>"
test_class.modifier: private final
test_class.original_string: private final String contents =
          "<ns2:ImportantQuestion>" +
          "Camel rules as cigarettes as well.  Do Apache Indians smoke it?" +
          "</ns2:ImportantQuestion>";
test_class.type: String
test_class.var_name: contents
test_class.declarator: envelopeWithNamespacePrefixes =
          "<soap:Envelope><soap:Header>" +
          "    <thirdns:header value=\"12345\">some text</thirdns:header></soap:Header>" +
          "    <soap:Body>" +
          contents +
          "</soap:Body></soap:Envelope>"
test_class.modifier: private final
test_class.original_string: private final String envelopeWithNamespacePrefixes =
          "<soap:Envelope><soap:Header>" +
          "    <thirdns:header value=\"12345\">some text</thirdns:header></soap:Header>" +
          "    <soap:Body>" +
          contents +
          "</soap:Body></soap:Envelope>";
test_class.type: String
test_class.var_name: envelopeWithNamespacePrefixes
test_class.declarator: envelopeWithoutNamespacePrefixes =
          "<Envelope><Header>" +
          "    <thirdns:header value=\"12345\">some text</thirdns:header></Header>" +
          "    <Body>" +
          contents +
          "</Body></Envelope>"
test_class.modifier: private final
test_class.original_string: private final String envelopeWithoutNamespacePrefixes =
          "<Envelope><Header>" +
          "    <thirdns:header value=\"12345\">some text</thirdns:header></Header>" +
          "    <Body>" +
          contents +
          "</Body></Envelope>";
test_class.type: String
test_class.var_name: envelopeWithoutNamespacePrefixes
test_class.declarator: emptyEnvelopeWithNamespacePrefixes =
          "<soap:Envelope><soap:Header>" +
          "    <thirdns:header value=\"12345\">some text</thirdns:header></soap:Header>" +
          "    <soap:Body xmlns:prefix=\"uri\"></soap:Body></soap:Envelope>"
test_class.modifier: private final
test_class.original_string: private final String emptyEnvelopeWithNamespacePrefixes =
          "<soap:Envelope><soap:Header>" +
          "    <thirdns:header value=\"12345\">some text</thirdns:header></soap:Header>" +
          "    <soap:Body xmlns:prefix=\"uri\"></soap:Body></soap:Envelope>";
test_class.type: String
test_class.var_name: emptyEnvelopeWithNamespacePrefixes
test_class.declarator: emptyEnvelopeWithoutNamespacePrefixes =
          "<Envelope><Header>" +
          "    <thirdns:header value=\"12345\">some text</thirdns:header></Header>" +
          "    <Body></Body></Envelope>"
test_class.modifier: private final
test_class.original_string: private final String emptyEnvelopeWithoutNamespacePrefixes =
          "<Envelope><Header>" +
          "    <thirdns:header value=\"12345\">some text</thirdns:header></Header>" +
          "    <Body></Body></Envelope>";
test_class.type: String
test_class.var_name: emptyEnvelopeWithoutNamespacePrefixes
test_class.declarator: emptyEnvelopeWithNamespacePrefixesShort =
          "<soap:Envelope><soap:Header>" +
          "    <thirdns:header value=\"12345\">some text</thirdns:header></soap:Header>" +
          "    <soap:Body attrib=\"value\" /></soap:Envelope>"
test_class.modifier: private final
test_class.original_string: private final String emptyEnvelopeWithNamespacePrefixesShort =
          "<soap:Envelope><soap:Header>" +
          "    <thirdns:header value=\"12345\">some text</thirdns:header></soap:Header>" +
          "    <soap:Body attrib=\"value\" /></soap:Envelope>";
test_class.type: String
test_class.var_name: emptyEnvelopeWithNamespacePrefixesShort
test_class.declarator: emptyEnvelopeWithoutNamespacePrefixesShort =
          "<Envelope><Header>" +
          "    <thirdns:header value=\"12345\">some text</thirdns:header></Header>" +
          "    <Body /></Envelope>"
test_class.modifier: private final
test_class.original_string: private final String emptyEnvelopeWithoutNamespacePrefixesShort =
          "<Envelope><Header>" +
          "    <thirdns:header value=\"12345\">some text</thirdns:header></Header>" +
          "    <Body /></Envelope>";
test_class.type: String
test_class.var_name: emptyEnvelopeWithoutNamespacePrefixesShort
test_class.declarator: totallyBad = "12345"
test_class.modifier: private final
test_class.original_string: private final String totallyBad = "12345";
test_class.type: String
test_class.var_name: totallyBad
test_class.file: commons/ihe/ws/src/test/java/org/openehealth/ipf/commons/ihe/ws/utils/TestSoapUtils.java
test_class.identifier: TestSoapUtils
test_case.body: @Test
      public void testExctractSoapBody() {
          assertEquals(contents, extractSoapBody(envelopeWithNamespacePrefixes));
          assertEquals(contents, extractSoapBody(envelopeWithoutNamespacePrefixes));
  
          assertEquals("", extractSoapBody(emptyEnvelopeWithNamespacePrefixes));
          assertEquals("", extractSoapBody(emptyEnvelopeWithoutNamespacePrefixes));
          assertEquals("", extractSoapBody(emptyEnvelopeWithNamespacePrefixesShort));
          assertEquals("", extractSoapBody(emptyEnvelopeWithoutNamespacePrefixesShort));
          
          Assert.assertNull(extractSoapBody(null));
          Assert.assertEquals(totallyBad, extractSoapBody(totallyBad));
      }
test_case.class_method_signature: TestSoapUtils.testExctractSoapBody()
test_case.full_signature: @Test public void testExctractSoapBody()
test_case.identifier: testExctractSoapBody
test_case.invocations: assertEquals extractSoapBody assertEquals extractSoapBody assertEquals extractSoapBody assertEquals extractSoapBody assertEquals extractSoapBody assertEquals extractSoapBody assertNull extractSoapBody assertEquals extractSoapBody
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testExctractSoapBody()
focal_class.declarator: LOG = LoggerFactory.getLogger(SoapUtils.class)
focal_class.modifier: private static final transient
focal_class.original_string: private static final transient Logger LOG = LoggerFactory.getLogger(SoapUtils.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: WS_ADDRESSING_NS_URIS
focal_class.modifier: public static final
focal_class.original_string: public static final Set<String> WS_ADDRESSING_NS_URIS;
focal_class.type: Set<String>
focal_class.var_name: WS_ADDRESSING_NS_URIS
focal_class.declarator: SOAP_NS_URIS
focal_class.modifier: public static final
focal_class.original_string: public static final Set<String> SOAP_NS_URIS;
focal_class.type: Set<String>
focal_class.var_name: SOAP_NS_URIS
focal_class.file: commons/ihe/ws/src/main/java/org/openehealth/ipf/commons/ihe/ws/utils/SoapUtils.java
focal_class.identifier: SoapUtils
focal_class.class_method_signature: SoapUtils.SoapUtils()
focal_class.full_signature: private  SoapUtils()
focal_class.identifier: SoapUtils
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  SoapUtils()
focal_class.class_method_signature: SoapUtils.getElementNS(
              Element root,
              Set<String> nsUris,
              String wantedLocalName)
focal_class.full_signature: public static Element getElementNS(
              Element root,
              Set<String> nsUris,
              String wantedLocalName)
focal_class.identifier: getElementNS
focal_class.modifiers: public static
focal_class.parameters: (
              Element root,
              Set<String> nsUris,
              String wantedLocalName)
focal_class.return: Element
focal_class.signature: Element getElementNS(
              Element root,
              Set<String> nsUris,
              String wantedLocalName)
focal_class.class_method_signature: SoapUtils.extractSoapBody(String soapEnvelope)
focal_class.full_signature: public static String extractSoapBody(String soapEnvelope)
focal_class.identifier: extractSoapBody
focal_class.modifiers: public static
focal_class.parameters: (String soapEnvelope)
focal_class.return: String
focal_class.signature: String extractSoapBody(String soapEnvelope)
focal_class.class_method_signature: SoapUtils.extractNonEmptyElement(String document, String elementName)
focal_class.full_signature: public static String extractNonEmptyElement(String document, String elementName)
focal_class.identifier: extractNonEmptyElement
focal_class.modifiers: public static
focal_class.parameters: (String document, String elementName)
focal_class.return: String
focal_class.signature: String extractNonEmptyElement(String document, String elementName)
focal_class.class_method_signature: SoapUtils.extractOutgoingException(Exchange exchange)
focal_class.full_signature: public static Exception extractOutgoingException(Exchange exchange)
focal_class.identifier: extractOutgoingException
focal_class.modifiers: public static
focal_class.parameters: (Exchange exchange)
focal_class.return: Exception
focal_class.signature: Exception extractOutgoingException(Exchange exchange)
focal_class.class_method_signature: SoapUtils.extractOutgoingPayload(Exchange exchange)
focal_class.full_signature: public static String extractOutgoingPayload(Exchange exchange)
focal_class.identifier: extractOutgoingPayload
focal_class.modifiers: public static
focal_class.parameters: (Exchange exchange)
focal_class.return: String
focal_class.signature: String extractOutgoingPayload(Exchange exchange)
focal_method.body: public static String extractSoapBody(String soapEnvelope) {
          try {
              /*
               * We search for following positions (variables posXX):
               *
               *    <S:Envelope><S:Body>the required information</S:Body><S:Envelope>
               *                3      4                        1  2    5
               *
               *
               *    <Envelope><Body>the required information</Body><Envelope>
               *   2                                        1     5
               *
               */
              int pos1, pos2, pos3, pos4, pos5;
              pos1 = soapEnvelope.lastIndexOf("<");
              pos1 = soapEnvelope.lastIndexOf("<", pos1 - 1);
              pos5 = soapEnvelope.indexOf(">", pos1);
              if (soapEnvelope.charAt(pos5 - 1) == '/') {
                  return "";
              }
              pos2 = soapEnvelope.indexOf(":", pos1);
              String soapPrefix = ((pos2 == -1) || (pos5 < pos2)) ?
                      "" : soapEnvelope.substring(pos1 + 2, pos2 + 1);
              String bodyElementStart = new StringBuilder()
                  .append('<')
                  .append(soapPrefix)
                  .append("Body")
                  .toString();
              pos3 = soapEnvelope.indexOf(bodyElementStart);
              pos4 = soapEnvelope.indexOf('>', pos3 + bodyElementStart.length());
              return soapEnvelope.substring(pos4 + 1, pos1);
  
          } catch(Exception e) {
              LOG.error("Invalid contents, probably not a SOAP Envelope in the parameter", e);
              return soapEnvelope;
          }
      }
focal_method.class_method_signature: SoapUtils.extractSoapBody(String soapEnvelope)
focal_method.full_signature: public static String extractSoapBody(String soapEnvelope)
focal_method.identifier: extractSoapBody
focal_method.invocations: lastIndexOf lastIndexOf indexOf charAt indexOf substring toString append append append indexOf indexOf length substring error
focal_method.modifiers: public static
focal_method.parameters: (String soapEnvelope)
focal_method.return: String
focal_method.signature: String extractSoapBody(String soapEnvelope)