Thanks Eoghan, that worked perfectly. We have an out interceptor already
configured for handling some other addressing stuff so this was a piece of
cake. The only change I made:
outMaps.setFrom(inMaps.getToEndpointReference());
since the setFrom has only one signature that accepts an
EndpointReferenceType and not an URIType.
Thanks for your help!
Rebecca
Eoghan Glynn-4 wrote:
>
> Hi Rebacca,
>
> Try adding an interceptor like the example below to the out-chain on the
> server side. Note this code is off the top of my head, so may need need
> some
> minor tweaks.
>
> Cheers,
> Eoghan
>
>
> import org.apache.cxf.message.Message;
> import org.apache.cxf.ws.addressing.AddressingProperties;
> import org.apache.cxf.ws.addressing.ContextUtils;
> import org.apache.cxf.ws.addressing.MAPAggregator;
>
> public class WSAFromSetter extends AbstractPhaseInterceptor<Message> {
>
> public WSAFromSetter() {
> super(Phase.PRE_LOGICAL);
> addAfter(MAPAggregator.class.getName());
> }
>
> public void handleMessage(Message message) {
> addFrom(message);
> }
>
> public void handleFault(Message message) {
> addFrom(message);
> }
>
> private addFrom(Message message) {
> if (ContextUtils.isOutbound(message)
> && !ContextUtils.isRequestor(message)) {
> AddressingProperties outMaps =
> ContextUtils.retrieveMAPs(message, false, true);
> AddressingProperties inMAPs =
> ContextUtils.retrieveMAPs(message, false, false);
> if (outMaps != null && outMaps.getFrom() == null && inMaps !=
> null) {
> outMaps.setFrom(inMaps.getFrom());
> }
> }
> }
> }
>
>
> 2010/1/7 rduhard <[email protected]>
>
>>
>> Thanks for the reply. After reading the WS-Addressing spec more closely I
>> realized that it is indeed not a required property on the response.
>>
>> The change you refer to would definitely be what was required for our
>> interoperability. In the meantime, how would I go about explicitly
>> setting
>> it within the application?
>>
>> Thanks again,
>> Rebecca
>>
>>
>> Eoghan Glynn-4 wrote:
>> >
>> > Folks,
>> >
>> > The /wsa:From header is optional, and CXF does not generate a default
>> > value
>> > for this if not explicitly set by the application. (Though if this
>> header
>> > is
>> > actually set in the message addressing properties, then it will of
>> course
>> > be
>> > included in the out-going payload).
>> >
>> > We could quiet easily change this policy though, for example to set the
>> > /wsa:From in the outgoing response payload to default to the /wsa:To
>> > received in the corresponding incoming request. Let me know if this
>> change
>> > would address your interop requirement.
>> >
>> > Cheers,
>> > Eoghan
>> >
>> > 2010/1/6 Craig Tataryn <[email protected]>
>> >
>> >> Was wondering if anyone knew the answer to this? We need this for
>> >> interoperability testing with our vendor.
>> >>
>> >> Craig.
>> >>
>> >>
>> >> On 30-Dec-09, at 11:37 AM, rduhard wrote:
>> >>
>> >>
>> >>> Is there a way to have CXF generate the <wsa:From> MAP on the
>> outgoing
>> >>> response message? It seems to only generate To, Action, MessageID and
>> >>> RelatesTo elements. The client requires the the From element also be
>> >>> populated, but I haven't been able to find a way to have it included.
>> >>> <wsa:To> element is NOT anonymous on the request message if that
>> makes
>> >>> any
>> >>> difference.
>> >>>
>> >>> Any help is much appreciated.
>> >>>
>> >>> thanks,
>> >>> Rebecca
>> >>>
>> >>>
>> >>> --
>> >>> View this message in context:
>> >>>
>> http://old.nabble.com/wsa%3AFrom-MAP-on-response-message-not-present-tp26970149p26970149.html
>> >>> Sent from the cxf-user mailing list archive at Nabble.com.
>> >>>
>> >>>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://old.nabble.com/wsa%3AFrom-MAP-on-response-message-not-present-tp26970149p27063606.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>>
>
>
--
View this message in context:
http://old.nabble.com/wsa%3AFrom-MAP-on-response-message-not-present-tp26970149p27079684.html
Sent from the cxf-user mailing list archive at Nabble.com.