camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carnevalegiacomo <carnevalegiac...@gmail.com>
Subject camel-cxf/PAYLOAD and MTOM error
Date Sat, 18 Feb 2017 08:24:36 GMT
Hi,
I am invoking a soap service (ServiceA) that invokes another soap service
(ServiceB) using CXF with dataFormat=PAYLOAD.
ServiceB, using MTOM, returns a base64Binary field (pdfContent) that is to
be returned from ServiceA to the client (using MTOM).

CXF ENDPOINT

/<cxf:cxfEndpoint xmlns:s="http://ws.a.service/v1"
                     id="ServiceAEndpoint"
                     address="/ServiceA_v1"
                     endpointName="s:ServiceASoap_v1"
                     serviceName="s:ServiceA_v1"
                     serviceClass="service.a.ws.ServiceAV1"
                     wsdlURL="wsdl/serviceA_v1.0.wsdl">
        <cxf:properties>
            <entry key="schema-validation-enabled" value="true" />
            <entry key="mtom-enabled" value="true" />
        </cxf:properties>
</cxf:cxfEndpoint>
<cxf:cxfEndpoint xmlns:s="http://ws.b.service/v1"
                     id="ServiceBEndpoint"
                     address="/ServiceB_v1"
                     endpointName="s:ServiceBSoap_v1"
                     serviceName="s:ServiceB_v1"
                     serviceClass="service.b.ws.ServiceAV1"
                     wsdlURL="wsdl/serviceB_v1.0.wsdl">
        <cxf:properties>
            <entry key="schema-validation-enabled" value="true" />
            <entry key="mtom-enabled" value="true" />
        </cxf:properties>
</cxf:cxfEndpoint>/

CAMEL ROUTE

/<route id="ABRoute_v1">
            <from uri="cxf:bean:ServiceAEndpoint?dataFormat=PAYLOAD/>
            <removeHeaders pattern="*"/>
            <setHeader headerName="operationName">
                <simple>getPdf</simple>
            </setHeader>
            <to uri="xslt:xslt/getPdf.xsl"/>
            <to uri="cxf:bean:serviceB?dataFormat=PAYLOAD"/>
            <to uri="xslt:xslt/getPdfResponse.xsl"/>
            <process ref="getDocumentResponseProcessor"/>
</route>

getPdfResponse.xsl

/<xsl:template match="serviceB:getPdfResponse">
        <serviceA:getDocumentResponse>
..../
<serviceA:documentFile>
                <xop:Include
xmlns:xop="http://www.w3.org/2004/08/xop/include">
                    <xsl:attribute name="href">
                        <xsl:value-of
select="serviceB:pdfContent/xop:Include/@href"/>
                    </xsl:attribute>
                </xop:Include>
</serviceA:documentFile>
...
</serviceA:getDocumentResponse>/

getDocumentResponseProcessor

/final Message in = exchange.getIn();
LOG.info("Attachments: {}", in.getAttachments().size());
List<Source> elements = new ArrayList<>();
elements.add(in.getBody(Source.class));
CxfPayload<SoapHeader> cxfPayload = new CxfPayload<>(new
ArrayList<>(),elements, null);
in.setBody(cxfPayload);/

CXF throws the following fault:

*| INFO  | ault-workqueue-2 | GetDocumentResponseProcessor ... |
Attachments: 1
| WARN  | qtp585654247-71  | PhaseInterceptorChain            | 74 -
org.apache.cxf.cxf-core
org.apache.cxf.interceptor.Fault: Could not generate the XML stream caused
by: org.xml.sax.SAXParseException: cvc-type.3.1.2: Element
'serviceA:documentFile' is a simple type, so it must have no element
information item [children]..
        at
org.apache.cxf.databinding.source.XMLStreamDataWriter.write(XMLStreamDataWriter.java:99)[74:org.apache.cxf.cxf-core:3.0.4.redhat-621083]
        at
org.apache.cxf.databinding.source.XMLStreamDataWriter.write(XMLStreamDataWriter.java:54)[74:org.apache.cxf.cxf-core:3.0.4.redhat-621083]*


I am using Apache Camel 2.15.1, Blueprint and JBoss Fuse 6.2.1.

Regards,
Giacomo



--
View this message in context: http://camel.465427.n5.nabble.com/camel-cxf-PAYLOAD-and-MTOM-error-tp5794073.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message