当前位置:   article > 正文

cxf webservice 生成wsdl方法参数名称为arg0问题

arg0 should be of type com.vispractice.fssc.eas.thirdws.facade.webservice.mu

在通过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();

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/木道寻08/article/detail/827750
推荐阅读
相关标签
  

闽ICP备14008679号