HttpWebService extends ServletBase { protected Map getParameterMapFromPayload( final String xml ) { Map parameters = new HashMap(); Document doc = null; try { doc = XmlDom4JHelper.getDocFromString( xml, new PentahoEntityResolver() ); } catch ( XmlParseException e ) { error( Messages.getInstance().getErrorString( "HttpWebService.ERROR_0001_ERROR_DURING_WEB_SERVICE" ), e ); return parameters; } List parameterNodes = doc.selectNodes( " for ( int i = 0; i < parameterNodes.size(); i++ ) { Node parameterNode = (Node) parameterNodes.get( i ); String parameterName = parameterNode.getName(); String parameterValue = parameterNode.getText(); parameters.put( parameterName, parameterValue ); } return parameters; } HttpWebService(); @Override Log getLogger(); String getPayloadAsString( final HttpServletRequest request ); void doGetFixMe( final HttpServletRequest request, final HttpServletResponse response ); @Override void doGet( final HttpServletRequest request, final HttpServletResponse response );  }
@Test public void testGetParameterMapFromPayload() throws Exception { Map parameterMapFromPayload = httpWebService.getParameterMapFromPayload( payload ); assertNotNull( parameterMapFromPayload ); assertEquals( 1, parameterMapFromPayload.size() ); assertEquals( "hello world", parameterMapFromPayload.get( "name" ) ); }
@Test public void testGetParameterMapFromPayload_invalidXml() throws Exception { Map parameterMapFromPayload = httpWebService.getParameterMapFromPayload( "<SOAP-ENV:Envelope " + "xmlns:SOAP-ENV=\"http: assertNotNull( parameterMapFromPayload ); assertEquals( 0, parameterMapFromPayload.size() ); }