camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: [camel-cxf] Stripping headers
Date Tue, 23 Jun 2009 03:22:15 GMT
Hi
Thanks for your test case.
I already committed a quick fix of the issue.
Can you try to download the latest snapshot[1] and give it a try?

BTW, there are some error on the current CAMEL 2.0 snapshot deploying,
if you are using Camel 2.0 snapshot , you may need to use svn download
the code and build it yourself.

[1]https://repository.apache.org/content/repositories/snapshots/org/apache/camel/apache-camel/1.6.2-SNAPSHOT/

Willem

S. Ali Tokmen wrote:
> Cool 8)
> 
> I've also attached readable headers and the sample code to the bug.
> 
> Thanks
> 
> S. Ali Tokmen
> savas-ali.tokmen@bull.net
> 
> Office: +33 4 76 29 76 19
> GSM:    +33 66 43 00 555
> 
> Bull, Architect of an Open World TM
> http://www.bull.com
> 
> 
> 
> Willem Jiang a écrit :
>> Hi,
>>
>> You hit a bug of camel-cxf's HeaderFilter, I just went through the code,
>> and find we should add the below lines in the initialize() method of
>> CxfHeaderFilterStrategy.
>>
>> // filter headers begin with "Camel" or "org.apache.camel"
>> setOutFilterPattern("(Camel|org\\.apache\\.camel)[\\.|a-z|A-z|0-9]*");
>>
>> To filter the Camel relates header from the http protocol headers.
>>
>> I just fill a JIRA[1] for it.
>>
>> [1] https://issues.apache.org/activemq/browse/CAMEL-1736
>>
>> Willem
>>
>>
>>
>> S. Ali Tokmen wrote:
>>  
>>> Hello
>>>
>>> I'm currently doing advanced experiences with CAMEL-CXF, namely MTOM
>>> support. It's working as a marvel, the only points to be careful on:
>>>
>>>   1. The javax.xml dependency doesn't have MTOM classes and that you'll
>>>      need to use the Geronimo packages
>>>   2. It's the client that decides that it should send stuff in
>>>      MTOM/XOP. You therefore need the MTOM-related annotations in your
>>>      client Java interface (the one you give to CAMEL) if you want
>>>      CAMEL-CXF to generate MTOM
>>>
>>> You can see the whole stuff on
>>> svn://svn.forge.objectweb.org/svnroot/jonas/sandbox/camel-jonas5/trunk/camel-osgi-package
>>>
>>> but here's a code sample:
>>>
>>>    Server side:
>>>
>>>    this.from(
>>>        "cxf://http://localhost:" + CamelCxfMtomTest.port +
>>>    CamelCxfMtomTest.cxfContext + "/"
>>>            + IMTOMFileSender.WSNAME + "?serviceClass=" +
>>>    IMTOMFileSender.class.getName() + "&dataFormat=POJO&"
>>>            + "bus=#" + CamelCxfMtomTest.busName).process(new
>>> Processor() {
>>>        public void process(final Exchange exchange) throws Exception {
>>>            MessageContentsList msgListIn = (MessageContentsList)
>>>    exchange.getIn().getBody();
>>>
>>>            Assert.assertNotNull("Assert that the message has content",
>>>    msgListIn);
>>>            Assert.assertEquals("Assert message content size", 2,
>>>    msgListIn.size());
>>>
>>>            String inFile = (String) msgListIn.get(0);
>>>            Assert.assertEquals(CamelCxfMtomTest.filename, inFile);
>>>            exchange.getOut().setHeader(Exchange.FILE_NAME, inFile);
>>>
>>>            byte[] inFileData = (byte[]) msgListIn.get(1);
>>>            Assert.assertNotNull("Assert that the message's fileContents
>>>    is filled", inFileData);
>>>            exchange.getOut().setBody(inFileData);
>>>        }
>>>    }).to(CamelCxfMtomTest.output.toURL().toString()).process(new
>>>    Processor() {
>>>        public void process(final Exchange exchange) throws Exception {
>>>            // The Web service has a null response type
>>>            exchange.getOut().setBody(null);
>>>        }
>>>    });
>>>
>>>    Client side:
>>>
>>>    this.from(CamelCxfMtomTest.input.toURL().toString()).process(new
>>>    Processor() {
>>>        public void process(final Exchange exchange) throws Exception {
>>>            GenericFile<?> msgList = (GenericFile<?>)
>>>    exchange.getIn().getBody();
>>>
>>>            exchange.getOut().setHeader(CxfConstants.OPERATION_NAME,
>>>    "sendFile");
>>>             
>>> exchange.getOut().setHeader(CxfConstants.OPERATION_NAMESPACE,
>>>    IMTOMFileSender.NAMESPACE);
>>>
>>>            MessageContentsList msgListOut = new MessageContentsList();
>>>            File outFile = new File(msgList.getAbsoluteFilePath());
>>>            msgListOut.set(0, outFile.getName());
>>>            byte[] outFileData =
>>>    CamelCxfMtomTest.readFileAsByteArray(outFile);
>>>            msgListOut.set(1, outFileData);
>>>            exchange.getOut().setBody(msgListOut);
>>>        }
>>>    }).to(
>>>        "cxf://http://localhost:" + CamelCxfMtomTest.port +
>>>    CamelCxfMtomTest.cxfContext + "/"
>>>            + IMTOMFileSender.WSNAME + "?serviceClass=" +
>>>    IMTOMFileSender.class.getName() + "&dataFormat=POJO&"
>>>            + "bus=#" + CamelCxfMtomTest.busName);
>>>
>>>    ... and the class:
>>>
>>>    @BindingType(value = SOAPBinding.SOAP11HTTP_MTOM_BINDING)
>>>    @WebService(name = IMTOMFileSender.WSNAME, targetNamespace =
>>>    IMTOMFileSender.NAMESPACE)
>>>    public interface IMTOMFileSender {
>>>
>>>        public String NAMESPACE = "http://test.camel.jonas.ow2.org";
>>>
>>>        public String WSNAME = "MTOMFileSender";
>>>
>>>        public String sendFile(String fileName, byte[] fileContents);
>>>    }
>>>
>>> Now, I have one small issue: when I send a WS message with that
>>> configuration, CAMEL sends out a lot of headers:
>>>
>>>    POST /services/MTOMFileSender HTTP/1.1
>>>    Content-Type: multipart/related; type="application/xop+xml";
>>>    boundary="uuid:e9c7db1f-395c-459c-8639-9cea3463e8de";
>>>    start="<root.message@cxf.apache.org>"; start-info="text/xml"
>>>    *CamelFileNameOnly: someFile.txt
>>>    CamelFileRelativePath:
>>>  
>>> C:\DOCUME~1\Owner\LOCALS~1\Temp\paxexam_runner_Owner\target\mtom-test\input\someFile.txt
>>>
>>>
>>>    CamelFileLastModified: Sat Jun 20 19:33:41 CEST 2009
>>>    CamelFileAbsolutePath:
>>>  
>>> C:\DOCUME~1\Owner\LOCALS~1\Temp\paxexam_runner_Owner\target\mtom-test\input\someFile.txt
>>>
>>>
>>>    CamelFileName: someFile.txt
>>>    CamelFileLength: 12
>>>    CamelFilePath:
>>>  
>>> C:\DOCUME~1\Owner\LOCALS~1\Temp\paxexam_runner_Owner\target\mtom-test\input\someFile.txt
>>>
>>>
>>>    CamelFileParent:
>>>  
>>> C:\DOCUME~1\Owner\LOCALS~1\Temp\paxexam_runner_Owner\target\mtom-test\input*
>>>
>>>
>>>    SOAPAction: ""
>>>    CamelFileAbsolute: true
>>>    Accept: */*
>>>    User-Agent: Apache CXF 2.2.2
>>>    Cache-Control: no-cache
>>>    Pragma: no-cache
>>>    Host: localhost:25742
>>>    Connection: keep-alive
>>>    Content-Length: 820
>>>
>>>
>>>    --uuid:e9c7db1f-395c-459c-8639-9cea3463e8de
>>>    Content-Type: application/xop+xml; charset=UTF-8; type="text/xml";
>>>    Content-Transfer-Encoding: binary
>>>    Content-ID: <root.message@cxf.apache.org>
>>>
>>>    <soap:Envelope
>>>  
>>> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns1:sendFile
>>>
>>>
>>>  
>>> xmlns:ns1="http://test.camel.jonas.ow2.org"><arg0>someFile.txt</arg0><arg1><xop:Include
>>>
>>>
>>>    xmlns:xop="http://www.w3.org/2004/08/xop/include"
>>>  
>>> href="cid:76e00e28-e0fc-40c9-91e3-03627e8b3cec-1@http%3A%2F%2Fcxf.apache.org%2F"/></arg1></ns1:sendFile></soap:Body></soap:Envelope>
>>>
>>>
>>>    --uuid:e9c7db1f-395c-459c-8639-9cea3463e8de
>>>    Content-Type: application/octet-stream
>>>    Content-Transfer-Encoding: binary
>>>    Content-ID:
>>>    <76e00e28-e0fc-40c9-91e3-03627e8b3cec-1@http://cxf.apache.org/>
>>>
>>>    Test Message
>>>    --uuid:e9c7db1f-395c-459c-8639-9cea3463e8de--
>>>
>>> How could I tell CAMEL-CXF not to send the file-related headers (marked
>>> in red)?
>>>
>>> Thanks
>>>
>>>     
>>
>>
>>
>>
>>   
> 
> 


Mime
View raw message