SoapUtils { public static String extractActionFromContentType(String contentType) { if (contentType != null) { Matcher matcher = ACTION_PATTERN.matcher(contentType); if (matcher.find() && matcher.groupCount() == 1) { return matcher.group(1).trim(); } } return TransportConstants.EMPTY_SOAP_ACTION; } private  SoapUtils(); static String escapeAction(String soapAction); static String extractActionFromContentType(String contentType); static String setActionInContentType(String contentType, String action);  }
@Test public void testExtractActionFromContentType() throws Exception { String soapAction = "http: String contentType = "application/soap+xml; action=" + soapAction; String result = SoapUtils.extractActionFromContentType(contentType); Assert.assertEquals("Invalid SOAP action", soapAction, result); contentType = "application/soap+xml; action = " + soapAction; result = SoapUtils.extractActionFromContentType(contentType); Assert.assertEquals("Invalid SOAP action", soapAction, result); contentType = "application/soap+xml; action=" + soapAction + " ; charset=UTF-8"; result = SoapUtils.extractActionFromContentType(contentType); Assert.assertEquals("Invalid SOAP action", soapAction, result); contentType = "application/soap+xml; charset=UTF-8; action=" + soapAction; result = SoapUtils.extractActionFromContentType(contentType); Assert.assertEquals("Invalid SOAP action", soapAction, result); }