You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Wojciech (JIRA)" <ji...@apache.org> on 2018/01/03 22:28:00 UTC

[jira] [Created] (CXF-7602) HolderInInterceptor op.getOutput().getMessageParts() returns single Part with index = 1 causing Holder set within MessageContentsList (when It should not be)

Wojciech created CXF-7602:
-----------------------------

             Summary: HolderInInterceptor op.getOutput().getMessageParts() returns single Part with index = 1 causing Holder set within MessageContentsList (when It should not be)
                 Key: CXF-7602
                 URL: https://issues.apache.org/jira/browse/CXF-7602
             Project: CXF
          Issue Type: Bug
          Components: JAX-WS Runtime
    Affects Versions: 3.1.11
            Reporter: Wojciech
            Priority: Minor


I have walid wsdl containing following operations: 

<wsdl:message name="sendNotification">
    *<wsdl:part element="notifications:Notification" name="parameters"></wsdl:part>*
</wsdl:message>
<wsdl:message name="sendNotificationResponse">
    *<wsdl:part element="notifications:Notification" name="parameters"></wsdl:part>*
</wsdl:message>

First operation is input, second is output operation. 
From some reason - output MessagePartInfo object from binding operation info from exchange is being set with index = 1 (even if there is only one Part in the out message) - this is causing creation of Holder in HolderInInterceptor. 

As a result of following test : 

MessageContentsList response = (MessageContentsList)producer.requestBody(to,TestApp.createNotification());

I will have response containing Notification object within MessageContentList - but not the fake response injected for test purposes, but rahter Notification which has been send by the producer (TestApp.createNotification()). Producer is from Apache Camel in here and 'to' is a CXF Endpoint working in POJO mode.

I have dealt with it by changing the type of resulting Notification (output message) to the Acknowledgment  by introducing another xsd schema next to Notification. Now when wsdl looks like this (not entire - just a part): 

<wsdl:message name="sendNotification">
    *<wsdl:part element="notifications:Notification" name="parameters"></wsdl:part>*
</wsdl:message>
<wsdl:message name="sendNotificationResponse">
    *<wsdl:part element="ack:Acknowledgement" name="parameters"></wsdl:part>*
</wsdl:message>

No holder is being created and everything works as expected. 
I am not aware of CXF internals, even do not know what purpose serves this Holder object but from my point of view above behaviour looks like a bug or is very non-intuitive. Also I think that if two different operations (in/out) with the same type of Part are not allowed - this should be somehow catched during wsdl2java validation, or even any kind of runtime exception should be thrown on runtime when processing messages. Current behaviour - which is - returning Notification object which has been sent to the endpoint doesn't look  correctly to me :) 

Of course I may be wrong as I'm quite new to CXF :) 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)