@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); }
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()); }
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()); } }
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()); }  }
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); }
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);  }