2012-03-06 51 views
0

我们有一个工作的wsdl2java,但是xsd缺少xmlns定义和targetNamespace定义。当添加的WSDL2Java然后用这些错误cxf - wsdl2java不允许在xsd中声明名称空间?

<<< ERROR! 
Part <parameter> in Message <{enrollment}enrollmentResultRequestMessage> referenced Type <Enrollment> can not be found in the schemas 
Part <parameter> in Message <{enrollment}enrollmentRequestMessage> referenced Type <Enrollment> can not be found in the schemas 

打破我所做的只是改变

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> 

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://yyy.com/enrollment" targetNamespace="http://yyy.com/enrollment"> 

我升级CXF 2.5.2和仍然无法正常工作。任何人都知道为什么这不起作用?我们需要开始使用规范的xsds,并且不希望每次都删除名称空间。有任何想法吗?

是我们的错WSDL在这种情况下,或东西(尽管它与XSD的第一个版本的作品)......

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
        xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
        xmlns:xs="http://www.w3.org/2001/XMLSchema" 
        xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
        xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xmlns:tns="enrollment2" 
        xmlns:en="http://yyy.com/enrollment" 
        targetNamespace="enrollment2"> 
    <wsdl:import namespace="http://yyy.com/enrollment" location="enrollment.xsd"/> 

    <wsdl:types> 
     <xs:schema targetNamespace="enrollment2" elementFormDefault="qualified"/> 
    </wsdl:types> 

感谢, 院长

回答

3

您需要使用的xsd:进口作为包含xsd类型的wsdl:types/xs:schema的子项。

<wsdl:types> 
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
    <xsd:import namespace="http://yyy.com/enrollment" location="enrollment.xsd"> 
    </xsd:schema> 
</wsdl:types> 

这就是说,wsdl:import是导入另一个名称空间不同于wsdl定义的wsdl定义。