camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <>
Subject Re: Apply XSLT transforrmation after a CXF Enpoint fails
Date Wed, 31 Dec 2008 06:41:50 GMT

I think the solution is depending on your requirement.
Can you give me more detail information about your soap message?

If this multipart SOAP message has some attachments, you can use the
SOAP handler to handle this attached message, let CXF unmarshal the
SOAPEnvelope message, then you can do what you want on the request
parameters, then marshal the request according to your target service.

If there is not much change of SOAPEnvelope for the XSLT transformation
part, I think you can turn the SOAP message into a String then use
String's replace method to change it :)

For the question of WS endpoint producer.
Current CXF doesn't support to call the JAXWS dispatch API(CAMEL-382),
you still need to specify the SEI for setting CXFEndpoint.

If you already make up a whole stream soap message, you can use the
camel-http producer to send the request, but I don't know how can handle
the soap response.



GLD wrote:
> Hi,
> I want 
>   - expose a CXF endpoint "from" via a CXF servlet ==> OK, it works
>   - apply a XSLT transformation on the SOAP envelope of a multipart SOAP
> message
>      retreived via the CXF servlet    ==> KO
>   - resend the modified SOAP message via a Web service client 
> so , I built a route like this : 
>     <cxf:cxfEndpoint id="soapMessageEndpointProvider"
>         serviceClass="....MyCxfProvider"
>         address="..."
>             wsdlURL="..."
>             endpointName="s:..."
>             serviceName="s:..."
>             xmlns:s="..."/>
>     <cxf:cxfEndpoint id="soapMessageEndpointProducer"
>         serviceClass="????"
> address="http://localhost:9000/MyFinalServiceProvider/SOAPMessageService"
>             wsdlURL="..."
>             endpointName="s:..."
>             serviceName="s:..."
>             xmlns:s="..."/>
>      <camelContext id="camel-context" trace="true"
>         xmlns="">
>        <route>
>            <from uri="cxf:bean:soapMessageEndpointProvider"/>
>            <to uri="xslt:file:///c:/mySheet.xsl"/>
>            <to ref="cxf:bean:soapMessageEndpointProducer" />
>        <route>
>      </camelContext> 
> I successfully retreive my message as an instance of SOAPMessage object 
> But I have 2 issues:
> 1: When I add the xslt processor above, I have an error: 
>             "org.apache.camel.NoTypeConversionAvailableException : 
>              No type converter available to convert 
>              from type: class org.apache.camel.component.cxf.CxfMessage 
>              to the required type: javax.xml.transform.Source
>              ...." 
> So I tried to implement my own XSLT processor. 
>    I get the SOAP envelope /  SOAP PAYLOAD with:
>        SOAPMessage soapMessage =
> (SOAPMessage)inMessage.getBody(List.class).get(0);
>        SOAPPart sp = soapMessage.getSOAPPart();
>        SOAPEnvelope se = sp.getEnvelope();
>        SOAPBody sb = se.getBody();
>     And I would like to do : 
>                                                          XSLT
>        SOAPEnvelope ==> envelope(XML) ======> transformed envelope(XML) ==>
> SOAP envelope
>     In that case, my problems are : 
>       - how to retreive the XML of my SOAPEnvelope
>         (My soap message is a multipart message so I cannot apply the XSLT
> transformation on the whole http request)
>       - how to re transform my envelop XML in a SOAPEnvelope to continue the
> processing as if the XSLT transforamtion did never occur
>    I know it is probably at the frontier between CAMEL, CXF, JAX-WS and Jaxb
> but if you have an idea, it would be very helpfull for me.
> 2/ my second proble is about the WS endpoint producer 
>   With WS consumer Endpoint, it is possible to avoid the use with classes
> generated by wsdl2java
>    In that case, we use a fake Web Service Provider class (like described in
>   For Producer Endpoints (WS client), in mode MESSAGE, is it possible to do
> the same thing. Iwant to say, is it possible to avoid to add in the
> classpath the classes generated by wsdl2java).
> Thanks.  
> Guillaume

View raw message