### Question:
WSUtils { public static <T> T sendAndReceive(String soapUrl, String soapAction, String msgTpl, Object[] msgArgs, WSConverter<T> converter) { if (msgArgs != null && msgArgs.length > 0) msgTpl = java.text.MessageFormat.format(msgTpl, msgArgs); StreamSource source = new StreamSource(new StringReader(msgTpl)); StringResult xmlResult = new StringResult(); WebServiceTemplate webServiceTemplate = buildWebServiceTemplate(); webServiceTemplate.sendSourceAndReceiveToResult(soapUrl, source, new SoapActionCallback(soapAction), xmlResult); return converter.convert(xmlResult.toString()); }  static T sendAndReceive(String soapUrl, String soapAction,
                                     String msgTpl, Object[] msgArgs, WSConverter<T> converter); static String sendAndReceive(String soapUrl, String soapAction,
                                      String msgTpl, Object[] msgArgs); static String makeXMLNode(String key, String value); static String wrapXMLMark(String value);  }### Answer:
@Test public void testSendAndReceive1() { String soapUrl = "http: String soapAction = "http: String msgTpl = "<GetMasterWZ xmlns=\"http: + "<strMasterID>{0}</strMasterID>\r\n" + "<dWeiZhangKSRQ>{1}</dWeiZhangKSRQ>" + "<dWeiZhangJZRQ>{2}</dWeiZhangJZRQ>" + "<strMsg></strMsg>" + "</GetMasterWZ>"; Object[] msgArgs = new Object[]{ "17E0FFF7-7816-46A5-83A7-23D5C9F762AB", "2011-08-01", "2011-08-31"}; String xml = WSUtils.sendAndReceive(soapUrl, soapAction, msgTpl, msgArgs); Assert.assertNotNull(xml); System.out.println(xml); }
@Test public void testSendAndReceive2() { String soapUrl = "http: String soapAction = "http: String msgTpl = "<GetMasterWZ xmlns=\"http: + "<strMasterID>{0}</strMasterID>\r\n" + "<dWeiZhangKSRQ>{1}</dWeiZhangKSRQ>" + "<dWeiZhangJZRQ>{2}</dWeiZhangJZRQ>" + "<strMsg></strMsg>" + "</GetMasterWZ>"; Object[] msgArgs = new Object[]{ "17E0FFF7-7816-46A5-83A7-23D5C9F762AB", "2011-08-01", "2011-08-31"}; DataSetConverter converter = new DataSetConverter(); converter.addFormater("dateTime", new WSCalendarFormatter()); DataSet dataSet = WSUtils.sendAndReceive(soapUrl, soapAction, msgTpl, msgArgs, converter); Assert.assertNotNull(dataSet); Assert.assertNotNull(dataSet.getColumns()); System.out.println(dataSet); }