springboot调用webservice接口的两种方式,不使用axis

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();
        cal

你可能感兴趣的:(Java生产环境,java,webservice,mybatis,cxf,大数据)