"http://schemas.xmlsoap.org/wsdl/", the namespace on the "definitions" element, is not a valid SOAP

来源:互联网 发布:淘宝自己做衣服卖 编辑:程序博客网 时间:2024/05/17 16:46

org.apache.cxf.binding.soap.SoapFault: "http://schemas.xmlsoap.org/wsdl/", the namespace on the "definitions" element, is not a valid SOAP version.

今天对端调服务端报上面错误,

对端调用代码:

        JaxWsProxyFactoryBean  factory =new JaxWsProxyFactoryBean();

        // 添加访问接口类

        factory.setServiceClass(CompensationService.class);

        // 添加访问接口wsdl

        factory.setAddress("http://10.9.111.11:80/china/services/getCompensationInfoService?wsdl");

        // 创建访问借接口

        CompensationService client = (CompensationService)factory.create();

        // 连接参数设定

        Client proxy = ClientProxy.getClient(client);

        HTTPConduit conduit = (HTTPConduit) proxy.getConduit();

        HTTPClientPolicy policy = new HTTPClientPolicy();

        // 连接超时时间

        policy.setConnectionTimeout(10000);

        // 请求超时时间

        policy.setReceiveTimeout(10000);

        conduit.setClient(policy);

       //调用接口,返回信息

        List<CompensationOutputParam> outputParam = client.updateCompensationInfo(inputParam);

修改setAddress("http://10.9.111.11:80/china/services/getCompensationInfoService?wsdl");中地址中?wsdl去掉测试后我这测试可以,对端说去掉?wsdl后不能访问,修改又增加?wsdl后访问恢复!!!问题很奇怪,后来我看了看网上可以用下面调用方式

// 修改成以下方式初始化

     URL url = new URL("http://10.9.111.11:80/china/services/getCompensationInfoService?wsdl");

     CompensationService client =new CompensationServiceImpl(url).getCompensationServiceImplPort();

我测试结果不理想,返回响应速度不行,不建议使用!

希望对你有帮助,祝你有一个好心情,加油!

若有错误、不全、可优化的点,欢迎纠正与补充!

阅读全文
0 0
原创粉丝点击