SoapUtils { public static String escapeAction(String soapAction) { if (!StringUtils.hasLength(soapAction)) { soapAction = "\"\""; } if (!soapAction.startsWith("\"")) { soapAction = "\"" + soapAction; } if (!soapAction.endsWith("\"")) { soapAction = soapAction + "\""; } return soapAction; } private  SoapUtils(); static String escapeAction(String soapAction); static String extractActionFromContentType(String contentType); static String setActionInContentType(String contentType, String action);  }
@Test public void testEscapeAction() throws Exception { String result = SoapUtils.escapeAction("action"); Assert.assertEquals("Invalid SOAP action", "\"action\"", result); result = SoapUtils.escapeAction("\"action\""); Assert.assertEquals("Invalid SOAP action", "\"action\"", result); result = SoapUtils.escapeAction(""); Assert.assertEquals("Invalid SOAP action", "\"\"", result); result = SoapUtils.escapeAction(null); Assert.assertEquals("Invalid SOAP action", "\"\"", result); }