I have something like this working in a unit test.  Maybe you can try
something similar:

        public static final String CXF_OPERATION_NAME = "operation";
        public static final String CXF_OPERATION_NAMESPACE = 
"http://opNamespace";;

        @Test
        @DirtiesContext
    public void myTest() throws Exception
    {

        String
pathToFileForExchangeBody="src/test/resources/xmlInstances/mypayload.xml";
        
        Exchange senderExchange = createCXFExchange(pathToFileForExchangeBody);
            
        //Send the one-way exchange.  Using template.send will send a one way
message
       Exchange returnExchange =
template.send("cxf:bean:mybean?dataFormat=PAYLOAD&loggingFeatureEnabled=true&synchronous=true",
senderExchange);
                
                //Use getException to see if we received an exception
                if (returnExchange.getException() != null)
                {       
                        throw new Exception(returnExchange.getException());
                }       
    }
    
    private Exchange createCXFExchange(String pathToFileForExchangeBody)
    {
        //Create a new exchange
        Exchange senderExchange = new DefaultExchange(context);
                
        //Set the operation name and operation namespace for the CXF exchange
            senderExchange.getIn().setHeader(CxfConstants.OPERATION_NAME,
CXF_OPERATION_NAME);
            senderExchange.getIn().setHeader(CxfConstants.OPERATION_NAMESPACE,
CXF_OPERATION_NAMESPACE);
            
            //Read the icotns request file from the file system, this one has no
endpoint to route to
            File inputFile = new File(pathToFileForExchangeBody);
            
            assertTrue(inputFile.exists());
            log.debug("Does input file exist: " + inputFile.exists());
            
            //Set it as the message message body
            senderExchange.getIn().setBody(inputFile);
            
            return senderExchange;

    }



--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-invoke-CXF-webservice-from-processor-bean-tp5716272p5716569.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to