Web services 使用CXF在运行时生成的WSDL中未加前缀的类型

Web services 使用CXF在运行时生成的WSDL中未加前缀的类型,web-services,jax-ws,cxf,Web Services,Jax Ws,Cxf,我有一个与Spring集成的Java first web服务。服务界面很简单: @WebService public interface ContactService { public void addContact(@WebParam(name="contact") Contact contact); public List<Contact> listContact(); public void removeContact(@WebParam(name="

我有一个与Spring集成的Java first web服务。服务界面很简单:

@WebService
public interface ContactService {

    public void addContact(@WebParam(name="contact") Contact contact);
    public List<Contact> listContact();
    public void removeContact(@WebParam(name="id") Integer id);
}
模型:

@XmlAccessorType( XmlAccessType.FIELD )
public class Contact {
    private Integer id;
    private String firstname;
    private String lastname;
    private String email;
    private String telephone;
}
如果我使用Maven plugin
cxf-java2ws-plugin
,则生成的WSDL是正确的。但是,如果不指定WSDL,CXF在运行时生成的WSDL将不起作用

例如,在由
cxf-java2ws-plugin
生成的返回类型中,返回类型正确地以
tns
作为前缀:

<xs:complexType name="listContactResponse">
<xs:sequence>
  <xs:element maxOccurs="unbounded" minOccurs="0" name="return" type="tns:contact"/>
</xs:sequence>

两个WSDL都包含正确的复杂类型
联系人


我如何告诉CXF/JAX-WS联系人是它在WSDL中定义的类型?

看看xsd,它使用WSDL自动生成:

schemaLocation="http://<server>:<port>/<app>/<webservice>?xsd=1
schemaLocation=“http://://?xsd=1
<xsd:complexType name="listContactResponse">
<xsd:sequence>
  <xsd:element maxOccurs="unbounded" minOccurs="0" name="return" type="contact"/>
</xsd:sequence>
schemaLocation="http://<server>:<port>/<app>/<webservice>?xsd=1