public String sendXml(String xml) { // 创建动态客户端 JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance(); Client client = dcf.createClient(System.getProperty("wsdl.url")); // 需要密码的情况需要加上用户名和密码 // client.getOutInterceptors().add(new ClientLoginInterceptor(USER_NAME, PASS_WORD)); Object[] objects = new Object[0]; try { // invoke("方法名",参数1,参数2,参数3....); objects = client.invoke(methodName, xml); logger.debug("返回数据:" + objects[0]); return objects[0].toString(); } catch (java.lang.Exception e) { e.printStackTrace(); } return null; } public String sendSobeyXml2(String xml) throws Throwable { String url = System.getProperty("wsdl.url"); Service serv = new Service(); Call call = (Call) serv.createCall(); call.setTargetEndpointAddress(url); call.setOperationName(new QName("http://Platform/v2.0",methodName)); call.addParameter(new QName("http://Platform/v2.0", paramName), XMLType.XSD_STRING, Class.forName("java.lang.String"), ParameterMode.IN ); call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING); System.out.println("推送的xml---"+xml); String str=(String) call.invoke(new Object[] {xml}); System.out.println(str+"----------------推送成功"); return str; }