class SoapUtils {

	public static String setActionInContentType(String contentType, String action) {
		Assert.hasLength(contentType, "'contentType' must not be empty");
		if (StringUtils.hasText(action)) {
			Matcher matcher = ACTION_PATTERN.matcher(contentType);
			if (matcher.find() && matcher.groupCount() == 1) {
				StringBuffer buffer = new StringBuffer();
				matcher.appendReplacement(buffer, "action=" + action);
				matcher.appendTail(buffer);
				return buffer.toString();
			} else {
				return contentType + "; action=" + action;
			}
		} else {
			return contentType;
		}
	}

	private  SoapUtils();

}