zoukankan      html  css  js  c++  java
  • cxf webservice 生成wsdl方法参数名称为arg0问题

    在通过cxf生成webservice服务时,如果你是用ServerFactoryBean,那么在生成wsdl时,方法的参数名称会被自动命名为arg0,arg1...,如:

    <xsd:complexType name="addPatientRegistry">
    <xsd:sequence>
    <xsd:element minOccurs="0" name="arg0" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="addPatientRegistryResponse" type="tns:addPatientRegistryResponse"/>

    因为,java的反序列化没办法获取参数名称。

    只能用JaxWsServerFactoryBean,但在在相应的接口上加注解@WebParam

    @WebService
    @BindingType(value = SOAPBinding.SOAP12HTTP_BINDING)
    public interface HelloService {
        String hello(@WebParam(name="name")String name);
    }
     HelloService hw = new HelloServiceImpl();
            JaxWsServerFactoryBean jwsFactory = new JaxWsServerFactoryBean();
            jwsFactory.setAddress("http://10.0.1.32:5679/hello");   //指定WebService的发布地址
            jwsFactory.setServiceClass(HelloService.class);//WebService对应的类型
            jwsFactory.setServiceBean(hw);//WebService对应的实现对象
    
            jwsFactory.create();
  • 相关阅读:
    统计MySQL数据库硬盘占用量大小
    zookeeper 集群安装与配置
    On Java 8中文版 英雄召集令
    下划线参数转成驼峰
    在Ubuntu 18.04中安装JDK 8
    GIT和GitHub的使用总结
    Python目录
    selenium代码实例
    Fiddler请求图标含义
    Tensorflow之神经网络
  • 原文地址:https://www.cnblogs.com/Gyoung/p/5489010.html
Copyright © 2011-2022 走看看