You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by mayankeagle <ma...@yahoo.com> on 2013/07/18 13:51:22 UTC

CXF Date marshalling issue

Hi,

I have a web-service using CXF 2.6.3 and Spring 3.0.5 (should it be 3.0.7?)
and I'm returning a Date object as part of my VO. 

Without O-Auth (1.0), I get the Date object as some value +5:30 (for
time-zone). 

However, without O-Auth, the Date object comes as the value followed by a
blank and then 5:30 (the + sign does not come).

This is a strange issue and I'm wondering why the + sign is being missed
out. All JAR versions on the client and the server are the same in both the
cases - OAuth as well as without OAuth.



--
View this message in context: http://cxf.547215.n5.nabble.com/CXF-Date-marshalling-issue-tp5731091.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: CXF Date marshalling issue

Posted by Sergey Beryozkin <sb...@gmail.com>.
On 19/07/13 21:52, mayankeagle wrote:
> Its 2.6.2 right now. I think I figured the problem. We had written a custom
> OOB response provider (with your help) in
> http://cxf.547215.n5.nabble.com/OAuth-1-0-in-CXF-2-6-2-td5713150i20.html and
> the response returned from there was being URL encoded. I'll remove that
> part from the code and check again, and let you know!
>
>
I've checked with my demo, works as expected, see a log fragment:

Response from the decision handler:

ID: 12
Response-Code: 303
Content-Type:
Headers: 
{Location=[http://localhost:8080/services/reservations/reserve/complete?oauth_token=79ff44f9-fe2b-4e1d-8a09-820eff861df8&oauth_verifier=02d6fff7-7031-49be-8f60-a89db36ff5d0], 
Date=[Fri, 19 Jul 2013 20:57:39 GMT], Content-Length=[0]}


This is the browser following a redirect:

--------------------------------------
19-Jul-2013 21:57:40 org.apache.cxf.interceptor.LoggingInInterceptor
INFO: Inbound Message
----------------------------
ID: 13
Address: 
http://localhost:8080/services/reservations/reserve/complete?oauth_token=79ff44f9-fe2b-4e1d-8a09-820eff861df8&oauth_verifier=02d6fff7-7031-49be-8f60-a89db36ff5d0
Http-Method: GET

So indeed - must be something to do with your OOB provider implementation

Cheers, Sergey

>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/CXF-Date-marshalling-issue-tp5731091p5731171.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Re: CXF Date marshalling issue

Posted by mayankeagle <ma...@yahoo.com>.
Its 2.6.2 right now. I think I figured the problem. We had written a custom
OOB response provider (with your help) in
http://cxf.547215.n5.nabble.com/OAuth-1-0-in-CXF-2-6-2-td5713150i20.html and
the response returned from there was being URL encoded. I'll remove that
part from the code and check again, and let you know!



--
View this message in context: http://cxf.547215.n5.nabble.com/CXF-Date-marshalling-issue-tp5731091p5731171.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: CXF Date marshalling issue

Posted by Sergey Beryozkin <sb...@gmail.com>.
On 19/07/13 19:10, mayankeagle wrote:
> Hi Dan,
>
> Thanks. I was earlier URL decoding the response, hence the + was creating an
> issue.
>
> But I also noticed that the CXF OAuth API is returning me the verifier with
> encoding but the remaining parameters without encoding.
>
> e.g., the call to /initiate returns oauth_token=....&oauth_token_secret=....
>
> However, when it responds to /authorize/decision and sends the verifier, it
> comes as oauth_verifier%3D.... (the = has been encoded as %3D)
>
> Hence, I am unable to parse the response in a consistent manner, as CXF is
> sending some responses as URL encoded and some as not!
>
I'll have a look on Monday - which CXF version do you use ?
Sergey

>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/CXF-Date-marshalling-issue-tp5731091p5731168.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>


Re: CXF Date marshalling issue

Posted by mayankeagle <ma...@yahoo.com>.
Hi Dan,

Thanks. I was earlier URL decoding the response, hence the + was creating an
issue. 

But I also noticed that the CXF OAuth API is returning me the verifier with
encoding but the remaining parameters without encoding. 

e.g., the call to /initiate returns oauth_token=....&oauth_token_secret=....

However, when it responds to /authorize/decision and sends the verifier, it
comes as oauth_verifier%3D.... (the = has been encoded as %3D)

Hence, I am unable to parse the response in a consistent manner, as CXF is
sending some responses as URL encoded and some as not!



--
View this message in context: http://cxf.547215.n5.nabble.com/CXF-Date-marshalling-issue-tp5731091p5731168.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: CXF Date marshalling issue

Posted by Daniel Kulp <dk...@apache.org>.
Definitely check the dependency tree and libs and such on the classpath with these things enabled.   In particular, look for any XML related libraries like Xerces.   I believe these are processed via the javax.xml.datatype.DatatypeFactory and related classes.   Thus, if there is a different version of the DatatypeFactory being picked up, you may end up with different behavior.


Dan



On Jul 18, 2013, at 1:10 PM, Sergey Beryozkin <sb...@gmail.com> wrote:

> Hi
> On 18/07/13 16:50, mayankeagle wrote:
>> Hi Sergey,
>> 
>> I understand that it is not an OAuth issue, but in both cases the version of
>> Java (and hence JAXB) is the same.
>> 
>> Does CXF internally use JAXB or Spring OXM for doing the marshalling of the
>> object into XML?
>> 
>> The Date field is part of a JAXB bean and its defined as a java.util.Date
>> object. The service I'm invoking is a JAX-RS service, and surprisingly if I
>> disable the OAuth filter, then it gives me the return value with a + sign
>> for the time-zone, otherwise it doesn't. The version of Java, CXF, Spring
>> and all dependent JARs are therefore the same.
>> 
> Sorry, no idea :-). Please check if adding this filter affects the dependency tree, specifically JAXB libs
> 
> Cheers, Sergey
>> 
>> 
>> --
>> View this message in context: http://cxf.547215.n5.nabble.com/CXF-Date-marshalling-issue-tp5731091p5731113.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>> 
> 

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com


Re: CXF Date marshalling issue

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 18/07/13 16:50, mayankeagle wrote:
> Hi Sergey,
>
> I understand that it is not an OAuth issue, but in both cases the version of
> Java (and hence JAXB) is the same.
>
> Does CXF internally use JAXB or Spring OXM for doing the marshalling of the
> object into XML?
>
> The Date field is part of a JAXB bean and its defined as a java.util.Date
> object. The service I'm invoking is a JAX-RS service, and surprisingly if I
> disable the OAuth filter, then it gives me the return value with a + sign
> for the time-zone, otherwise it doesn't. The version of Java, CXF, Spring
> and all dependent JARs are therefore the same.
>
Sorry, no idea :-). Please check if adding this filter affects the 
dependency tree, specifically JAXB libs

Cheers, Sergey
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/CXF-Date-marshalling-issue-tp5731091p5731113.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>


Re: CXF Date marshalling issue

Posted by mayankeagle <ma...@yahoo.com>.
Hi Sergey,

I understand that it is not an OAuth issue, but in both cases the version of
Java (and hence JAXB) is the same. 

Does CXF internally use JAXB or Spring OXM for doing the marshalling of the
object into XML? 

The Date field is part of a JAXB bean and its defined as a java.util.Date
object. The service I'm invoking is a JAX-RS service, and surprisingly if I
disable the OAuth filter, then it gives me the return value with a + sign
for the time-zone, otherwise it doesn't. The version of Java, CXF, Spring
and all dependent JARs are therefore the same.



--
View this message in context: http://cxf.547215.n5.nabble.com/CXF-Date-marshalling-issue-tp5731091p5731113.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: CXF Date marshalling issue

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 18/07/13 12:51, mayankeagle wrote:
> Hi,
>
> I have a web-service using CXF 2.6.3 and Spring 3.0.5 (should it be 3.0.7?)
> and I'm returning a Date object as part of my VO.
>
> Without O-Auth (1.0), I get the Date object as some value +5:30 (for
> time-zone).
>
> However, without O-Auth, the Date object comes as the value followed by a
> blank and then 5:30 (the + sign does not come).
>
> This is a strange issue and I'm wondering why the + sign is being missed
> out. All JAR versions on the client and the server are the same in both the
> cases - OAuth as well as without OAuth.
>
It's not OAuth related issue, how do you work with this Date, is it a 
header, part of some JAXB bean ? May be it is to do with the specific 
JAXB version...

Cheers, Sergey
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/CXF-Date-marshalling-issue-tp5731091.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>