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: CXF can't set the holder object into the message content list of the out message
Date Wed, 24 Aug 2011 00:22:55 GMT
Hi,

Which version of CXF are you using?
If you are using CXF 2.4.1, you need to upgrade it to CXF 2.4.2.
There is a issue about the holder object checking in the CXF 2.4.1.


On 8/24/11 5:23 AM, Mick Knutson wrote:
> Thanks for the test case, but I am having issues following it as it pertains
> to the original example.
>
> Here is the processor from the original:
>
>      private class MappingProcessor implements Processor {
>
>          private Class<?>  beanClass;
>          private Object instance;
>
>          public MappingProcessor(Object obj) {
>              beanClass = obj.getClass();
>              instance = obj;
>          }
>
>          public void process(Exchange exchange) throws Exception {
>              String operationName =
> exchange.getIn().getHeader(CxfConstants.OPERATION_NAME, String.class);
>              Method method = findMethod(operationName,
> exchange.getIn().getBody(Object[].class));
>              try {
>                  Object response = method.invoke(instance,
> exchange.getIn().getBody(Object[].class));
>                  if (response instanceof CallEvent) {
>                      logger.info("we have a CallEvent");
>                  }
>                  exchange.getOut().setBody(response);
>              } catch (InvocationTargetException e) {
>                  throw (Exception) e.getCause();
>              }
>          }
>
>          private Method findMethod(String operationName, Object[] parameters)
> throws SecurityException, NoSuchMethodException {
>              return beanClass.getMethod(operationName,
> getParameterTypes(parameters));
>          }
>
>          private Class<?>[] getParameterTypes(Object[] parameters) {
>              if (parameters == null) {
>                  return new Class[0];
>              }
>              Class<?>[] answer = new Class[parameters.length];
>              int i = 0;
>              for (Object object : parameters) {
>                  answer[i] = object.getClass();
>                  i++;
>              }
>              return answer;
>          }
>      }
>
>
> And I still get the error
> HolderOutInterceptor           ERROR The message content list of the in
> message and out message are same, CXF can't set the holder object into the
> message content list of the out message.
>
>
> So far I was able to get a custom Object sent into my seda:tap like:
>
>
>          from(Routes.INPUT_TAP).routeId("INPUT_TAP")
>                  .doTry()
>                  .log("------------------>INPUT_TAP")
>                  .marshal().json()
>                  .to(Routes.INPUT_MARSHALED)
>                  .doCatch(Exception.class)
>                  .bean(ExceptionProcessor.class,
> ExceptionProcessor.HANDLE_MARSHAL_ERROR)
>                  .end()
>          ;
>
>
> and this is the json I get:
>
> *{"org.apache.cxf.message.MessageContentsList*
> ":{"@serialization":"custom","unserializable-parents":"","list":{"default":{"size":1},"int":6,"com.comcast.ivr.integration.domain.CallEvent":{"browserType":"AVAYA","dasSessionId":"JAXWS-2-d46502d4-23c2-4cbf-b517-808a2674e1a8","applicationType":"AGENT","ani":1234567890,"dnis":"0987654321","languageSelected":"ENGLISH","callEndReason":"CALLER_HUNGUP","functionalArea":"PRE_MAIN_MENU","startTime":0,"endTime":0}}}}
>
> I thought I would get something like (or similar to):
>
>
> *{"com.comcast.ivr.integration.domain.CallEvent"*
> :{"browserType":"AVAYA","dasSessionId":"JAXWS-2-d46502d4-23c2-4cbf-b517-808a2674e1a8","applicationType":"AGENT","ani":1234567890,"dnis":"0987654321","languageSelected":"ENGLISH","callEndReason":"CALLER_HUNGUP","functionalArea":"PRE_MAIN_MENU","startTime":0,"endTime":0}}
>
>
> ---
> Thank You…
>
> Mick Knutson, President
>
> BASE Logic, Inc.
> Enterprise Architecture, Design, Mentoring&  Agile Consulting
> p. (855) BASE-LOGIC: (227-3564-42)
> p. (478) BASE-LOGIC (227-3564-42)
> f. (855) BASE-LOGIC: (227-3564-42)
>
> Website: http://www.baselogic.com
> Blog: http://www.baselogic.com/blog/
> Linked IN: http://linkedin.com/in/mickknutson
> Twitter: http://twitter.com/mickknutson
> ---
>
>
>
> On Tue, Aug 23, 2011 at 10:10 AM, Willem Jiang<willem.jiang@gmail.com>wrote:
>
>> Hi Mick,
>>
>> I just committed a simple unit test[1] into camel-cxf, you make take a look
>> and add the missing part that you need.
>>
>> [1]http://svn.apache.org/**viewvc?rev=1160701&view=rev<http://svn.apache.org/viewvc?rev=1160701&view=rev>
>>
>>
>> On 8/23/11 7:43 PM, Mick Knutson wrote:
>>
>>> Hmm. Thanks for helping me start to think about things.
>>> So it looks like I was originally trying to do this:
>>>
>>> 1. take RS or WS Object into process method
>>> 2. wiretap Object into queue
>>> 3. write tapped Object to file
>>> 4. return from process method
>>>
>>> So, what _should_ I do if all I want is to take an CXF RS Object in, then
>>> add it to a queue which is part of a totally different flow?
>>>
>>> ---
>>> Thank You…
>>>
>>> Mick Knutson, President
>>>
>>> BASE Logic, Inc.
>>> Enterprise Architecture, Design, Mentoring&   Agile Consulting
>>> p. (855) BASE-LOGIC: (227-3564-42)
>>> p. (478) BASE-LOGIC (227-3564-42)
>>> f. (855) BASE-LOGIC: (227-3564-42)
>>>
>>> Website: http://www.baselogic.com
>>> Blog: http://www.baselogic.com/blog/
>>> Linked IN: http://linkedin.com/in/**mickknutson<http://linkedin.com/in/mickknutson>
>>> Twitter: http://twitter.com/mickknutson
>>> ---
>>>
>>>
>>>
>>> On Mon, Aug 22, 2011 at 9:11 PM, Willem Jiang<willem.jiang@gmail.com>**
>>> wrote:
>>>
>>>   Hi,
>>>>
>>>> It looks like your route doesn't consume the parameter of the message
>>>> body
>>>> from the camel-cxf consumer, and the CXF HolderOutInterceptor complains
>>>> about it.
>>>>
>>>> You may need to set the response message in the MappingProcessor or add
>>>> another processor after the wrieTap(INPUT_TAP).
>>>>
>>>>
>>>> On 8/23/11 1:35 AM, Mick Knutson wrote:
>>>>
>>>>   I am trying to modify the cxf example in the camel source to write the
>>>>> contents of the incoming CXF request object to a file:
>>>>>
>>>>>      public static final String INPUT_TAP = "seda:tap";
>>>>> public static final String WRITE_TO_FILE = "direct:writeToFile";
>>>>>      public static final String PROCESSED_FILE_DIR =
>>>>> "file:target/reports";
>>>>> public static final String PROCESSED_FILE_NAME =
>>>>> "processed-${in.header."+
>>>>> SESSION_ID +"}.txt";
>>>>>
>>>>>          // populate the message queue with some messages
>>>>>          from(SOAP_ENDPOINT_URI)
>>>>>              .process(new MappingProcessor(new BookStoreImpl(false)))
>>>>>              .wireTap(INPUT_TAP)
>>>>>          ;
>>>>>          from(WRITE_TO_FILE).routeId("****WRITE_TO_FILE")
>>>>>                  .log("-->WRITE_TO_FILE")
>>>>>                  .setHeader(Exchange.FILE_NAME,
>>>>> constant(PROCESSED_FILE_NAME))
>>>>>                  .to(PROCESSED_FILE_DIR)
>>>>>          ;
>>>>>          from(INPUT_TAP).routeId("****INPUT_TAP")
>>>>>                  .log("-->INPUT_TAP")
>>>>>                  .multicast()
>>>>>                  .to(WRITE_TO_FILE)
>>>>>          ;
>>>>>
>>>>>
>>>>> I keep getting this error:
>>>>>
>>>>> [                qtp25163668-15] HolderOutInterceptor           ERROR
>>>>> The
>>>>> message content list of the in message and out message are same, CXF
>>>>> can't
>>>>> set the holder object into the message content list of the out message.
>>>>>
>>>>> and no files are written
>>>>>
>>>>> I have spent the entire day trying to get this simple example to work
>>>>> and
>>>>> feel I have not made any progress. I really would appreciate some
>>>>> assistance
>>>>> with this.
>>>>>
>>>>>
>>>>>
>>>>> ---
>>>>> Thank You…
>>>>>
>>>>> Mick Knutson, President
>>>>>
>>>>> BASE Logic, Inc.
>>>>> Enterprise Architecture, Design, Mentoring&    Agile Consulting
>>>>> p. (855) BASE-LOGIC: (227-3564-42)
>>>>> p. (478) BASE-LOGIC (227-3564-42)
>>>>> f. (855) BASE-LOGIC: (227-3564-42)
>>>>>
>>>>> Website: http://www.baselogic.com
>>>>> Blog: http://www.baselogic.com/blog/
>>>>> Linked IN: http://linkedin.com/in/****mickknutson<http://linkedin.com/in/**mickknutson>
>>>>> <http://linkedin.**com/in/mickknutson<http://linkedin.com/in/mickknutson>
>>>>>>
>>>>>
>>>>> Twitter: http://twitter.com/mickknutson
>>>>> ---
>>>>>
>>>>>
>>>>>
>>>> --
>>>> Willem
>>>> ------------------------------****----
>>>> FuseSource
>>>> Web: http://www.fusesource.com
>>>> Blog:    http://willemjiang.blogspot.****com<http://willemjiang.**
>>>> blogspot.com<http://willemjiang.blogspot.com>>(English)
>>>>
>>>>          http://jnn.javaeye.com (Chinese)
>>>> Twitter: willemjiang
>>>> Weibo: willemjiang
>>>>
>>>>
>>>
>>
>> --
>> Willem
>> ------------------------------**----
>> FuseSource
>> Web: http://www.fusesource.com
>> Blog:    http://willemjiang.blogspot.**com<http://willemjiang.blogspot.com>(English)
>>          http://jnn.javaeye.com (Chinese)
>> Twitter: willemjiang
>> Weibo: willemjiang
>>
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Mime
View raw message