You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by chimaira <de...@hotmail.com> on 2012/02/03 16:02:18 UTC

How to Stor/Get data in CXF Session .

Hello
Sorry for my english, I'll try to be as clear as I can

with CXF integrated in my  application , I m extending the
AbstractPhaseInterceptor class so I can save my Request/Response into an
output file.

but, while my response xml contains no request information (like a customer 
ID's for ex)  I can't find the corresponding incoming request. I want to
know from wich request does the response come.


In the CXF logginInterceptor ,I notea this line :

String id = (String) message.getExchange().get(LoggingMessage.ID_KEY);

Then I expend message.getExchange() methods 
I find this one:  getSession(). Is this what I need Or I m totally wrong ?
and how can use it ?


btw :  how can I stor/get data into a session like a unique transation ID ? 


Thank for your help 






--
View this message in context: http://cxf.547215.n5.nabble.com/How-to-Stor-Get-data-in-CXF-Session-tp5454096p5454096.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: How to Stor/Get data in CXF Session .

Posted by chimaira <de...@hotmail.com>.
Hi Glen And thak you 

I finally found it 

What I was doing : 
Object obj= arg0.getExchange().get("keyCode"); // DOES NOT WORK


The correct code is : 
Object obj= arg0.getExchange().getInMessage().get("keyCode"); // WORK

M-A

--
View this message in context: http://cxf.547215.n5.nabble.com/How-to-Stor-Get-data-in-CXF-Session-tp5454096p5461538.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: How to Stor/Get data in CXF Session .

Posted by Glen Mazza <gm...@talend.com>.
DoubleItService and DoubleItPortType are classes auto-generated when you 
run the CXF WSDLtoJava utility 
(https://cwiki.apache.org/CXF20DOC/wsdl-to-java.html) on the original 
tutorial's WSDL 
(http://www.jroller.com/gmazza/entry/web_service_tutorial#WFstep4).  
They point to the wsdl:service and wsdl:portType elements of the 
underlying WSDL, and derive their names from the name attribute values 
on those two elements.  When you run your own WSDL through CXF's 
WSDLtoJava utility, you'll see corresponding classes generated (with 
different names).  My basic WSDL-first tutorial 
(http://www.jroller.com/gmazza/entry/web_service_tutorial) explains more.

If you're doing Java-first development, I'm not sure of the equivalent 
way to read/write parameters.  Hopefully someone else can help.

Regards,
Glen

On 02/06/2012 03:52 AM, chimaira wrote:
> Hi,
> Thanks for replay, I saw the example .
> The guy puts the value of MAX_VALUE this way :
>
>      DoubleItService service = new DoubleItService();
>      DoubleItPortType port = service.getDoubleItPort();
>      ((BindingProvider) port).getRequestContext().put("MAX_VALUE", "200");
>
> There is no information on what DoubleItService() and DoubleItPortType()
> are. don 't know how to performe that.
>
> any idea ?
>
> Thanks
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/How-to-Stor-Get-data-in-CXF-Session-tp5454096p5459593.html
> Sent from the cxf-user mailing list archive at Nabble.com.


-- 
Glen Mazza
Talend Community Coders - coders.talend.com
blog: www.jroller.com/gmazza


Re: How to Stor/Get data in CXF Session .

Posted by chimaira <de...@hotmail.com>.
Hi, 
Thanks for replay, I saw the example . 
The guy puts the value of MAX_VALUE this way :

    DoubleItService service = new DoubleItService();
    DoubleItPortType port = service.getDoubleItPort();
    ((BindingProvider) port).getRequestContext().put("MAX_VALUE", "200");

There is no information on what DoubleItService() and DoubleItPortType()
are. don 't know how to performe that. 

any idea ? 

Thanks

--
View this message in context: http://cxf.547215.n5.nabble.com/How-to-Stor-Get-data-in-CXF-Session-tp5454096p5459593.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: How to Stor/Get data in CXF Session .

Posted by Glen Mazza <gm...@talend.com>.
If you search this blog entry for "MAX_VALUE": 
http://www.jroller.com/gmazza/entry/jaxwshandlers_to_cxfinterceptors, 
you can see how parameters can be read and written during the SOAP 
request & response exchange.

HTH,
Glen

On 02/03/2012 10:02 AM, chimaira wrote:
> Hello
> Sorry for my english, I'll try to be as clear as I can
>
> with CXF integrated in my  application , I m extending the
> AbstractPhaseInterceptor class so I can save my Request/Response into an
> output file.
>
> but, while my response xml contains no request information (like a customer
> ID's for ex)  I can't find the corresponding incoming request. I want to
> know from wich request does the response come.
>
>
> In the CXF logginInterceptor ,I notea this line :
>
> String id = (String) message.getExchange().get(LoggingMessage.ID_KEY);
>
> Then I expend message.getExchange() methods
> I find this one:  getSession(). Is this what I need Or I m totally wrong ?
> and how can use it ?
>
>
> btw :  how can I stor/get data into a session like a unique transation ID ?
>
>
> Thank for your help
>
>
>
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/How-to-Stor-Get-data-in-CXF-Session-tp5454096p5454096.html
> Sent from the cxf-user mailing list archive at Nabble.com.


-- 
Glen Mazza
Talend Community Coders - coders.talend.com
blog: www.jroller.com/gmazza


Re: How to Stor/Get data in CXF Session .

Posted by chimaira <de...@hotmail.com>.
Hi, 
This is what I did , And does nt work : 

In my service I did this : 

@Resource
private WebServiceContext wsctx;
...
final MessageContext messageContext = wsctx.getMessageContext();
messageContext.put("MYKEY", "keyValue");


And in my interceptor (response). I try to retrieve the value like :
String value =  (String)
PhaseInterceptorChain.getCurrentMessage().getExchange().get("MYKEY");


But it does nt work. the returned value is null.


Some help please ? 
Thank you 

--
View this message in context: http://cxf.547215.n5.nabble.com/How-to-Stor-Get-data-in-CXF-Session-tp5454096p5459891.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: How to Stor/Get data in CXF Session .

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 03/02/12 15:02, chimaira wrote:
> Hello
> Sorry for my english, I'll try to be as clear as I can
>
> with CXF integrated in my  application , I m extending the
> AbstractPhaseInterceptor class so I can save my Request/Response into an
> output file.
>
> but, while my response xml contains no request information (like a customer
> ID's for ex)  I can't find the corresponding incoming request. I want to
> know from wich request does the response come.
>
>
> In the CXF logginInterceptor ,I notea this line :
>
> String id = (String) message.getExchange().get(LoggingMessage.ID_KEY);
>

Indeed, you can follow a similar approach, Exchange can always be used 
to keep the data common to the request and response chains

Cheers, Sergey


> Then I expend message.getExchange() methods
> I find this one:  getSession(). Is this what I need Or I m totally wrong ?
> and how can use it ?
>
>
> btw :  how can I stor/get data into a session like a unique transation ID ?
>
>
> Thank for your help
>
>
>
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/How-to-Stor-Get-data-in-CXF-Session-tp5454096p5454096.html
> Sent from the cxf-user mailing list archive at Nabble.com.