опубликовать конфликт имен схемы wsdl в коллекции

1210 просмотра

1 ответ

422 Репутация автора

у меня проблема, когда я публикую wsdl через servicemix с jaxws

У меня есть файл WSDL, как:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="CartesSim" targetNamespace="http://monappli.com/cartesSim/cartesSim/V1"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:tns="http://monappli.com/cartesSim/cartesSim/V1"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:cs="http://monappli.com/cartesSim/datatypes/V1">
<wsdl:types>
    <xsd:schema targetNamespace="http://monappli.com/cartesSim/cartesSim/V1">
        <xsd:import namespace="http://monappli.com/cartesSim/datatypes/V1" schemaLocation="cartesSim.xsd" />

        <xsd:element name="chargerCartesSimInput" type="cs:referentielCartesSim" />
        <xsd:element name="chargerCartesSimOutput" type="cs:rapportImport" />

        <xsd:element name="chargerConsoCartesSimInput" type="cs:consommationCartesSim" />
        <xsd:element name="chargerConsoCartesSimOutput" type="cs:rapportImport" />
    </xsd:schema>
</wsdl:types>

<wsdl:message name="chargerCartesSim">
    <wsdl:part element="tns:chargerCartesSimInput" name="parameters"/>
</wsdl:message>
<wsdl:message name="chargerCartesSimResponse">
    <wsdl:part element="tns:chargerCartesSimOutput" name="parameters"/>
</wsdl:message>
<wsdl:message name="chargerConsoCartesSim">
    <wsdl:part element="tns:chargerConsoCartesSimInput" name="parameters"/>
</wsdl:message>
<wsdl:message name="chargerConsoCartesSimResponse">
    <wsdl:part element="tns:chargerConsoCartesSimOutput" name="parameters"/>
</wsdl:message>
<!-- fault -->
<wsdl:message name="cartesSimFault" >
    <wsdl:part type="xsd:string" name="errorMessage" />
</wsdl:message>

<wsdl:portType name="CartesSim">
    <wsdl:operation name="chargerCartesSim">
        <wsdl:input message="tns:chargerCartesSim"/>
        <wsdl:output message="tns:chargerCartesSimResponse"/>
        <wsdl:fault message="tns:cartesSimFault" name="cartesSimFault"/>
    </wsdl:operation>
    <wsdl:operation name="chargerConsoCartesSim">
        <wsdl:input message="tns:chargerConsoCartesSim"/>
        <wsdl:output message="tns:chargerConsoCartesSimResponse"/>
        <wsdl:fault message="tns:cartesSimFault" name="cartesSimFault"/>
    </wsdl:operation>
</wsdl:portType>

<wsdl:binding name="CartesSimSOAP" type="tns:CartesSim">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="chargerCartesSim">
        <soap:operation soapAction="chargerCartesSim"/>
        <wsdl:input>
            <soap:body use="literal"/>
        </wsdl:input>
        <wsdl:output>
            <soap:body use="literal"/>
        </wsdl:output>
        <wsdl:fault name="cartesSimFault">
            <soap:body use="literal"/>
        </wsdl:fault>
    </wsdl:operation>
    <wsdl:operation name="chargerConsoCartesSim">
        <soap:operation soapAction="chargerConsoCartesSim"/>
        <wsdl:input>
            <soap:body use="literal"/>
        </wsdl:input>
        <wsdl:output>
            <soap:body use="literal"/>
        </wsdl:output>
        <wsdl:fault name="cartesSimFault">
            <soap:body use="literal"/>
        </wsdl:fault>
    </wsdl:operation>
</wsdl:binding>

<wsdl:service name="CartesSim">
    <wsdl:port binding="tns:CartesSimSOAP" name="CartesSimSOAP">
        <soap:address location="http://localhost/CartesSim"/>
    </wsdl:port>
</wsdl:service>

и xsd вот так:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://monappli.com/cartesSim/datatypes/V1" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<xsd:complexType name="referentielCartesSim">
    <xsd:sequence>
        <xsd:element name="fichier" type="xsd:base64Binary"/>
    </xsd:sequence>
</xsd:complexType>

<xsd:complexType name="consommationCartesSim">
    <xsd:sequence>
        <xsd:element name="fichier" type="xsd:base64Binary"/>
        <xsd:element name="mois" type="xsd:gYearMonth" />
    </xsd:sequence>
</xsd:complexType>

<xsd:complexType name="rapportImport">
    <xsd:sequence>
        <xsd:element name="fichier" type="xsd:base64Binary"/>
    </xsd:sequence>
</xsd:complexType>

генерация с wsdl2java работает нормально.

но когда я публикую конечную точку в проекте, как это:

<jaxws:endpoint implementor="#webServiceCartesSim"
    address="/cartesim">
    <jaxws:dataBinding>
        <bean class="org.apache.cxf.jaxb.JAXBDataBinding"/>
    </jaxws:dataBinding>
</jaxws:endpoint>

я получил эту ошибку в servicemix:

Caused by: javax.xml.ws.WebServiceException: org.apache.ws.commons.schema.XmlSchemaException: Schema name conflict in collection
    at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:371)
    at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:251)
    at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:539)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.7.0_71]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_71]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_71]
    at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_71]
    at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:297)[18:org.apache.aries.blueprint.core:1.4.3]
    at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:958)[18:org.apache.aries.blueprint.core:1.4.3]
    at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:712)[18:org.apache.aries.blueprint.core:1.4.3]
    ... 39 more
Caused by: org.apache.ws.commons.schema.XmlSchemaException: Schema name conflict in collection
    at org.apache.ws.commons.schema.XmlSchema.<init>(XmlSchema.java:126)
    at org.apache.ws.commons.schema.XmlSchema.<init>(XmlSchema.java:140)
    at org.apache.cxf.common.xmlschema.SchemaCollection.newXmlSchemaInCollection(SchemaCollection.java:194)
    at org.apache.cxf.jaxb.JAXBSchemaInitializer.createBridgeXsElement(JAXBSchemaInitializer.java:355)
    at org.apache.cxf.jaxb.JAXBSchemaInitializer.checkForExistence(JAXBSchemaInitializer.java:333)
    at org.apache.cxf.jaxb.JAXBSchemaInitializer.begin(JAXBSchemaInitializer.java:150)
    at org.apache.cxf.service.ServiceModelVisitor.visitOperation(ServiceModelVisitor.java:120)
    at org.apache.cxf.service.ServiceModelVisitor.walk(ServiceModelVisitor.java:74)
    at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:396)
    at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86)
    at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:467)
    at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:712)
    at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:527)
    at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:261)
    at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:215)
    at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:102)
    at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:159)
    at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211)
    at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:456)
    at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:334)
    ... 48 more

я не нахожу проблему :(

Исходный код XmlSchema:

 if (parent != null) {
        XmlSchemaCollection.SchemaKey schemaKey = new XmlSchemaCollection.SchemaKey(this.logicalTargetNamespace, systemId);

        if (parent.containsSchema(schemaKey)) {
            throw new XmlSchemaException("Schema name conflict in collection");
        }
        parent.addSchema(schemaKey, this);
    }

но apache не может напечатать schemaKey в журнале, поэтому я не знаю, где находится ошибка.

Спасибо за вашу помощь

Автор: Mançaux Pierre-Alexandre Источник Размещён: 18.07.2016 09:34

Ответы (1)


1 плюс

422 Репутация автора

Решение

наконец я нахожу решение:

я заявляю свою конечную точку, как это, и все работает отлично!

<jaxws:endpoint implementor="#webServiceCartesSim"
wsdlLocation="classpath:cartesSim.wsdl"
                    address="/cartesSim"
                    xmlns:s="http://monappli.com/cartesSim/cartesSim/V1"
                    serviceName="s:CartesSim"
                    >
    <jaxws:dataBinding>
        <bean class="org.apache.cxf.jaxb.JAXBDataBinding"/>
    </jaxws:dataBinding>
</jaxws:endpoint>
Автор: Mançaux Pierre-Alexandre Размещён: 18.07.2016 10:21
Вопросы из категории :
32x32