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

 

相关文章:

  • 2022-12-23
  • 2021-10-11
  • 2022-12-23
  • 2022-01-23
  • 2022-02-02
猜你喜欢
  • 2021-09-07
  • 2021-11-18
  • 2021-06-03
  • 2022-02-13
  • 2021-04-02
  • 2022-12-23
  • 2021-08-03
相关资源
相似解决方案