在通过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();
05-08 14:49