For the Question 1 I just found you create the SOAP message by hand, it could be more easy for you to use camel soap data format[1].
For the Question 2 What's the javascript looks like, if it is static you can add customer handler to the camel-jetty endpoint to return the static file to the browser. [1]http://camel.apache.org/soap.html -- Willem Jiang Red Hat, Inc. FuseSource is now part of Red Hat Web: http://www.fusesource.com | http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem On Tuesday, May 21, 2013 at 5:47 AM, wagnermarques wrote: > Willem, I was thinking to start with a simple hardcoded string message first > because I have a so simple webservice that receive a string and return the > same string. > > If this is ok, I will work with real xml instances... > > > > I found a aproach to do it and if someone have a remark, please help me!!! > My inspiration was > https://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-cxf/ > > Sorry for the length of the post and much comments, but I am put the > solution in this way because was so hard to me find and understand a > solution to create a cxf provider and it can help someone in the future. > > > I would like to ask: > 1) I am not shure if I still need xslt? Maybe in another moment. > 2) Could I return javascript to the browser? > > > > > > > > > *BELOW IS THE ROUTE* > > > <?xml version="1.0" encoding="UTF-8"?> > <beans xmlns="http://www.springframework.org/schema/beans" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:cxf="http://camel.apache.org/schema/cxf" > xsi:schemaLocation=" > http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans.xsd > http://camel.apache.org/schema/spring > http://camel.apache.org/schema/spring/camel-spring.xsd > http://camel.apache.org/schema/cxf > http://camel.apache.org/schema/cxf/camel-cxf.xsd"> > > <cxf:cxfEndpoint id="echoEndpoint" > > serviceClass="org.apache.camel.example.cxf.provider.GreeterProvider" > address="http://localhost:8282/ode/processes/ProcessoSincrono" > wsdlURL="wsdl/ProcessoSincronoArtifacts.wsdl" > endpointName="s:ProcessoSincronoPort" > serviceName="s:ProcessoSincronoService" > xmlns:s="br.edu.fzlbpms.teste"/> > > <camelContext xmlns="http://camel.apache.org/schema/spring"> > > <route id="FZLBPMS_CAMEL_ROUTE___OrbeonService"> > > <from > uri="jetty:http://localhost:18181/orbeonservice/pega_dados_do_formulario?sessionSupport=true"/> > > <to uri="Handle_App_e_FormTitle_camming_from_orbeonformPROCESSOR"/> > > <setHeader headerName="CamelHttpUri"> > > <simple>http://localhost:8282/exist/rest/db/orbeon/fr/${header.fzlbpms_orbeon_app}/${header.fzlbpms_orbeon_form}/data/${header.fzlbpms_orbeon_dataId}/data.xml</simple> > </setHeader> > > <log message="----------------------------------"/> > <log message="before inOut..."/> > <log message="### body = ${body}"/> > <log message="###"/> > <log message="###"/> > <log message="###"/> > <inOut uri="http://doesnt.matter.we/override/it/anyways" /> > <log message="----------------------------------"/> > <log message="before SOAPMessageProducerPROCESSOR..."/> > <log message="### body = ${body}"/> > <log message="###"/> > <log message="###"/> > <log message="###"/> > <to uri="SOAPMessageProducerPROCESSOR"/> > <log message="----------------------------------"/> > <log message="before SOAPMessageProducerPROCESSOR..."/> > <log message="### body = ${body}"/> > <log message="###"/> > <log message="###"/> > <log message="###"/> > <to uri="cxf:bean:echoEndpoint" /> > <log message="----------------------------------"/> > <log message="before SOAPMessageConsumerPROCESSOR..."/> > <log message="### body = ${body}"/> > <log message="###"/> > <log message="###"/> > <log message="###"/> > <to uri="SOAPMessageConsumerPROCESSOR"/> > <log message="----------------------------------"/> > <log message="before SOAPMessageConsumerPROCESSOR..."/> > <log message="### body = ${body}"/> > <log message="###"/> > <log message="###"/> > <log message="###"/> > > <inOut uri="http://doesnt.matter.we/override/it/anyways" /> > </route> > </camelContext> > > > <bean id="SOAPMessageConsumerPROCESSOR" > class="br.edu.fzlbpms.service.orbeon.SOAPMessageConsumerPROCESSOR" /> > > <bean id="SOAPMessageProducerPROCESSOR" > class="br.edu.fzlbpms.service.orbeon.SOAPMessageProducerPROCESSOR" /> > > <bean id="Handle_App_e_FormTitle_camming_from_orbeonformPROCESSOR" > class="br.edu.fzlbpms.service.orbeon.Pega_dados_do_formularioPROCESSOR" > /> > > > </beans> > > > > > > > > > public class SOAPMessageConsumerPROCESSOR implements Processor { > > /** > * just prepare to show response in the browser > */ > public void process(Exchange exchange) throws Exception { > //SOAPMessage processSOAP = processSOAP(exchange); > String soapMessageBodyContentAsString = > SOAPMessageBodyContentAsString(exchange); > exchange.getIn().setBody(soapMessageBodyContentAsString); > > } > > public String SOAPMessageBodyContentAsString(Exchange exchange){ > > SOAPMessage soapMessage = > (SOAPMessage)exchange.getIn().getBody(List.class).get(0); > if (soapMessage == null) { > return "soapMessage was null in the body of the Exchange"; > } > > try { > SOAPPart sp = soapMessage.getSOAPPart(); > SOAPEnvelope se = sp.getEnvelope(); > SOAPBody sb = se.getBody(); > String requestText = sb.getFirstChild().getTextContent(); > return requestText; > } catch (Exception e) { > e.printStackTrace(); > return "Error in consume soapMessage "+e.getMessage(); > } > > } > > // public SOAPMessage processSOAP(Exchange exchange) { > // > // // Since the Camel-CXF endpoint uses a list to store the > parameters > // // and bean component uses the bodyAs expression to get the value > // // we'll need to deal with the parameters ourself > // // I DO NOT KNOW IF IT IS TRUE CONSIDERING WHAT WEBSERVICE WHAT I AM > ACCESSING > // // BECAUSE IT IS A AXIS2 WEBSERVICE AUTOMATIC CREATED FROM ODE > // //FOR NOW I WILL JUST IGNORE IT FOR A WILE AND JUST RETURN STRING > // > // SOAPMessage soapMessage = > (SOAPMessage)exchange.getIn().getBody(List.class).get(0); > // if (soapMessage == null) { > // System.out.println("Incoming null message detected..."); > // return createDefaultSoapMessage("Greetings from Apache > Camel!!!!", "null"); > // } > // > // try { > // SOAPPart sp = soapMessage.getSOAPPart(); > // SOAPEnvelope se = sp.getEnvelope(); > // SOAPBody sb = se.getBody(); > // String requestText = sb.getFirstChild().getTextContent(); > // System.out.println(requestText); > // return createDefaultSoapMessage("Greetings from Apache > Camel!!!!", requestText); > // } catch (Exception e) { > // e.printStackTrace(); > // return createDefaultSoapMessage("Greetings from Apache > Camel!!!!", e.getClass().getName()); > // } > // } > > } > > > > > > > package br.edu.fzlbpms.service.orbeon; > > import java.util.List; > > import javax.xml.namespace.QName; > import javax.xml.soap.MessageFactory; > import javax.xml.soap.SOAPBody; > import javax.xml.soap.SOAPBodyElement; > import javax.xml.soap.SOAPElement; > import javax.xml.soap.SOAPEnvelope; > import javax.xml.soap.SOAPException; > import javax.xml.soap.SOAPMessage; > import javax.xml.soap.SOAPPart; > > import org.apache.camel.Exchange; > import org.apache.camel.Processor; > > public class SOAPMessageProducerPROCESSOR implements Processor { > > > public void process(Exchange exchange) throws Exception { > exchange.getIn().setBody(createSimpleHardCodedSoapMessage()); > } > > > public SOAPMessage createSimpleHardCodedSoapMessage() { > try { > > SOAPMessage soapMessage = MessageFactory.newInstance().createMessage(); > SOAPBody body = soapMessage.getSOAPPart().getEnvelope().getBody(); > > > // QName payloadName = new QName( > // "http://apache.org/hello_world_soap_http/types", (tager namespace of > xsd) > // "greetMeResponse", "ns1"); > > QName payloadName = new QName( > "br.edu.fzlbpms.teste", > "ProcessoSincronoRequest", "br"); > > SOAPBodyElement payload = body.addBodyElement(payloadName); > > SOAPElement message = payload.addChildElement("input"); > > message.addTextNode("string_to_echo"); > > return soapMessage; > > } catch (SOAPException e) { > e.printStackTrace(); > throw new RuntimeException(e); > } > } > > } > > > > > > *THIS IS THE SERVICEMIX LOG* > > > 17:33:11,783 | INFO | qtp8427326-1908 | BPMS_CAMEL_ROUTE___OrbeonService | > 90 - org.apache.camel.camel-core - 2.8.0.fuse-07-15 | > ---------------------------------- > 17:33:11,783 | INFO | qtp8427326-1908 | BPMS_CAMEL_ROUTE___OrbeonService | > 90 - org.apache.camel.camel-core - 2.8.0.fuse-07-15 | before inOut... > 17:33:11,783 | INFO | qtp8427326-1908 | BPMS_CAMEL_ROUTE___OrbeonService | > 90 - org.apache.camel.camel-core - 2.8.0.fuse-07-15 | ### body = > 17:33:11,783 | INFO | qtp8427326-1908 | BPMS_CAMEL_ROUTE___OrbeonService | > 90 - org.apache.camel.camel-core - 2.8.0.fuse-07-15 | ### > 17:33:11,783 | INFO | qtp8427326-1908 | BPMS_CAMEL_ROUTE___OrbeonService | > 90 - org.apache.camel.camel-core - 2.8.0.fuse-07-15 | ### > 17:33:11,783 | INFO | qtp8427326-1908 | BPMS_CAMEL_ROUTE___OrbeonService | > 90 - org.apache.camel.camel-core - 2.8.0.fuse-07-15 | ### > 17:33:11,787 | INFO | qtp8427326-1908 | BPMS_CAMEL_ROUTE___OrbeonService | > 90 - org.apache.camel.camel-core - 2.8.0.fuse-07-15 | > ---------------------------------- > 17:33:11,787 | INFO | qtp8427326-1908 | BPMS_CAMEL_ROUTE___OrbeonService | > 90 - org.apache.camel.camel-core - 2.8.0.fuse-07-15 | before > SOAPMessageProducerPROCESSOR... > 17:33:11,787 | INFO | qtp8427326-1908 | BPMS_CAMEL_ROUTE___OrbeonService | > 90 - org.apache.camel.camel-core - 2.8.0.fuse-07-15 | ### body =* <form > xmlns:xxi="http://orbeon.org/oxf/xml/xinclude" > xmlns:xh="http://www.w3.org/1999/xhtml" > xmlns:ev="http://www.w3.org/2001/xml-events" > xmlns:xi="http://www.w3.org/2001/XInclude" > xmlns:saxon="http://saxon.sf.net/" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > xmlns:fb="http://orbeon.org/oxf/xml/form-builder" > xmlns:xbl="http://www.w3.org/ns/xbl" > xmlns:xxf="http://orbeon.org/oxf/xml/xforms" > xmlns:version="java:org.orbeon.oxf.common.Version" > xmlns:sql="http://orbeon.org/oxf/xml/sql" > xmlns:p="http://www.orbeon.com/oxf/pipeline" > xmlns:fr="http://orbeon.org/oxf/xml/form-runner" > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" > xmlns:xf="http://www.w3.org/2002/xforms" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:exf="http://www.exforms.org/exf/1-0"> > <section-1> > <control-1>ihihihihih</control-1> > <control-3>ihihihihih</control-3> > </section-1> > </form>* > 17:33:11,787 | INFO | qtp8427326-1908 | BPMS_CAMEL_ROUTE___OrbeonService | > 90 - org.apache.camel.camel-core - 2.8.0.fuse-07-15 | ### > 17:33:11,787 | INFO | qtp8427326-1908 | BPMS_CAMEL_ROUTE___OrbeonService | > 90 - org.apache.camel.camel-core - 2.8.0.fuse-07-15 | ### > 17:33:11,787 | INFO | qtp8427326-1908 | BPMS_CAMEL_ROUTE___OrbeonService | > 90 - org.apache.camel.camel-core - 2.8.0.fuse-07-15 | ### > 17:33:11,788 | INFO | qtp8427326-1908 | BPMS_CAMEL_ROUTE___OrbeonService | > 90 - org.apache.camel.camel-core - 2.8.0.fuse-07-15 | > ---------------------------------- > 17:33:11,788 | INFO | qtp8427326-1908 | BPMS_CAMEL_ROUTE___OrbeonService | > 90 - org.apache.camel.camel-core - 2.8.0.fuse-07-15 | before > SOAPMessageProducerPROCESSOR... > 17:33:11,788 | INFO | qtp8427326-1908 | BPMS_CAMEL_ROUTE___OrbeonService | > 90 - org.apache.camel.camel-core - 2.8.0.fuse-07-15 | ### body = > *<SOAP-ENV:Envelope > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><br:ProcessoSincronoRequest > xmlns:br="br.edu.fzlbpms.teste"><input>string_to_echo</input></br:ProcessoSincronoRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>* > 17:33:11,788 | INFO | qtp8427326-1908 | BPMS_CAMEL_ROUTE___OrbeonService | > 90 - org.apache.camel.camel-core - 2.8.0.fuse-07-15 | ### > 17:33:11,788 | INFO | qtp8427326-1908 | BPMS_CAMEL_ROUTE___OrbeonService | > 90 - org.apache.camel.camel-core - 2.8.0.fuse-07-15 | ### > 17:33:11,789 | INFO | qtp8427326-1908 | BPMS_CAMEL_ROUTE___OrbeonService | > 90 - org.apache.camel.camel-core - 2.8.0.fuse-07-15 | ### > 17:33:11,927 | INFO | ault-workqueue-1 | BPMS_CAMEL_ROUTE___OrbeonService | > 90 - org.apache.camel.camel-core - 2.8.0.fuse-07-15 | > ---------------------------------- > 17:33:11,928 | INFO | ault-workqueue-1 | BPMS_CAMEL_ROUTE___OrbeonService | > 90 - org.apache.camel.camel-core - 2.8.0.fuse-07-15 | before > SOAPMessageConsumerPROCESSOR... > 17:33:11,928 | INFO | ault-workqueue-1 | BPMS_CAMEL_ROUTE___OrbeonService | > 90 - org.apache.camel.camel-core - 2.8.0.fuse-07-15 | ### body =* > <soapenv:Envelope > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header/><soapenv:Body><ProcessoSincronoResponse > xmlns="br.edu.fzlbpms.teste"> > <tns:result xmlns:tns="br.edu.fzlbpms.teste"><input > xmlns="">string_to_echo</input></tns:result>* > </ProcessoSincronoResponse></soapenv:Body></soapenv:Envelope> > 17:33:11,928 | INFO | ault-workqueue-1 | BPMS_CAMEL_ROUTE___OrbeonService | > 90 - org.apache.camel.camel-core - 2.8.0.fuse-07-15 | ### > 17:33:11,929 | INFO | ault-workqueue-1 | BPMS_CAMEL_ROUTE___OrbeonService | > 90 - org.apache.camel.camel-core - 2.8.0.fuse-07-15 | ### > 17:33:11,929 | INFO | ault-workqueue-1 | BPMS_CAMEL_ROUTE___OrbeonService | > 90 - org.apache.camel.camel-core - 2.8.0.fuse-07-15 | ### > 17:33:11,929 | INFO | ault-workqueue-1 | BPMS_CAMEL_ROUTE___OrbeonService | > 90 - org.apache.camel.camel-core - 2.8.0.fuse-07-15 | > ---------------------------------- > 17:33:11,929 | INFO | ault-workqueue-1 | BPMS_CAMEL_ROUTE___OrbeonService | > 90 - org.apache.camel.camel-core - 2.8.0.fuse-07-15 | before > SOAPMessageConsumerPROCESSOR... > 17:33:11,929 | INFO | ault-workqueue-1 | BPMS_CAMEL_ROUTE___OrbeonService | > 90 - org.apache.camel.camel-core - 2.8.0.fuse-07-15 | ### body = > string_to_echo > > 17:33:11,929 | INFO | ault-workqueue-1 | BPMS_CAMEL_ROUTE___OrbeonService | > 90 - org.apache.camel.camel-core - 2.8.0.fuse-07-15 | ### > 17:33:11,929 | INFO | ault-workqueue-1 | BPMS_CAMEL_ROUTE___OrbeonService | > 90 - org.apache.camel.camel-core - 2.8.0.fuse-07-15 | ### > 17:33:11,929 | INFO | ault-workqueue-1 | BPMS_CAMEL_ROUTE___OrbeonService | > 90 - org.apache.camel.camel-core - 2.8.0.fuse-07-15 | ### > > > > > > > > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Sharing-a-solution-for-discussion-tp5732560p5732854.html > Sent from the Camel - Users mailing list archive at Nabble.com > (http://Nabble.com).