Hi
On 25/08/11 03:19, XiLai Dai wrote:
Thanks Sergey! But it didn't works after testing.
Also tested with WrappedMessageContext:
WrappedMessageContext wmc = (WrappedMessageContext)context.getMessageContext();
Message msg = wmc.getWrappedMessage();
CustomInfo customInfo = new CustomInfo();
customInfo.putAll(...);
msg.put(CustomInfo.class, customInfo);
still not works. The CustomInfo can't be got from Interceptor.
It may be that no out message is created and thus the custom properties
are saved on the inbound message.
In you custom out interceptor try:
CustomInfo ci = (CustomInfo)outMessage.get(CustomInfo.class);
if (ci == null) {
ci =
(CustomInfo)outMessage.getExchange().getInMessage().get(CustomInfo.class);
}
Cheers, Sergey
Regards.
Xilai
-----Original Message-----
From: Sergey Beryozkin [mailto:[email protected]]
Sent: Wednesday, August 24, 2011 5:49 PM
To: [email protected]
Subject: Re: How to transform from Source(Document) to CXF Message?
Hi Xilai
On Wed, Aug 24, 2011 at 2:44 AM, XiLai Dai<[email protected]> wrote:
Hi, there,
Now, we've implemented a Provide like this:
@javax.xml.ws.ServiceMode(value = javax.xml.ws.Service.Mode.PAYLOAD)
@javax.xml.ws.WebServiceProvider()
public class ProviderBase implements
javax.xml.ws.Provider<javax.xml.transform.Source> {
//@javax.jws.WebMethod(exclude=true)
public final Source invoke(Source request) {
//how to transform request or return Source to Message, so we can add
some custom properties class to it:
CustomInfo customInfo = new CustomInfo();
message.put (CustomInfo.class, customInfo);
}
}
So, in the invoke() method, how to transform request or return Source to
Message? so we can add some custom properties class to it, and then our
Interceptor class can get them.
I think you need to inject WebServiceContext and then set a property
on it, something like
wsContext.getMessageContext().put(CustomInfo.class.getName(),
customInfo);
and then access it on the outbound CXF Message inside the interceptor...
Cheers, Sergey
Thanks!
Xilai