I am trying to get a piece of information that is obtained via a cxfEndpoint
into a velocity template that will be sent on down the route to other
endpoints.  Thus far I am trying something very basic and seems like it
should work, just storing the sessionId retrieved via xpath as a header and
then referencing it in the velocity template.  Here are the basic components
currently:

*Camel Route: (beginning is just a timer and request)*
                ....
                <to uri="cxf:bean:salesforceLogin"/> 
                <convertBodyTo type="org.w3c.dom.Document" />
                <setHeader headerName="sforceSessionId" id="sforceSessionId">
                   <xpath resultType="java.lang.String">//sessionId</xpath>
                </setHeader>
                <to uri="velocity://velocity/sforceLogout.vm" />

*Message from cxf:bean:salesforceLogin:*
<?xml version="1.0" encoding="UTF-8" ?> 
   <soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
xmlns="urn:enterprise.soap.sforce.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
      <soapenv:Body>
         <loginResponse>
            <result>
               <sessionId>*ABCDE*</sessionId> 
            </result>
         </loginResponse>
      </soapenv:Body>
   </soapenv:Envelope>

*Velocity Template:*
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:urn="urn:enterprise.soap.sforce.com">
   <soapenv:Header>
      <urn:SessionHeader>
         <urn:sessionId>${headers.sforceSessionId}</urn:sessionId>
      </urn:SessionHeader>
   </soapenv:Header>
   <soapenv:Body>
      <urn:logout/>
   </soapenv:Body>
</soapenv:Envelope>


--
View this message in context: 
http://camel.465427.n5.nabble.com/Using-headers-and-velocity-tp5030214p5030214.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to