@Test public void testRemoveResponseTag13() { String source = "<testServiceResponse><wrapper><param1>value1</param1><param2>value2</param2></wrapper></testServiceResponse>"; String result = "<wrapper><param1>value1</param1><param2>value2</param2></wrapper>"; assertEquals(result, ConsumerGatewayUtil.removeResponseTag(source)); if (SOAPHelper.xmlStrToSOAPElement(result) == null) { fail("Response can't be null"); } }
public static String removeResponseTag(String message) { String responsePrefix = ""; String regex = ".*<(\\w+:)*(\\w+R|r)esponse.*?>.*"; Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(message); if (matcher.find()) { if (matcher.group(1) != null) { responsePrefix = matcher.group(1); log.debug("Response tag's prefix is \"{}\".", responsePrefix); } else { log.debug("No namespace prefix was found for response tag."); } } String response = message.replaceAll("<(/)*" + responsePrefix + "(\\w+R|r)esponse.*?>", ""); if (!responsePrefix.isEmpty()) { response = response.replaceAll("(</{0,1})" + responsePrefix, "$1"); } return response; }
ConsumerGatewayUtil { public static String removeResponseTag(String message) { String responsePrefix = ""; String regex = ".*<(\\w+:)*(\\w+R|r)esponse.*?>.*"; Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(message); if (matcher.find()) { if (matcher.group(1) != null) { responsePrefix = matcher.group(1); log.debug("Response tag's prefix is \"{}\".", responsePrefix); } else { log.debug("No namespace prefix was found for response tag."); } } String response = message.replaceAll("<(/)*" + responsePrefix + "(\\w+R|r)esponse.*?>", ""); if (!responsePrefix.isEmpty()) { response = response.replaceAll("(</{0,1})" + responsePrefix, "$1"); } return response; } }
ConsumerGatewayUtil { public static String removeResponseTag(String message) { String responsePrefix = ""; String regex = ".*<(\\w+:)*(\\w+R|r)esponse.*?>.*"; Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(message); if (matcher.find()) { if (matcher.group(1) != null) { responsePrefix = matcher.group(1); log.debug("Response tag's prefix is \"{}\".", responsePrefix); } else { log.debug("No namespace prefix was found for response tag."); } } String response = message.replaceAll("<(/)*" + responsePrefix + "(\\w+R|r)esponse.*?>", ""); if (!responsePrefix.isEmpty()) { response = response.replaceAll("(</{0,1})" + responsePrefix, "$1"); } return response; } private  ConsumerGatewayUtil(); }
ConsumerGatewayUtil { public static String removeResponseTag(String message) { String responsePrefix = ""; String regex = ".*<(\\w+:)*(\\w+R|r)esponse.*?>.*"; Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(message); if (matcher.find()) { if (matcher.group(1) != null) { responsePrefix = matcher.group(1); log.debug("Response tag's prefix is \"{}\".", responsePrefix); } else { log.debug("No namespace prefix was found for response tag."); } } String response = message.replaceAll("<(/)*" + responsePrefix + "(\\w+R|r)esponse.*?>", ""); if (!responsePrefix.isEmpty()) { response = response.replaceAll("(</{0,1})" + responsePrefix, "$1"); } return response; } private  ConsumerGatewayUtil(); static Map<String, ConsumerEndpoint> extractConsumers(Properties endpoints, Properties gatewayProperties); static void extractEndpoints(String key, Properties endpoints, ConsumerEndpoint endpoint); static ConsumerEndpoint findMatch(String serviceId, Map<String, ConsumerEndpoint> endpoints); static String rewriteUrl(String servletUrl, String pathToResource, String responseStr); static ConsumerEndpoint createUnconfiguredEndpoint(Properties props, String pathToResource); static String removeResponseTag(String message); static boolean checkEncryptionProperties(Properties props, Map<String, ConsumerEndpoint> endpoints,
                                                    Map<String, Encrypter> asymmetricEncrypterCache); }
ConsumerGatewayUtil { public static String removeResponseTag(String message) { String responsePrefix = ""; String regex = ".*<(\\w+:)*(\\w+R|r)esponse.*?>.*"; Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(message); if (matcher.find()) { if (matcher.group(1) != null) { responsePrefix = matcher.group(1); log.debug("Response tag's prefix is \"{}\".", responsePrefix); } else { log.debug("No namespace prefix was found for response tag."); } } String response = message.replaceAll("<(/)*" + responsePrefix + "(\\w+R|r)esponse.*?>", ""); if (!responsePrefix.isEmpty()) { response = response.replaceAll("(</{0,1})" + responsePrefix, "$1"); } return response; } private  ConsumerGatewayUtil(); static Map<String, ConsumerEndpoint> extractConsumers(Properties endpoints, Properties gatewayProperties); static void extractEndpoints(String key, Properties endpoints, ConsumerEndpoint endpoint); static ConsumerEndpoint findMatch(String serviceId, Map<String, ConsumerEndpoint> endpoints); static String rewriteUrl(String servletUrl, String pathToResource, String responseStr); static ConsumerEndpoint createUnconfiguredEndpoint(Properties props, String pathToResource); static String removeResponseTag(String message); static boolean checkEncryptionProperties(Properties props, Map<String, ConsumerEndpoint> endpoints,
                                                    Map<String, Encrypter> asymmetricEncrypterCache);  }