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();
  • 相关阅读:
    装箱,拆箱
    service 入门
    反射的文章
    二叉树的先序遍历,中序遍历,后续遍历 (文章)
    QTP里的DOM应用
    QTP对Excel的操作(EOM)
    QTP实用小技巧(1)
    QTP环境变量的动态生成与加载(深入篇)
    自动化测试基础
    QTP正则表达式
  • 原文地址:https://www.cnblogs.com/Gyoung/p/5489010.html
Copyright © 2011-2022 走看看