You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Parin <pk...@yahoo-inc.com> on 2009/06/14 21:49:44 UTC

Aegis + JSON ---> is it supported?

I just want to confirm that if Aegis is used as the data binding then JSON is
not supported in CXF 2.1.x and CXF 2.2.x. I couldn't find any documentation
stating that or otherwise and I wasn't successful in my test code as well.

Thanks,
- parin
-- 
View this message in context: http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p24025149.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Aegis + JSON ---> is it supported?

Posted by Daniel Kulp <dk...@apache.org>.
On Sun June 14 2009 3:49:44 pm Parin wrote:
> I just want to confirm that if Aegis is used as the data binding then JSON
> is not supported in CXF 2.1.x and CXF 2.2.x. I couldn't find any
> documentation stating that or otherwise and I wasn't successful in my test
> code as well.

On the JAX-WS/SOAP side of things, it definitely should be supportable.   
Basically, it is just a matter of registering the Jettison XMLOutputFactory 
and it would create a jettison XMLOutputStream that Aegis would write to.  

For the JAX-RS side, no idea.   That's for Sergey.   :-)

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: Aegis + JSON ---> is it supported?

Posted by Sergey Beryozkin <sb...@progress.com>.
Hi

Sorry and thanks for catching it, I thought I set a namespaceMap on the provider, but I didn't. I updated the prefix and set it :

Map<String, String> namespaceMap = new HashMap<String, String>();

namespaceMap.put("http://fortest.jaxrs.cxf.apache.org", "ns1");

namespaceMap.put("http://www.w3.org/2001/XMLSchema-instance", "xsins");

p.setNamespaceMap(namespaceMap);

(though AegisJSONProvider should do it iself if the map has not been set, it was just the prefix for 
http://www.w3.org/2001/XMLSchema-instance " did not match)

so I'm now hitting

Caused by: java.lang.NullPointerException
 at org.apache.cxf.aegis.xml.stax.ElementReader.extractXsiType(ElementReader.java:114)

Lets see how far we can go from there

thanks, Sergey

----- Original Message ----- 
From: "Benson Margulies" <bi...@gmail.com>
To: <us...@cxf.apache.org>
Sent: Friday, July 24, 2009 1:48 PM
Subject: Re: Aegis + JSON ---> is it supported?


I added some tracing;

Attribute  xsins.type ns1:AegisTestBean

That means a null namepace and a name of "xsins.type". Whatever is
mapping JSON to XML isn't mapping attribute correctly, it should
presumably turn xsins.type into the proper attribute.

Whose department is this?


On Thu, Jul 23, 2009 at 3:56 PM, Sergey
Beryozkin<se...@iona.com> wrote:
>
> Hi Benson
>
> Sure, lets chat later on when you get a chance...
> and good luck with arranging the good insurance :-)
> cheers, Sergey
>
>
> bimargulies wrote:
>>
>> Sergey,
>>
>> My life is somewhat complicated at the moment due to figuring how to
>> get my daughter to have car insurance. I'll see what I can do.
>>
>> --benson
>>
>>
>> On Thu, Jul 23, 2009 at 12:21 PM, Sergey
>> Beryozkin<se...@iona.com> wrote:
>>>
>>> Hi,
>>>
>>> I've added AegisJsonProvider [1] and I'm actually quite thrilled about
>>> the
>>> possibilities it can offer, as far as the serialization of various
>>> complex
>>> types is concerned.
>>> It appears Aegis can work quite nicely with Jettison during the
>>> serialization, but I could not make the read test working. It seems Aegis
>>> requires the xsi:type information too early - jettison can certainly
>>> report
>>> it as I've also added a default JSONProvider (JAXB-based) test which
>>> reads
>>> the JSON sequence representing the list of derived types and it works
>>> well.
>>>
>>> Benson, let me know please if you can look at this issue. You may want to
>>> have a look at a disabled AegisJSONProvider.testReadFrom test (a similar
>>> and
>>> indeed more complex sequence with xsi:type works fine in
>>> JSONProviderTest.testReadListOfDerivedTypes). If yes then I can create
>>> JIRA
>>> and assign to you.
>>>
>>> Daniel - thanks for your request and please experiment with this provider
>>> -
>>> for now you can copy the source into your custom provider - we hope to do
>>> the release next week so it would be good if we could capture some errors
>>> there
>>>
>>> Cheers, Sergey
>>>
>>> [1]
>>> http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AegisJSONProvider.java
>>>
>>>
>>> Sergey Beryozkin wrote:
>>>>
>>>> Actually, I made it working - Aegis does not send 'writeEndDocument'...
>>>>
>>>> Will try to merge something working shortly
>>>> Sergey
>>>>
>>>>
>>>> Sergey Beryozkin wrote:
>>>>>
>>>>> Hi
>>>>>
>>>>> I tried to create AegisJSONProvider which for now just extends
>>>>> AegisJAXBProvider and overwrites its (newly added in my snapshot)
>>>>> createStreamWriter method and gives a Jettison writer back.
>>>>> It actually appears to work, Jettison writer is being called but
>>>>> nothing
>>>>> is available in the output stream in the end...Something confuses
>>>>> Jettison, not sure what. I'll need to look more into it...
>>>>>
>>>>> cheers, Sergey
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> moradaniel wrote:
>>>>>>
>>>>>> Hello Guys,
>>>>>>
>>>>>> I am trying to serve json content from a CXF rest service using Aegis
>>>>>> since my domain model is heavily based on interfaces and
>>>>>> map/collections. I have followed this thread but have no clue on how
>>>>>> to
>>>>>> configure the service to serve Json using Aegis. I have also looked up
>>>>>> in the samples bundled with the distribution but no example neither.
>>>>>> Do you have any working example?
>>>>>>
>>>>>> My current config is:
>>>>>>
>>>>>> <jaxrs:server id="myService" address="/">
>>>>>> <jaxrs:serviceBeans>
>>>>>> <ref bean="serviceImpl" />
>>>>>> <ref bean="personServiceImpl" />
>>>>>> </jaxrs:serviceBeans>
>>>>>> <!-- uncomment to use Aegis-->
>>>>>> <jaxrs:providers>
>>>>>> <bean
>>>>>> class="org.apache.cxf.jaxrs.provider.AegisElementProvider"
>>>>>> />
>>>>>> <bean class="org.apache.cxf.jaxrs.provider.JSONProvider">
>>>>>> </jaxrs:providers>
>>>>>> <jaxrs:extensionMappings>
>>>>>> <entry key="xml" value="application/xml" />
>>>>>> <entry key="json" value="application/json"/>
>>>>>> </jaxrs:extensionMappings>
>>>>>> </jaxrs:server>
>>>>>>
>>>>>>
>>>>>> This obviously does not work since JSONProvider uses Jaxb and not
>>>>>> Aegis.
>>>>>>
>>>>>> Thank u very much
>>>>>> Daniel
>>>>>>
>>>>>>
>>>>>> Sergey Beryozkin-2 wrote:
>>>>>>>
>>>>>>> I did a quick update to the system test which uses Aegis and had no
>>>>>>> problems getting JSON back. So let me know the Accept value please...
>>>>>>>
>>>>>>> Cheers, Sergey
>>>>>>>
>>>>>>> -----Original Message-----
>>>>>>> From: Sergey Beryozkin [mailto:sberyozk@progress.com]
>>>>>>> Sent: 15 June 2009 20:52
>>>>>>> To: users@cxf.apache.org
>>>>>>> Subject: RE: Aegis + JSON ---> is it supported?
>>>>>>>
>>>>>>> Hi Parin,
>>>>>>>
>>>>>>> I'm not sure what is happening at the moment.
>>>>>>> Can you also please post a captured HTTP Accept value ? I'll then try
>>>>>>> to
>>>>>>> do a test.
>>>>>>>
>>>>>>> Thanks, Sergey
>>>>>>>
>>>>>>> -----Original Message-----
>>>>>>> From: Parin [mailto:pkenia@yahoo-inc.com]
>>>>>>> Sent: 15 June 2009 18:19
>>>>>>> To: users@cxf.apache.org
>>>>>>> Subject: Re: Aegis + JSON ---> is it supported?
>>>>>>>
>>>>>>>
>>>>>>> Hi Sergey,
>>>>>>>
>>>>>>> Actually I am trying to serve JSON format and run into No message
>>>>>>> body
>>>>>>> writer found error.
>>>>>>>
>>>>>>> Thanks,
>>>>>>> - parin
>>>>>>>
>>>>>>> Sergey Beryozkin-2 wrote:
>>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I'm assuming it's an xml format which is not served, so try :
>>>>>>>>
>>>>>>>>> @Produces({"application/xml", "application/json"})
>>>>>>>>
>>>>>>>> this should help....
>>>>>>>>
>>>>>>>> cheers, Sergey
>>>>>>>>
>>>>>>>>>
>>>>>>>>> I get the following error when I try to make Aegis and JSON work in
>>>>>>>>> JAX-RS:
>>>>>>>>>
>>>>>>>>> Jun 14, 2009 3:07:56 PM
>>>>>>>>> org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor
>>>>>>>>> writeResponseErrorMessage
>>>>>>>>> WARNING: .No message body writer found for response class :
>>>>>>>>> Response.
>>>>>>>>>
>>>>>>>>> Note: Response is my custom class as shown below.
>>>>>>>>>
>>>>>>>>> @GET
>>>>>>>>> @Path("/getquery")
>>>>>>>>> @Produces({"application/json"})
>>>>>>>>> public Response greetQuery(@QueryParam("name") String
>>>>>>>>> name,@QueryParam("language") String language) { ..... }
>>>>>>>>>
>>>>>>>>> @XmlRootElement(name = "resp")
>>>>>>>>> public class Response {
>>>>>>>>> public Response(){}
>>>>>>>>> public String getGreeting() {
>>>>>>>>> return greeting;
>>>>>>>>> }
>>>>>>>>> public void setGreeting(String greeting) {
>>>>>>>>> this.greeting = greeting;
>>>>>>>>> }
>>>>>>>>> public Error[] getErrors() {
>>>>>>>>> return errors;
>>>>>>>>> }
>>>>>>>>> public void setErrors(Error[] errors) {
>>>>>>>>> this.errors = errors;
>>>>>>>>> }
>>>>>>>>> String greeting;
>>>>>>>>> Error[] errors;
>>>>>>>>>
>>>>>>>>> }
>>>>>>>>> I
>>>>>>>>> have the following config in my beans.xml
>>>>>>>>>
>>>>>>>>> <bean id="aegisProvider"
>>>>>>>>> class="org.apache.cxf.jaxrs.provider.AegisElementProvider" />
>>>>>>>>> <jaxrs:server id="demoCXFServiceRS" address="/">
>>>>>>>>> <jaxrs:serviceBeans>
>>>>>>>>> <ref bean="demoCXF" />
>>>>>>>>> </jaxrs:serviceBeans>
>>>>>>>>> <jaxrs:providers>
>>>>>>>>> <ref bean="aegisProvider"/>
>>>>>>>>> </jaxrs:providers>
>>>>>>>>> </jaxrs:server>
>>>>>>>>>
>>>>>>>>> What am I missing??
>>>>>>>>>
>>>>>>>>> Thanks,
>>>>>>>>> - parin
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Sergey Beryozkin-2 wrote:
>>>>>>>>>>
>>>>>>>>>> Hi
>>>>>>>>>>
>>>>>>>>>> If you do JAX-RS then you can use Aegis and JSON providers in
>>>>>>> tandem,
>>>>>>>>>> Aegis will handle application/xml requests, JSON one will deal
>>>>>>>>>> with
>>>>>>>>>> application/json.
>>>>>>>>>>
>>>>>>>>>> If you use Aegis as part of SOAP processing, then you can still
>>>>>>> annotate
>>>>>>>>>> the same bean with JAX-RS annotations and register a jax-rs
>>>>>>>>>> endpoint
>>>>>>> on
>>>>>>>>>> the same port and have JSON supported.
>>>>>>>>>>
>>>>>>>>>> Cheers, Sergey
>>>>>>>>>>
>>>>>>>>>> -----Original Message-----
>>>>>>>>>> From: Parin [mailto:pkenia@yahoo-inc.com]
>>>>>>>>>> Sent: 14 June 2009 20:50
>>>>>>>>>> To: users@cxf.apache.org
>>>>>>>>>> Subject: Aegis + JSON ---> is it supported?
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> I just want to confirm that if Aegis is used as the data binding
>>>>>>> then
>>>>>>>>>> JSON is
>>>>>>>>>> not supported in CXF 2.1.x and CXF 2.2.x. I couldn't find any
>>>>>>>>>> documentation
>>>>>>>>>> stating that or otherwise and I wasn't successful in my test code
>>>>>>>>>> as
>>>>>>>>>> well.
>>>>>>>>>>
>>>>>>>>>> Thanks,
>>>>>>>>>> - parin
>>>>>>>>>> --
>>>>>>>>>> View this message in context:
>>>>>>>>>>
>>>>>>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>>>>>>>>> 24025149.html
>>>>>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> View this message in context:
>>>>>>>>>
>>>>>>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>>>>>> 24026292.html
>>>>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> View this message in context:
>>>>>>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>>>>>> 24038926.html
>>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p24629415.html
>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p24633389.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
> 


Re: Aegis + JSON ---> is it supported?

Posted by Benson Margulies <bi...@gmail.com>.
I added some tracing;

Attribute  xsins.type ns1:AegisTestBean

That means a null namepace and a name of "xsins.type". Whatever is
mapping JSON to XML isn't mapping attribute correctly, it should
presumably turn xsins.type into the proper attribute.

Whose department is this?


On Thu, Jul 23, 2009 at 3:56 PM, Sergey
Beryozkin<se...@iona.com> wrote:
>
> Hi Benson
>
> Sure, lets chat later on when you get a chance...
> and good luck with arranging the good insurance :-)
> cheers, Sergey
>
>
> bimargulies wrote:
>>
>> Sergey,
>>
>> My life is somewhat complicated at the moment due to figuring how to
>> get my daughter to have car insurance. I'll see what I can do.
>>
>> --benson
>>
>>
>> On Thu, Jul 23, 2009 at 12:21 PM, Sergey
>> Beryozkin<se...@iona.com> wrote:
>>>
>>> Hi,
>>>
>>> I've added AegisJsonProvider [1] and I'm actually quite thrilled about
>>> the
>>> possibilities it can offer, as far as the serialization of various
>>> complex
>>> types is concerned.
>>> It appears Aegis can work quite nicely with Jettison during the
>>> serialization, but I could not make the read test working. It seems Aegis
>>> requires the xsi:type information too early - jettison can certainly
>>> report
>>> it as I've also added a default JSONProvider (JAXB-based) test which
>>> reads
>>> the JSON sequence representing the list of derived types and it works
>>> well.
>>>
>>> Benson, let me know please if you can look at this issue. You may want to
>>> have a look at a disabled AegisJSONProvider.testReadFrom test (a similar
>>> and
>>> indeed more complex sequence with xsi:type works fine in
>>> JSONProviderTest.testReadListOfDerivedTypes). If yes then I can create
>>> JIRA
>>> and assign to you.
>>>
>>> Daniel - thanks for your request and please experiment with this provider
>>> -
>>> for now you can copy the source into your custom provider - we hope to do
>>> the release next week so it would be good if we could capture some errors
>>> there
>>>
>>> Cheers, Sergey
>>>
>>> [1]
>>> http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AegisJSONProvider.java
>>>
>>>
>>> Sergey Beryozkin wrote:
>>>>
>>>> Actually, I made it working - Aegis does not send 'writeEndDocument'...
>>>>
>>>> Will try to merge something working shortly
>>>> Sergey
>>>>
>>>>
>>>> Sergey Beryozkin wrote:
>>>>>
>>>>> Hi
>>>>>
>>>>> I tried to create AegisJSONProvider which for now just extends
>>>>> AegisJAXBProvider and overwrites its (newly added in my snapshot)
>>>>> createStreamWriter method and gives a Jettison writer back.
>>>>> It actually appears to work, Jettison writer is being called but
>>>>> nothing
>>>>> is available in the output stream in the end...Something confuses
>>>>> Jettison, not sure what. I'll need to look more into it...
>>>>>
>>>>> cheers, Sergey
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> moradaniel wrote:
>>>>>>
>>>>>> Hello Guys,
>>>>>>
>>>>>> I am trying to serve json content from a CXF rest service using Aegis
>>>>>> since my domain model is heavily based on interfaces and
>>>>>> map/collections. I have followed this thread but have no clue on how
>>>>>> to
>>>>>> configure the service to serve Json using Aegis. I have also looked up
>>>>>> in the samples bundled with the distribution but no example neither.
>>>>>> Do you have any working example?
>>>>>>
>>>>>> My current config is:
>>>>>>
>>>>>>     <jaxrs:server id="myService" address="/">
>>>>>>         <jaxrs:serviceBeans>
>>>>>>             <ref bean="serviceImpl" />
>>>>>>         <ref bean="personServiceImpl" />
>>>>>>         </jaxrs:serviceBeans>
>>>>>>             <!-- uncomment to use Aegis-->
>>>>>>             <jaxrs:providers>
>>>>>>                     <bean
>>>>>> class="org.apache.cxf.jaxrs.provider.AegisElementProvider"
>>>>>> />
>>>>>>             <bean class="org.apache.cxf.jaxrs.provider.JSONProvider">
>>>>>>         </jaxrs:providers>
>>>>>>         <jaxrs:extensionMappings>
>>>>>>             <entry key="xml" value="application/xml" />
>>>>>>        <entry key="json" value="application/json"/>
>>>>>>         </jaxrs:extensionMappings>
>>>>>>     </jaxrs:server>
>>>>>>
>>>>>>
>>>>>> This obviously does not work since JSONProvider uses Jaxb and not
>>>>>> Aegis.
>>>>>>
>>>>>> Thank u very much
>>>>>> Daniel
>>>>>>
>>>>>>
>>>>>> Sergey Beryozkin-2 wrote:
>>>>>>>
>>>>>>> I did a quick update to the system test which uses Aegis and had no
>>>>>>> problems getting JSON back. So let me know the Accept value please...
>>>>>>>
>>>>>>> Cheers, Sergey
>>>>>>>
>>>>>>> -----Original Message-----
>>>>>>> From: Sergey Beryozkin [mailto:sberyozk@progress.com]
>>>>>>> Sent: 15 June 2009 20:52
>>>>>>> To: users@cxf.apache.org
>>>>>>> Subject: RE: Aegis + JSON ---> is it supported?
>>>>>>>
>>>>>>> Hi Parin,
>>>>>>>
>>>>>>> I'm not sure what is happening at the moment.
>>>>>>> Can you also please post a captured HTTP Accept value ? I'll then try
>>>>>>> to
>>>>>>> do a test.
>>>>>>>
>>>>>>> Thanks, Sergey
>>>>>>>
>>>>>>> -----Original Message-----
>>>>>>> From: Parin [mailto:pkenia@yahoo-inc.com]
>>>>>>> Sent: 15 June 2009 18:19
>>>>>>> To: users@cxf.apache.org
>>>>>>> Subject: Re: Aegis + JSON ---> is it supported?
>>>>>>>
>>>>>>>
>>>>>>> Hi Sergey,
>>>>>>>
>>>>>>> Actually I am trying to serve JSON format and run into No message
>>>>>>> body
>>>>>>> writer found error.
>>>>>>>
>>>>>>> Thanks,
>>>>>>> - parin
>>>>>>>
>>>>>>> Sergey Beryozkin-2 wrote:
>>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I'm assuming it's an xml format which is not served, so try :
>>>>>>>>
>>>>>>>>>    @Produces({"application/xml", "application/json"})
>>>>>>>>
>>>>>>>> this should help....
>>>>>>>>
>>>>>>>> cheers, Sergey
>>>>>>>>
>>>>>>>>>
>>>>>>>>> I get the following error when I try to make Aegis and JSON work in
>>>>>>>>> JAX-RS:
>>>>>>>>>
>>>>>>>>> Jun 14, 2009 3:07:56 PM
>>>>>>>>> org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor
>>>>>>>>> writeResponseErrorMessage
>>>>>>>>> WARNING: .No message body writer found for response class :
>>>>>>>>> Response.
>>>>>>>>>
>>>>>>>>> Note: Response is my custom class as shown below.
>>>>>>>>>
>>>>>>>>>    @GET
>>>>>>>>>    @Path("/getquery")
>>>>>>>>>    @Produces({"application/json"})
>>>>>>>>> public Response greetQuery(@QueryParam("name") String
>>>>>>>>> name,@QueryParam("language") String language) { ..... }
>>>>>>>>>
>>>>>>>>> @XmlRootElement(name = "resp")
>>>>>>>>> public class Response {
>>>>>>>>> public Response(){}
>>>>>>>>> public String getGreeting() {
>>>>>>>>> return greeting;
>>>>>>>>> }
>>>>>>>>> public void setGreeting(String greeting) {
>>>>>>>>> this.greeting = greeting;
>>>>>>>>> }
>>>>>>>>> public Error[] getErrors() {
>>>>>>>>> return errors;
>>>>>>>>> }
>>>>>>>>> public void setErrors(Error[] errors) {
>>>>>>>>> this.errors = errors;
>>>>>>>>> }
>>>>>>>>> String greeting;
>>>>>>>>> Error[] errors;
>>>>>>>>>
>>>>>>>>> }
>>>>>>>>> I
>>>>>>>>> have the following config in my beans.xml
>>>>>>>>>
>>>>>>>>>       <bean id="aegisProvider"
>>>>>>>>> class="org.apache.cxf.jaxrs.provider.AegisElementProvider" />
>>>>>>>>> <jaxrs:server id="demoCXFServiceRS" address="/">
>>>>>>>>> <jaxrs:serviceBeans>
>>>>>>>>> <ref bean="demoCXF" />
>>>>>>>>> </jaxrs:serviceBeans>
>>>>>>>>> <jaxrs:providers>
>>>>>>>>> <ref bean="aegisProvider"/>
>>>>>>>>> </jaxrs:providers>
>>>>>>>>> </jaxrs:server>
>>>>>>>>>
>>>>>>>>> What am I missing??
>>>>>>>>>
>>>>>>>>> Thanks,
>>>>>>>>> - parin
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Sergey Beryozkin-2 wrote:
>>>>>>>>>>
>>>>>>>>>> Hi
>>>>>>>>>>
>>>>>>>>>> If you do JAX-RS then you can use Aegis and JSON providers in
>>>>>>> tandem,
>>>>>>>>>> Aegis will handle application/xml requests, JSON one will deal
>>>>>>>>>> with
>>>>>>>>>> application/json.
>>>>>>>>>>
>>>>>>>>>> If you use Aegis as part of SOAP processing, then you can still
>>>>>>> annotate
>>>>>>>>>> the same bean with JAX-RS annotations and register a jax-rs
>>>>>>>>>> endpoint
>>>>>>> on
>>>>>>>>>> the same port and have JSON supported.
>>>>>>>>>>
>>>>>>>>>> Cheers, Sergey
>>>>>>>>>>
>>>>>>>>>> -----Original Message-----
>>>>>>>>>> From: Parin [mailto:pkenia@yahoo-inc.com]
>>>>>>>>>> Sent: 14 June 2009 20:50
>>>>>>>>>> To: users@cxf.apache.org
>>>>>>>>>> Subject: Aegis + JSON ---> is it supported?
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> I just want to confirm that if Aegis is used as the data binding
>>>>>>> then
>>>>>>>>>> JSON is
>>>>>>>>>> not supported in CXF 2.1.x and CXF 2.2.x. I couldn't find any
>>>>>>>>>> documentation
>>>>>>>>>> stating that or otherwise and I wasn't successful in my test code
>>>>>>>>>> as
>>>>>>>>>> well.
>>>>>>>>>>
>>>>>>>>>> Thanks,
>>>>>>>>>> - parin
>>>>>>>>>> --
>>>>>>>>>> View this message in context:
>>>>>>>>>>
>>>>>>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>>>>>>>>> 24025149.html
>>>>>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> View this message in context:
>>>>>>>>>
>>>>>>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>>>>>> 24026292.html
>>>>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> View this message in context:
>>>>>>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>>>>>> 24038926.html
>>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p24629415.html
>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p24633389.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>

Re: Aegis + JSON ---> is it supported?

Posted by Sergey Beryozkin <se...@iona.com>.
Hi Benson

Sure, lets chat later on when you get a chance...
and good luck with arranging the good insurance :-)
cheers, Sergey


bimargulies wrote:
> 
> Sergey,
> 
> My life is somewhat complicated at the moment due to figuring how to
> get my daughter to have car insurance. I'll see what I can do.
> 
> --benson
> 
> 
> On Thu, Jul 23, 2009 at 12:21 PM, Sergey
> Beryozkin<se...@iona.com> wrote:
>>
>> Hi,
>>
>> I've added AegisJsonProvider [1] and I'm actually quite thrilled about
>> the
>> possibilities it can offer, as far as the serialization of various
>> complex
>> types is concerned.
>> It appears Aegis can work quite nicely with Jettison during the
>> serialization, but I could not make the read test working. It seems Aegis
>> requires the xsi:type information too early - jettison can certainly
>> report
>> it as I've also added a default JSONProvider (JAXB-based) test which
>> reads
>> the JSON sequence representing the list of derived types and it works
>> well.
>>
>> Benson, let me know please if you can look at this issue. You may want to
>> have a look at a disabled AegisJSONProvider.testReadFrom test (a similar
>> and
>> indeed more complex sequence with xsi:type works fine in
>> JSONProviderTest.testReadListOfDerivedTypes). If yes then I can create
>> JIRA
>> and assign to you.
>>
>> Daniel - thanks for your request and please experiment with this provider
>> -
>> for now you can copy the source into your custom provider - we hope to do
>> the release next week so it would be good if we could capture some errors
>> there
>>
>> Cheers, Sergey
>>
>> [1]
>> http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AegisJSONProvider.java
>>
>>
>> Sergey Beryozkin wrote:
>>>
>>> Actually, I made it working - Aegis does not send 'writeEndDocument'...
>>>
>>> Will try to merge something working shortly
>>> Sergey
>>>
>>>
>>> Sergey Beryozkin wrote:
>>>>
>>>> Hi
>>>>
>>>> I tried to create AegisJSONProvider which for now just extends
>>>> AegisJAXBProvider and overwrites its (newly added in my snapshot)
>>>> createStreamWriter method and gives a Jettison writer back.
>>>> It actually appears to work, Jettison writer is being called but
>>>> nothing
>>>> is available in the output stream in the end...Something confuses
>>>> Jettison, not sure what. I'll need to look more into it...
>>>>
>>>> cheers, Sergey
>>>>
>>>>
>>>>
>>>>
>>>> moradaniel wrote:
>>>>>
>>>>> Hello Guys,
>>>>>
>>>>> I am trying to serve json content from a CXF rest service using Aegis
>>>>> since my domain model is heavily based on interfaces and
>>>>> map/collections. I have followed this thread but have no clue on how
>>>>> to
>>>>> configure the service to serve Json using Aegis. I have also looked up
>>>>> in the samples bundled with the distribution but no example neither.
>>>>> Do you have any working example?
>>>>>
>>>>> My current config is:
>>>>>
>>>>>     <jaxrs:server id="myService" address="/">
>>>>>         <jaxrs:serviceBeans>
>>>>>             <ref bean="serviceImpl" />
>>>>>         <ref bean="personServiceImpl" />
>>>>>         </jaxrs:serviceBeans>
>>>>>             <!-- uncomment to use Aegis-->
>>>>>             <jaxrs:providers>
>>>>>                     <bean
>>>>> class="org.apache.cxf.jaxrs.provider.AegisElementProvider"
>>>>> />
>>>>>             <bean class="org.apache.cxf.jaxrs.provider.JSONProvider">
>>>>>         </jaxrs:providers>
>>>>>         <jaxrs:extensionMappings>
>>>>>             <entry key="xml" value="application/xml" />
>>>>>        <entry key="json" value="application/json"/>
>>>>>         </jaxrs:extensionMappings>
>>>>>     </jaxrs:server>
>>>>>
>>>>>
>>>>> This obviously does not work since JSONProvider uses Jaxb and not
>>>>> Aegis.
>>>>>
>>>>> Thank u very much
>>>>> Daniel
>>>>>
>>>>>
>>>>> Sergey Beryozkin-2 wrote:
>>>>>>
>>>>>> I did a quick update to the system test which uses Aegis and had no
>>>>>> problems getting JSON back. So let me know the Accept value please...
>>>>>>
>>>>>> Cheers, Sergey
>>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Sergey Beryozkin [mailto:sberyozk@progress.com]
>>>>>> Sent: 15 June 2009 20:52
>>>>>> To: users@cxf.apache.org
>>>>>> Subject: RE: Aegis + JSON ---> is it supported?
>>>>>>
>>>>>> Hi Parin,
>>>>>>
>>>>>> I'm not sure what is happening at the moment.
>>>>>> Can you also please post a captured HTTP Accept value ? I'll then try
>>>>>> to
>>>>>> do a test.
>>>>>>
>>>>>> Thanks, Sergey
>>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Parin [mailto:pkenia@yahoo-inc.com]
>>>>>> Sent: 15 June 2009 18:19
>>>>>> To: users@cxf.apache.org
>>>>>> Subject: Re: Aegis + JSON ---> is it supported?
>>>>>>
>>>>>>
>>>>>> Hi Sergey,
>>>>>>
>>>>>> Actually I am trying to serve JSON format and run into No message
>>>>>> body
>>>>>> writer found error.
>>>>>>
>>>>>> Thanks,
>>>>>> - parin
>>>>>>
>>>>>> Sergey Beryozkin-2 wrote:
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I'm assuming it's an xml format which is not served, so try :
>>>>>>>
>>>>>>>>    @Produces({"application/xml", "application/json"})
>>>>>>>
>>>>>>> this should help....
>>>>>>>
>>>>>>> cheers, Sergey
>>>>>>>
>>>>>>>>
>>>>>>>> I get the following error when I try to make Aegis and JSON work in
>>>>>>>> JAX-RS:
>>>>>>>>
>>>>>>>> Jun 14, 2009 3:07:56 PM
>>>>>>>> org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor
>>>>>>>> writeResponseErrorMessage
>>>>>>>> WARNING: .No message body writer found for response class :
>>>>>>>> Response.
>>>>>>>>
>>>>>>>> Note: Response is my custom class as shown below.
>>>>>>>>
>>>>>>>>    @GET
>>>>>>>>    @Path("/getquery")
>>>>>>>>    @Produces({"application/json"})
>>>>>>>> public Response greetQuery(@QueryParam("name") String
>>>>>>>> name,@QueryParam("language") String language) { ..... }
>>>>>>>>
>>>>>>>> @XmlRootElement(name = "resp")
>>>>>>>> public class Response {
>>>>>>>> public Response(){}
>>>>>>>> public String getGreeting() {
>>>>>>>> return greeting;
>>>>>>>> }
>>>>>>>> public void setGreeting(String greeting) {
>>>>>>>> this.greeting = greeting;
>>>>>>>> }
>>>>>>>> public Error[] getErrors() {
>>>>>>>> return errors;
>>>>>>>> }
>>>>>>>> public void setErrors(Error[] errors) {
>>>>>>>> this.errors = errors;
>>>>>>>> }
>>>>>>>> String greeting;
>>>>>>>> Error[] errors;
>>>>>>>>
>>>>>>>> }
>>>>>>>> I
>>>>>>>> have the following config in my beans.xml
>>>>>>>>
>>>>>>>>       <bean id="aegisProvider"
>>>>>>>> class="org.apache.cxf.jaxrs.provider.AegisElementProvider" />
>>>>>>>> <jaxrs:server id="demoCXFServiceRS" address="/">
>>>>>>>> <jaxrs:serviceBeans>
>>>>>>>> <ref bean="demoCXF" />
>>>>>>>> </jaxrs:serviceBeans>
>>>>>>>> <jaxrs:providers>
>>>>>>>> <ref bean="aegisProvider"/>
>>>>>>>> </jaxrs:providers>
>>>>>>>> </jaxrs:server>
>>>>>>>>
>>>>>>>> What am I missing??
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> - parin
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Sergey Beryozkin-2 wrote:
>>>>>>>>>
>>>>>>>>> Hi
>>>>>>>>>
>>>>>>>>> If you do JAX-RS then you can use Aegis and JSON providers in
>>>>>> tandem,
>>>>>>>>> Aegis will handle application/xml requests, JSON one will deal
>>>>>>>>> with
>>>>>>>>> application/json.
>>>>>>>>>
>>>>>>>>> If you use Aegis as part of SOAP processing, then you can still
>>>>>> annotate
>>>>>>>>> the same bean with JAX-RS annotations and register a jax-rs
>>>>>>>>> endpoint
>>>>>> on
>>>>>>>>> the same port and have JSON supported.
>>>>>>>>>
>>>>>>>>> Cheers, Sergey
>>>>>>>>>
>>>>>>>>> -----Original Message-----
>>>>>>>>> From: Parin [mailto:pkenia@yahoo-inc.com]
>>>>>>>>> Sent: 14 June 2009 20:50
>>>>>>>>> To: users@cxf.apache.org
>>>>>>>>> Subject: Aegis + JSON ---> is it supported?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> I just want to confirm that if Aegis is used as the data binding
>>>>>> then
>>>>>>>>> JSON is
>>>>>>>>> not supported in CXF 2.1.x and CXF 2.2.x. I couldn't find any
>>>>>>>>> documentation
>>>>>>>>> stating that or otherwise and I wasn't successful in my test code
>>>>>>>>> as
>>>>>>>>> well.
>>>>>>>>>
>>>>>>>>> Thanks,
>>>>>>>>> - parin
>>>>>>>>> --
>>>>>>>>> View this message in context:
>>>>>>>>>
>>>>>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>>>>>>>> 24025149.html
>>>>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> View this message in context:
>>>>>>>>
>>>>>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>>>>> 24026292.html
>>>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>>>>> 24038926.html
>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p24629415.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p24633389.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Aegis + JSON ---> is it supported?

Posted by Benson Margulies <bi...@gmail.com>.
Sergey,

My life is somewhat complicated at the moment due to figuring how to
get my daughter to have car insurance. I'll see what I can do.

--benson


On Thu, Jul 23, 2009 at 12:21 PM, Sergey
Beryozkin<se...@iona.com> wrote:
>
> Hi,
>
> I've added AegisJsonProvider [1] and I'm actually quite thrilled about the
> possibilities it can offer, as far as the serialization of various complex
> types is concerned.
> It appears Aegis can work quite nicely with Jettison during the
> serialization, but I could not make the read test working. It seems Aegis
> requires the xsi:type information too early - jettison can certainly report
> it as I've also added a default JSONProvider (JAXB-based) test which reads
> the JSON sequence representing the list of derived types and it works well.
>
> Benson, let me know please if you can look at this issue. You may want to
> have a look at a disabled AegisJSONProvider.testReadFrom test (a similar and
> indeed more complex sequence with xsi:type works fine in
> JSONProviderTest.testReadListOfDerivedTypes). If yes then I can create JIRA
> and assign to you.
>
> Daniel - thanks for your request and please experiment with this provider -
> for now you can copy the source into your custom provider - we hope to do
> the release next week so it would be good if we could capture some errors
> there
>
> Cheers, Sergey
>
> [1]
> http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AegisJSONProvider.java
>
>
> Sergey Beryozkin wrote:
>>
>> Actually, I made it working - Aegis does not send 'writeEndDocument'...
>>
>> Will try to merge something working shortly
>> Sergey
>>
>>
>> Sergey Beryozkin wrote:
>>>
>>> Hi
>>>
>>> I tried to create AegisJSONProvider which for now just extends
>>> AegisJAXBProvider and overwrites its (newly added in my snapshot)
>>> createStreamWriter method and gives a Jettison writer back.
>>> It actually appears to work, Jettison writer is being called but nothing
>>> is available in the output stream in the end...Something confuses
>>> Jettison, not sure what. I'll need to look more into it...
>>>
>>> cheers, Sergey
>>>
>>>
>>>
>>>
>>> moradaniel wrote:
>>>>
>>>> Hello Guys,
>>>>
>>>> I am trying to serve json content from a CXF rest service using Aegis
>>>> since my domain model is heavily based on interfaces and
>>>> map/collections. I have followed this thread but have no clue on how to
>>>> configure the service to serve Json using Aegis. I have also looked up
>>>> in the samples bundled with the distribution but no example neither.
>>>> Do you have any working example?
>>>>
>>>> My current config is:
>>>>
>>>>     <jaxrs:server id="myService" address="/">
>>>>         <jaxrs:serviceBeans>
>>>>             <ref bean="serviceImpl" />
>>>>         <ref bean="personServiceImpl" />
>>>>         </jaxrs:serviceBeans>
>>>>             <!-- uncomment to use Aegis-->
>>>>             <jaxrs:providers>
>>>>                     <bean class="org.apache.cxf.jaxrs.provider.AegisElementProvider"
>>>> />
>>>>             <bean class="org.apache.cxf.jaxrs.provider.JSONProvider">
>>>>         </jaxrs:providers>
>>>>         <jaxrs:extensionMappings>
>>>>             <entry key="xml" value="application/xml" />
>>>>        <entry key="json" value="application/json"/>
>>>>         </jaxrs:extensionMappings>
>>>>     </jaxrs:server>
>>>>
>>>>
>>>> This obviously does not work since JSONProvider uses Jaxb and not Aegis.
>>>>
>>>> Thank u very much
>>>> Daniel
>>>>
>>>>
>>>> Sergey Beryozkin-2 wrote:
>>>>>
>>>>> I did a quick update to the system test which uses Aegis and had no
>>>>> problems getting JSON back. So let me know the Accept value please...
>>>>>
>>>>> Cheers, Sergey
>>>>>
>>>>> -----Original Message-----
>>>>> From: Sergey Beryozkin [mailto:sberyozk@progress.com]
>>>>> Sent: 15 June 2009 20:52
>>>>> To: users@cxf.apache.org
>>>>> Subject: RE: Aegis + JSON ---> is it supported?
>>>>>
>>>>> Hi Parin,
>>>>>
>>>>> I'm not sure what is happening at the moment.
>>>>> Can you also please post a captured HTTP Accept value ? I'll then try
>>>>> to
>>>>> do a test.
>>>>>
>>>>> Thanks, Sergey
>>>>>
>>>>> -----Original Message-----
>>>>> From: Parin [mailto:pkenia@yahoo-inc.com]
>>>>> Sent: 15 June 2009 18:19
>>>>> To: users@cxf.apache.org
>>>>> Subject: Re: Aegis + JSON ---> is it supported?
>>>>>
>>>>>
>>>>> Hi Sergey,
>>>>>
>>>>> Actually I am trying to serve JSON format and run into No message body
>>>>> writer found error.
>>>>>
>>>>> Thanks,
>>>>> - parin
>>>>>
>>>>> Sergey Beryozkin-2 wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I'm assuming it's an xml format which is not served, so try :
>>>>>>
>>>>>>>    @Produces({"application/xml", "application/json"})
>>>>>>
>>>>>> this should help....
>>>>>>
>>>>>> cheers, Sergey
>>>>>>
>>>>>>>
>>>>>>> I get the following error when I try to make Aegis and JSON work in
>>>>>>> JAX-RS:
>>>>>>>
>>>>>>> Jun 14, 2009 3:07:56 PM
>>>>>>> org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor
>>>>>>> writeResponseErrorMessage
>>>>>>> WARNING: .No message body writer found for response class : Response.
>>>>>>>
>>>>>>> Note: Response is my custom class as shown below.
>>>>>>>
>>>>>>>    @GET
>>>>>>>    @Path("/getquery")
>>>>>>>    @Produces({"application/json"})
>>>>>>> public Response greetQuery(@QueryParam("name") String
>>>>>>> name,@QueryParam("language") String language) { ..... }
>>>>>>>
>>>>>>> @XmlRootElement(name = "resp")
>>>>>>> public class Response {
>>>>>>> public Response(){}
>>>>>>> public String getGreeting() {
>>>>>>> return greeting;
>>>>>>> }
>>>>>>> public void setGreeting(String greeting) {
>>>>>>> this.greeting = greeting;
>>>>>>> }
>>>>>>> public Error[] getErrors() {
>>>>>>> return errors;
>>>>>>> }
>>>>>>> public void setErrors(Error[] errors) {
>>>>>>> this.errors = errors;
>>>>>>> }
>>>>>>> String greeting;
>>>>>>> Error[] errors;
>>>>>>>
>>>>>>> }
>>>>>>> I
>>>>>>> have the following config in my beans.xml
>>>>>>>
>>>>>>>       <bean id="aegisProvider"
>>>>>>> class="org.apache.cxf.jaxrs.provider.AegisElementProvider" />
>>>>>>> <jaxrs:server id="demoCXFServiceRS" address="/">
>>>>>>> <jaxrs:serviceBeans>
>>>>>>> <ref bean="demoCXF" />
>>>>>>> </jaxrs:serviceBeans>
>>>>>>> <jaxrs:providers>
>>>>>>> <ref bean="aegisProvider"/>
>>>>>>> </jaxrs:providers>
>>>>>>> </jaxrs:server>
>>>>>>>
>>>>>>> What am I missing??
>>>>>>>
>>>>>>> Thanks,
>>>>>>> - parin
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Sergey Beryozkin-2 wrote:
>>>>>>>>
>>>>>>>> Hi
>>>>>>>>
>>>>>>>> If you do JAX-RS then you can use Aegis and JSON providers in
>>>>> tandem,
>>>>>>>> Aegis will handle application/xml requests, JSON one will deal with
>>>>>>>> application/json.
>>>>>>>>
>>>>>>>> If you use Aegis as part of SOAP processing, then you can still
>>>>> annotate
>>>>>>>> the same bean with JAX-RS annotations and register a jax-rs endpoint
>>>>> on
>>>>>>>> the same port and have JSON supported.
>>>>>>>>
>>>>>>>> Cheers, Sergey
>>>>>>>>
>>>>>>>> -----Original Message-----
>>>>>>>> From: Parin [mailto:pkenia@yahoo-inc.com]
>>>>>>>> Sent: 14 June 2009 20:50
>>>>>>>> To: users@cxf.apache.org
>>>>>>>> Subject: Aegis + JSON ---> is it supported?
>>>>>>>>
>>>>>>>>
>>>>>>>> I just want to confirm that if Aegis is used as the data binding
>>>>> then
>>>>>>>> JSON is
>>>>>>>> not supported in CXF 2.1.x and CXF 2.2.x. I couldn't find any
>>>>>>>> documentation
>>>>>>>> stating that or otherwise and I wasn't successful in my test code as
>>>>>>>> well.
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> - parin
>>>>>>>> --
>>>>>>>> View this message in context:
>>>>>>>>
>>>>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>>>>>>> 24025149.html
>>>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> View this message in context:
>>>>>>>
>>>>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>>>> 24026292.html
>>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>>>> 24038926.html
>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p24629415.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>

Re: Aegis + JSON ---> is it supported?

Posted by Benson Margulies <bi...@gmail.com>.
Sergey,

I added a StreamFilter in debugging code that I am about to commit for
you. The namespace is NOT being mapped. The attribute is in the right
place, but it is the wrong attribute.


--benson


On Fri, Jul 24, 2009 at 8:54 AM, Sergey Beryozkin<sb...@progress.com> wrote:
> Hi
>
> String data =
> "{\"ns1.AegisTestBean\":{\"@xsins.type\":\"ns1:AegisTestBean\","
>
> + "\"ns1.boolValue\":true,\"ns1.strValue\":\"hovercraft\"}}";
>
> it is "@xsins.type\":\"ns1:AegisTestBean\"
>
> Jettison is also preconfigured so that it can resolve 'xsins' prefix so it
> will/should report this attribute.
>
> The reason I think I does report it is that
> JSONProviderTest.testReadListOfDerivedTypes works :
>
> String data =
> "{\"books2\":{\"books\":{\"@xsins.type\":\"superBook\",\"id\":123,"
>
> + "\"name\":\"CXF Rocks\",\"superId\":124}}}";
>
> In that test Books2 class has a list of Books and it gets populated with
> SuperBook instances in the end...
>
> So no xsi:type info is availbale after the whole sequnce has been read ? I
> thought that Aegis was trying to get hold of xsi:type too early... Can be it
> that in case of JSONProviderTest, some additional pull is executed by the
> JAXB Unmarshaller which eventually makes this test work ?
>
> cheers, Sergey
>
> ----- Original Message -----
> From: "Benson Margulies" <bi...@gmail.com>
> To: <us...@cxf.apache.org>
> Sent: Friday, July 24, 2009 1:30 PM
> Subject: Re: Aegis + JSON ---> is it supported?
>
>
> Sergey,
>
> Well, Aegis is not seeing an xsi:type, and no one has given it a
> mapping from the XML element name to a type. Where is the type hiding?
>
> --benson
>
>
> On Thu, Jul 23, 2009 at 12:21 PM, Sergey
> Beryozkin<se...@iona.com> wrote:
>>
>> Hi,
>>
>> I've added AegisJsonProvider [1] and I'm actually quite thrilled about the
>> possibilities it can offer, as far as the serialization of various complex
>> types is concerned.
>> It appears Aegis can work quite nicely with Jettison during the
>> serialization, but I could not make the read test working. It seems Aegis
>> requires the xsi:type information too early - jettison can certainly
>> report
>> it as I've also added a default JSONProvider (JAXB-based) test which reads
>> the JSON sequence representing the list of derived types and it works
>> well.
>>
>> Benson, let me know please if you can look at this issue. You may want to
>> have a look at a disabled AegisJSONProvider.testReadFrom test (a similar
>> and
>> indeed more complex sequence with xsi:type works fine in
>> JSONProviderTest.testReadListOfDerivedTypes). If yes then I can create
>> JIRA
>> and assign to you.
>>
>> Daniel - thanks for your request and please experiment with this provider
>> -
>> for now you can copy the source into your custom provider - we hope to do
>> the release next week so it would be good if we could capture some errors
>> there
>>
>> Cheers, Sergey
>>
>> [1]
>>
>> http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AegisJSONProvider.java
>>
>>
>> Sergey Beryozkin wrote:
>>>
>>> Actually, I made it working - Aegis does not send 'writeEndDocument'...
>>>
>>> Will try to merge something working shortly
>>> Sergey
>>>
>>>
>>> Sergey Beryozkin wrote:
>>>>
>>>> Hi
>>>>
>>>> I tried to create AegisJSONProvider which for now just extends
>>>> AegisJAXBProvider and overwrites its (newly added in my snapshot)
>>>> createStreamWriter method and gives a Jettison writer back.
>>>> It actually appears to work, Jettison writer is being called but nothing
>>>> is available in the output stream in the end...Something confuses
>>>> Jettison, not sure what. I'll need to look more into it...
>>>>
>>>> cheers, Sergey
>>>>
>>>>
>>>>
>>>>
>>>> moradaniel wrote:
>>>>>
>>>>> Hello Guys,
>>>>>
>>>>> I am trying to serve json content from a CXF rest service using Aegis
>>>>> since my domain model is heavily based on interfaces and
>>>>> map/collections. I have followed this thread but have no clue on how to
>>>>> configure the service to serve Json using Aegis. I have also looked up
>>>>> in the samples bundled with the distribution but no example neither.
>>>>> Do you have any working example?
>>>>>
>>>>> My current config is:
>>>>>
>>>>> <jaxrs:server id="myService" address="/">
>>>>> <jaxrs:serviceBeans>
>>>>> <ref bean="serviceImpl" />
>>>>> <ref bean="personServiceImpl" />
>>>>> </jaxrs:serviceBeans>
>>>>> <!-- uncomment to use Aegis-->
>>>>> <jaxrs:providers>
>>>>> <bean class="org.apache.cxf.jaxrs.provider.AegisElementProvider"
>>>>> />
>>>>> <bean class="org.apache.cxf.jaxrs.provider.JSONProvider">
>>>>> </jaxrs:providers>
>>>>> <jaxrs:extensionMappings>
>>>>> <entry key="xml" value="application/xml" />
>>>>> <entry key="json" value="application/json"/>
>>>>> </jaxrs:extensionMappings>
>>>>> </jaxrs:server>
>>>>>
>>>>>
>>>>> This obviously does not work since JSONProvider uses Jaxb and not
>>>>> Aegis.
>>>>>
>>>>> Thank u very much
>>>>> Daniel
>>>>>
>>>>>
>>>>> Sergey Beryozkin-2 wrote:
>>>>>>
>>>>>> I did a quick update to the system test which uses Aegis and had no
>>>>>> problems getting JSON back. So let me know the Accept value please...
>>>>>>
>>>>>> Cheers, Sergey
>>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Sergey Beryozkin [mailto:sberyozk@progress.com]
>>>>>> Sent: 15 June 2009 20:52
>>>>>> To: users@cxf.apache.org
>>>>>> Subject: RE: Aegis + JSON ---> is it supported?
>>>>>>
>>>>>> Hi Parin,
>>>>>>
>>>>>> I'm not sure what is happening at the moment.
>>>>>> Can you also please post a captured HTTP Accept value ? I'll then try
>>>>>> to
>>>>>> do a test.
>>>>>>
>>>>>> Thanks, Sergey
>>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Parin [mailto:pkenia@yahoo-inc.com]
>>>>>> Sent: 15 June 2009 18:19
>>>>>> To: users@cxf.apache.org
>>>>>> Subject: Re: Aegis + JSON ---> is it supported?
>>>>>>
>>>>>>
>>>>>> Hi Sergey,
>>>>>>
>>>>>> Actually I am trying to serve JSON format and run into No message body
>>>>>> writer found error.
>>>>>>
>>>>>> Thanks,
>>>>>> - parin
>>>>>>
>>>>>> Sergey Beryozkin-2 wrote:
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I'm assuming it's an xml format which is not served, so try :
>>>>>>>
>>>>>>>> @Produces({"application/xml", "application/json"})
>>>>>>>
>>>>>>> this should help....
>>>>>>>
>>>>>>> cheers, Sergey
>>>>>>>
>>>>>>>>
>>>>>>>> I get the following error when I try to make Aegis and JSON work in
>>>>>>>> JAX-RS:
>>>>>>>>
>>>>>>>> Jun 14, 2009 3:07:56 PM
>>>>>>>> org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor
>>>>>>>> writeResponseErrorMessage
>>>>>>>> WARNING: .No message body writer found for response class :
>>>>>>>> Response.
>>>>>>>>
>>>>>>>> Note: Response is my custom class as shown below.
>>>>>>>>
>>>>>>>> @GET
>>>>>>>> @Path("/getquery")
>>>>>>>> @Produces({"application/json"})
>>>>>>>> public Response greetQuery(@QueryParam("name") String
>>>>>>>> name,@QueryParam("language") String language) { ..... }
>>>>>>>>
>>>>>>>> @XmlRootElement(name = "resp")
>>>>>>>> public class Response {
>>>>>>>> public Response(){}
>>>>>>>> public String getGreeting() {
>>>>>>>> return greeting;
>>>>>>>> }
>>>>>>>> public void setGreeting(String greeting) {
>>>>>>>> this.greeting = greeting;
>>>>>>>> }
>>>>>>>> public Error[] getErrors() {
>>>>>>>> return errors;
>>>>>>>> }
>>>>>>>> public void setErrors(Error[] errors) {
>>>>>>>> this.errors = errors;
>>>>>>>> }
>>>>>>>> String greeting;
>>>>>>>> Error[] errors;
>>>>>>>>
>>>>>>>> }
>>>>>>>> I
>>>>>>>> have the following config in my beans.xml
>>>>>>>>
>>>>>>>> <bean id="aegisProvider"
>>>>>>>> class="org.apache.cxf.jaxrs.provider.AegisElementProvider" />
>>>>>>>> <jaxrs:server id="demoCXFServiceRS" address="/">
>>>>>>>> <jaxrs:serviceBeans>
>>>>>>>> <ref bean="demoCXF" />
>>>>>>>> </jaxrs:serviceBeans>
>>>>>>>> <jaxrs:providers>
>>>>>>>> <ref bean="aegisProvider"/>
>>>>>>>> </jaxrs:providers>
>>>>>>>> </jaxrs:server>
>>>>>>>>
>>>>>>>> What am I missing??
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> - parin
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Sergey Beryozkin-2 wrote:
>>>>>>>>>
>>>>>>>>> Hi
>>>>>>>>>
>>>>>>>>> If you do JAX-RS then you can use Aegis and JSON providers in
>>>>>>
>>>>>> tandem,
>>>>>>>>>
>>>>>>>>> Aegis will handle application/xml requests, JSON one will deal with
>>>>>>>>> application/json.
>>>>>>>>>
>>>>>>>>> If you use Aegis as part of SOAP processing, then you can still
>>>>>>
>>>>>> annotate
>>>>>>>>>
>>>>>>>>> the same bean with JAX-RS annotations and register a jax-rs
>>>>>>>>> endpoint
>>>>>>
>>>>>> on
>>>>>>>>>
>>>>>>>>> the same port and have JSON supported.
>>>>>>>>>
>>>>>>>>> Cheers, Sergey
>>>>>>>>>
>>>>>>>>> -----Original Message-----
>>>>>>>>> From: Parin [mailto:pkenia@yahoo-inc.com]
>>>>>>>>> Sent: 14 June 2009 20:50
>>>>>>>>> To: users@cxf.apache.org
>>>>>>>>> Subject: Aegis + JSON ---> is it supported?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> I just want to confirm that if Aegis is used as the data binding
>>>>>>
>>>>>> then
>>>>>>>>>
>>>>>>>>> JSON is
>>>>>>>>> not supported in CXF 2.1.x and CXF 2.2.x. I couldn't find any
>>>>>>>>> documentation
>>>>>>>>> stating that or otherwise and I wasn't successful in my test code
>>>>>>>>> as
>>>>>>>>> well.
>>>>>>>>>
>>>>>>>>> Thanks,
>>>>>>>>> - parin
>>>>>>>>> --
>>>>>>>>> View this message in context:
>>>>>>>>>
>>>>>>
>>>>>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>>>>>>>>
>>>>>>>>> 24025149.html
>>>>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> View this message in context:
>>>>>>>>
>>>>>>
>>>>>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>>>>> 24026292.html
>>>>>>>>
>>>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> View this message in context:
>>>>>>
>>>>>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>>>>> 24038926.html
>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p24629415.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>>
>
>

Re: Aegis + JSON ---> is it supported?

Posted by Sergey Beryozkin <sb...@progress.com>.
Hi

String data = "{\"ns1.AegisTestBean\":{\"@xsins.type\":\"ns1:AegisTestBean\","

+ "\"ns1.boolValue\":true,\"ns1.strValue\":\"hovercraft\"}}";

it is "@xsins.type\":\"ns1:AegisTestBean\"

Jettison is also preconfigured so that it can resolve 'xsins' prefix so it will/should report this attribute.

The reason I think I does report it is that JSONProviderTest.testReadListOfDerivedTypes works :

String data = "{\"books2\":{\"books\":{\"@xsins.type\":\"superBook\",\"id\":123,"

+ "\"name\":\"CXF Rocks\",\"superId\":124}}}";

In that test Books2 class has a list of Books and it gets populated with SuperBook instances in the end...

So no xsi:type info is availbale after the whole sequnce has been read ? I thought that Aegis was trying to get hold of xsi:type too 
early... Can be it that in case of JSONProviderTest, some additional pull is executed by the JAXB Unmarshaller which eventually 
makes this test work ?

cheers, Sergey

----- Original Message ----- 

From: "Benson Margulies" <bi...@gmail.com>
To: <us...@cxf.apache.org>
Sent: Friday, July 24, 2009 1:30 PM
Subject: Re: Aegis + JSON ---> is it supported?


Sergey,

Well, Aegis is not seeing an xsi:type, and no one has given it a
mapping from the XML element name to a type. Where is the type hiding?

--benson


On Thu, Jul 23, 2009 at 12:21 PM, Sergey
Beryozkin<se...@iona.com> wrote:
>
> Hi,
>
> I've added AegisJsonProvider [1] and I'm actually quite thrilled about the
> possibilities it can offer, as far as the serialization of various complex
> types is concerned.
> It appears Aegis can work quite nicely with Jettison during the
> serialization, but I could not make the read test working. It seems Aegis
> requires the xsi:type information too early - jettison can certainly report
> it as I've also added a default JSONProvider (JAXB-based) test which reads
> the JSON sequence representing the list of derived types and it works well.
>
> Benson, let me know please if you can look at this issue. You may want to
> have a look at a disabled AegisJSONProvider.testReadFrom test (a similar and
> indeed more complex sequence with xsi:type works fine in
> JSONProviderTest.testReadListOfDerivedTypes). If yes then I can create JIRA
> and assign to you.
>
> Daniel - thanks for your request and please experiment with this provider -
> for now you can copy the source into your custom provider - we hope to do
> the release next week so it would be good if we could capture some errors
> there
>
> Cheers, Sergey
>
> [1]
> http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AegisJSONProvider.java
>
>
> Sergey Beryozkin wrote:
>>
>> Actually, I made it working - Aegis does not send 'writeEndDocument'...
>>
>> Will try to merge something working shortly
>> Sergey
>>
>>
>> Sergey Beryozkin wrote:
>>>
>>> Hi
>>>
>>> I tried to create AegisJSONProvider which for now just extends
>>> AegisJAXBProvider and overwrites its (newly added in my snapshot)
>>> createStreamWriter method and gives a Jettison writer back.
>>> It actually appears to work, Jettison writer is being called but nothing
>>> is available in the output stream in the end...Something confuses
>>> Jettison, not sure what. I'll need to look more into it...
>>>
>>> cheers, Sergey
>>>
>>>
>>>
>>>
>>> moradaniel wrote:
>>>>
>>>> Hello Guys,
>>>>
>>>> I am trying to serve json content from a CXF rest service using Aegis
>>>> since my domain model is heavily based on interfaces and
>>>> map/collections. I have followed this thread but have no clue on how to
>>>> configure the service to serve Json using Aegis. I have also looked up
>>>> in the samples bundled with the distribution but no example neither.
>>>> Do you have any working example?
>>>>
>>>> My current config is:
>>>>
>>>> <jaxrs:server id="myService" address="/">
>>>> <jaxrs:serviceBeans>
>>>> <ref bean="serviceImpl" />
>>>> <ref bean="personServiceImpl" />
>>>> </jaxrs:serviceBeans>
>>>> <!-- uncomment to use Aegis-->
>>>> <jaxrs:providers>
>>>> <bean class="org.apache.cxf.jaxrs.provider.AegisElementProvider"
>>>> />
>>>> <bean class="org.apache.cxf.jaxrs.provider.JSONProvider">
>>>> </jaxrs:providers>
>>>> <jaxrs:extensionMappings>
>>>> <entry key="xml" value="application/xml" />
>>>> <entry key="json" value="application/json"/>
>>>> </jaxrs:extensionMappings>
>>>> </jaxrs:server>
>>>>
>>>>
>>>> This obviously does not work since JSONProvider uses Jaxb and not Aegis.
>>>>
>>>> Thank u very much
>>>> Daniel
>>>>
>>>>
>>>> Sergey Beryozkin-2 wrote:
>>>>>
>>>>> I did a quick update to the system test which uses Aegis and had no
>>>>> problems getting JSON back. So let me know the Accept value please...
>>>>>
>>>>> Cheers, Sergey
>>>>>
>>>>> -----Original Message-----
>>>>> From: Sergey Beryozkin [mailto:sberyozk@progress.com]
>>>>> Sent: 15 June 2009 20:52
>>>>> To: users@cxf.apache.org
>>>>> Subject: RE: Aegis + JSON ---> is it supported?
>>>>>
>>>>> Hi Parin,
>>>>>
>>>>> I'm not sure what is happening at the moment.
>>>>> Can you also please post a captured HTTP Accept value ? I'll then try
>>>>> to
>>>>> do a test.
>>>>>
>>>>> Thanks, Sergey
>>>>>
>>>>> -----Original Message-----
>>>>> From: Parin [mailto:pkenia@yahoo-inc.com]
>>>>> Sent: 15 June 2009 18:19
>>>>> To: users@cxf.apache.org
>>>>> Subject: Re: Aegis + JSON ---> is it supported?
>>>>>
>>>>>
>>>>> Hi Sergey,
>>>>>
>>>>> Actually I am trying to serve JSON format and run into No message body
>>>>> writer found error.
>>>>>
>>>>> Thanks,
>>>>> - parin
>>>>>
>>>>> Sergey Beryozkin-2 wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I'm assuming it's an xml format which is not served, so try :
>>>>>>
>>>>>>> @Produces({"application/xml", "application/json"})
>>>>>>
>>>>>> this should help....
>>>>>>
>>>>>> cheers, Sergey
>>>>>>
>>>>>>>
>>>>>>> I get the following error when I try to make Aegis and JSON work in
>>>>>>> JAX-RS:
>>>>>>>
>>>>>>> Jun 14, 2009 3:07:56 PM
>>>>>>> org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor
>>>>>>> writeResponseErrorMessage
>>>>>>> WARNING: .No message body writer found for response class : Response.
>>>>>>>
>>>>>>> Note: Response is my custom class as shown below.
>>>>>>>
>>>>>>> @GET
>>>>>>> @Path("/getquery")
>>>>>>> @Produces({"application/json"})
>>>>>>> public Response greetQuery(@QueryParam("name") String
>>>>>>> name,@QueryParam("language") String language) { ..... }
>>>>>>>
>>>>>>> @XmlRootElement(name = "resp")
>>>>>>> public class Response {
>>>>>>> public Response(){}
>>>>>>> public String getGreeting() {
>>>>>>> return greeting;
>>>>>>> }
>>>>>>> public void setGreeting(String greeting) {
>>>>>>> this.greeting = greeting;
>>>>>>> }
>>>>>>> public Error[] getErrors() {
>>>>>>> return errors;
>>>>>>> }
>>>>>>> public void setErrors(Error[] errors) {
>>>>>>> this.errors = errors;
>>>>>>> }
>>>>>>> String greeting;
>>>>>>> Error[] errors;
>>>>>>>
>>>>>>> }
>>>>>>> I
>>>>>>> have the following config in my beans.xml
>>>>>>>
>>>>>>> <bean id="aegisProvider"
>>>>>>> class="org.apache.cxf.jaxrs.provider.AegisElementProvider" />
>>>>>>> <jaxrs:server id="demoCXFServiceRS" address="/">
>>>>>>> <jaxrs:serviceBeans>
>>>>>>> <ref bean="demoCXF" />
>>>>>>> </jaxrs:serviceBeans>
>>>>>>> <jaxrs:providers>
>>>>>>> <ref bean="aegisProvider"/>
>>>>>>> </jaxrs:providers>
>>>>>>> </jaxrs:server>
>>>>>>>
>>>>>>> What am I missing??
>>>>>>>
>>>>>>> Thanks,
>>>>>>> - parin
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Sergey Beryozkin-2 wrote:
>>>>>>>>
>>>>>>>> Hi
>>>>>>>>
>>>>>>>> If you do JAX-RS then you can use Aegis and JSON providers in
>>>>> tandem,
>>>>>>>> Aegis will handle application/xml requests, JSON one will deal with
>>>>>>>> application/json.
>>>>>>>>
>>>>>>>> If you use Aegis as part of SOAP processing, then you can still
>>>>> annotate
>>>>>>>> the same bean with JAX-RS annotations and register a jax-rs endpoint
>>>>> on
>>>>>>>> the same port and have JSON supported.
>>>>>>>>
>>>>>>>> Cheers, Sergey
>>>>>>>>
>>>>>>>> -----Original Message-----
>>>>>>>> From: Parin [mailto:pkenia@yahoo-inc.com]
>>>>>>>> Sent: 14 June 2009 20:50
>>>>>>>> To: users@cxf.apache.org
>>>>>>>> Subject: Aegis + JSON ---> is it supported?
>>>>>>>>
>>>>>>>>
>>>>>>>> I just want to confirm that if Aegis is used as the data binding
>>>>> then
>>>>>>>> JSON is
>>>>>>>> not supported in CXF 2.1.x and CXF 2.2.x. I couldn't find any
>>>>>>>> documentation
>>>>>>>> stating that or otherwise and I wasn't successful in my test code as
>>>>>>>> well.
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> - parin
>>>>>>>> --
>>>>>>>> View this message in context:
>>>>>>>>
>>>>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>>>>>>> 24025149.html
>>>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> View this message in context:
>>>>>>>
>>>>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>>>> 24026292.html
>>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>>>> 24038926.html
>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p24629415.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
> 


Re: Aegis + JSON ---> is it supported?

Posted by Benson Margulies <bi...@gmail.com>.
Sergey,

Well, Aegis is not seeing an xsi:type, and no one has given it a
mapping from the XML element name to a type. Where is the type hiding?

--benson


On Thu, Jul 23, 2009 at 12:21 PM, Sergey
Beryozkin<se...@iona.com> wrote:
>
> Hi,
>
> I've added AegisJsonProvider [1] and I'm actually quite thrilled about the
> possibilities it can offer, as far as the serialization of various complex
> types is concerned.
> It appears Aegis can work quite nicely with Jettison during the
> serialization, but I could not make the read test working. It seems Aegis
> requires the xsi:type information too early - jettison can certainly report
> it as I've also added a default JSONProvider (JAXB-based) test which reads
> the JSON sequence representing the list of derived types and it works well.
>
> Benson, let me know please if you can look at this issue. You may want to
> have a look at a disabled AegisJSONProvider.testReadFrom test (a similar and
> indeed more complex sequence with xsi:type works fine in
> JSONProviderTest.testReadListOfDerivedTypes). If yes then I can create JIRA
> and assign to you.
>
> Daniel - thanks for your request and please experiment with this provider -
> for now you can copy the source into your custom provider - we hope to do
> the release next week so it would be good if we could capture some errors
> there
>
> Cheers, Sergey
>
> [1]
> http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AegisJSONProvider.java
>
>
> Sergey Beryozkin wrote:
>>
>> Actually, I made it working - Aegis does not send 'writeEndDocument'...
>>
>> Will try to merge something working shortly
>> Sergey
>>
>>
>> Sergey Beryozkin wrote:
>>>
>>> Hi
>>>
>>> I tried to create AegisJSONProvider which for now just extends
>>> AegisJAXBProvider and overwrites its (newly added in my snapshot)
>>> createStreamWriter method and gives a Jettison writer back.
>>> It actually appears to work, Jettison writer is being called but nothing
>>> is available in the output stream in the end...Something confuses
>>> Jettison, not sure what. I'll need to look more into it...
>>>
>>> cheers, Sergey
>>>
>>>
>>>
>>>
>>> moradaniel wrote:
>>>>
>>>> Hello Guys,
>>>>
>>>> I am trying to serve json content from a CXF rest service using Aegis
>>>> since my domain model is heavily based on interfaces and
>>>> map/collections. I have followed this thread but have no clue on how to
>>>> configure the service to serve Json using Aegis. I have also looked up
>>>> in the samples bundled with the distribution but no example neither.
>>>> Do you have any working example?
>>>>
>>>> My current config is:
>>>>
>>>>     <jaxrs:server id="myService" address="/">
>>>>         <jaxrs:serviceBeans>
>>>>             <ref bean="serviceImpl" />
>>>>         <ref bean="personServiceImpl" />
>>>>         </jaxrs:serviceBeans>
>>>>             <!-- uncomment to use Aegis-->
>>>>             <jaxrs:providers>
>>>>                     <bean class="org.apache.cxf.jaxrs.provider.AegisElementProvider"
>>>> />
>>>>             <bean class="org.apache.cxf.jaxrs.provider.JSONProvider">
>>>>         </jaxrs:providers>
>>>>         <jaxrs:extensionMappings>
>>>>             <entry key="xml" value="application/xml" />
>>>>        <entry key="json" value="application/json"/>
>>>>         </jaxrs:extensionMappings>
>>>>     </jaxrs:server>
>>>>
>>>>
>>>> This obviously does not work since JSONProvider uses Jaxb and not Aegis.
>>>>
>>>> Thank u very much
>>>> Daniel
>>>>
>>>>
>>>> Sergey Beryozkin-2 wrote:
>>>>>
>>>>> I did a quick update to the system test which uses Aegis and had no
>>>>> problems getting JSON back. So let me know the Accept value please...
>>>>>
>>>>> Cheers, Sergey
>>>>>
>>>>> -----Original Message-----
>>>>> From: Sergey Beryozkin [mailto:sberyozk@progress.com]
>>>>> Sent: 15 June 2009 20:52
>>>>> To: users@cxf.apache.org
>>>>> Subject: RE: Aegis + JSON ---> is it supported?
>>>>>
>>>>> Hi Parin,
>>>>>
>>>>> I'm not sure what is happening at the moment.
>>>>> Can you also please post a captured HTTP Accept value ? I'll then try
>>>>> to
>>>>> do a test.
>>>>>
>>>>> Thanks, Sergey
>>>>>
>>>>> -----Original Message-----
>>>>> From: Parin [mailto:pkenia@yahoo-inc.com]
>>>>> Sent: 15 June 2009 18:19
>>>>> To: users@cxf.apache.org
>>>>> Subject: Re: Aegis + JSON ---> is it supported?
>>>>>
>>>>>
>>>>> Hi Sergey,
>>>>>
>>>>> Actually I am trying to serve JSON format and run into No message body
>>>>> writer found error.
>>>>>
>>>>> Thanks,
>>>>> - parin
>>>>>
>>>>> Sergey Beryozkin-2 wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I'm assuming it's an xml format which is not served, so try :
>>>>>>
>>>>>>>    @Produces({"application/xml", "application/json"})
>>>>>>
>>>>>> this should help....
>>>>>>
>>>>>> cheers, Sergey
>>>>>>
>>>>>>>
>>>>>>> I get the following error when I try to make Aegis and JSON work in
>>>>>>> JAX-RS:
>>>>>>>
>>>>>>> Jun 14, 2009 3:07:56 PM
>>>>>>> org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor
>>>>>>> writeResponseErrorMessage
>>>>>>> WARNING: .No message body writer found for response class : Response.
>>>>>>>
>>>>>>> Note: Response is my custom class as shown below.
>>>>>>>
>>>>>>>    @GET
>>>>>>>    @Path("/getquery")
>>>>>>>    @Produces({"application/json"})
>>>>>>> public Response greetQuery(@QueryParam("name") String
>>>>>>> name,@QueryParam("language") String language) { ..... }
>>>>>>>
>>>>>>> @XmlRootElement(name = "resp")
>>>>>>> public class Response {
>>>>>>> public Response(){}
>>>>>>> public String getGreeting() {
>>>>>>> return greeting;
>>>>>>> }
>>>>>>> public void setGreeting(String greeting) {
>>>>>>> this.greeting = greeting;
>>>>>>> }
>>>>>>> public Error[] getErrors() {
>>>>>>> return errors;
>>>>>>> }
>>>>>>> public void setErrors(Error[] errors) {
>>>>>>> this.errors = errors;
>>>>>>> }
>>>>>>> String greeting;
>>>>>>> Error[] errors;
>>>>>>>
>>>>>>> }
>>>>>>> I
>>>>>>> have the following config in my beans.xml
>>>>>>>
>>>>>>>       <bean id="aegisProvider"
>>>>>>> class="org.apache.cxf.jaxrs.provider.AegisElementProvider" />
>>>>>>> <jaxrs:server id="demoCXFServiceRS" address="/">
>>>>>>> <jaxrs:serviceBeans>
>>>>>>> <ref bean="demoCXF" />
>>>>>>> </jaxrs:serviceBeans>
>>>>>>> <jaxrs:providers>
>>>>>>> <ref bean="aegisProvider"/>
>>>>>>> </jaxrs:providers>
>>>>>>> </jaxrs:server>
>>>>>>>
>>>>>>> What am I missing??
>>>>>>>
>>>>>>> Thanks,
>>>>>>> - parin
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Sergey Beryozkin-2 wrote:
>>>>>>>>
>>>>>>>> Hi
>>>>>>>>
>>>>>>>> If you do JAX-RS then you can use Aegis and JSON providers in
>>>>> tandem,
>>>>>>>> Aegis will handle application/xml requests, JSON one will deal with
>>>>>>>> application/json.
>>>>>>>>
>>>>>>>> If you use Aegis as part of SOAP processing, then you can still
>>>>> annotate
>>>>>>>> the same bean with JAX-RS annotations and register a jax-rs endpoint
>>>>> on
>>>>>>>> the same port and have JSON supported.
>>>>>>>>
>>>>>>>> Cheers, Sergey
>>>>>>>>
>>>>>>>> -----Original Message-----
>>>>>>>> From: Parin [mailto:pkenia@yahoo-inc.com]
>>>>>>>> Sent: 14 June 2009 20:50
>>>>>>>> To: users@cxf.apache.org
>>>>>>>> Subject: Aegis + JSON ---> is it supported?
>>>>>>>>
>>>>>>>>
>>>>>>>> I just want to confirm that if Aegis is used as the data binding
>>>>> then
>>>>>>>> JSON is
>>>>>>>> not supported in CXF 2.1.x and CXF 2.2.x. I couldn't find any
>>>>>>>> documentation
>>>>>>>> stating that or otherwise and I wasn't successful in my test code as
>>>>>>>> well.
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> - parin
>>>>>>>> --
>>>>>>>> View this message in context:
>>>>>>>>
>>>>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>>>>>>> 24025149.html
>>>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> View this message in context:
>>>>>>>
>>>>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>>>> 24026292.html
>>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>>>> 24038926.html
>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p24629415.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>

RE: Aegis + JSON ---> is it supported?

Posted by Sergey Beryozkin <se...@iona.com>.
Hi,

I've added AegisJsonProvider [1] and I'm actually quite thrilled about the
possibilities it can offer, as far as the serialization of various complex
types is concerned.
It appears Aegis can work quite nicely with Jettison during the
serialization, but I could not make the read test working. It seems Aegis
requires the xsi:type information too early - jettison can certainly report
it as I've also added a default JSONProvider (JAXB-based) test which reads
the JSON sequence representing the list of derived types and it works well.

Benson, let me know please if you can look at this issue. You may want to
have a look at a disabled AegisJSONProvider.testReadFrom test (a similar and
indeed more complex sequence with xsi:type works fine in
JSONProviderTest.testReadListOfDerivedTypes). If yes then I can create JIRA
and assign to you.

Daniel - thanks for your request and please experiment with this provider -
for now you can copy the source into your custom provider - we hope to do
the release next week so it would be good if we could capture some errors
there

Cheers, Sergey

[1]
http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AegisJSONProvider.java


Sergey Beryozkin wrote:
> 
> Actually, I made it working - Aegis does not send 'writeEndDocument'...
> 
> Will try to merge something working shortly
> Sergey
> 
> 
> Sergey Beryozkin wrote:
>> 
>> Hi
>> 
>> I tried to create AegisJSONProvider which for now just extends
>> AegisJAXBProvider and overwrites its (newly added in my snapshot)
>> createStreamWriter method and gives a Jettison writer back.
>> It actually appears to work, Jettison writer is being called but nothing
>> is available in the output stream in the end...Something confuses
>> Jettison, not sure what. I'll need to look more into it...
>> 
>> cheers, Sergey
>> 
>> 
>> 
>> 
>> moradaniel wrote:
>>> 
>>> Hello Guys,
>>> 
>>> I am trying to serve json content from a CXF rest service using Aegis
>>> since my domain model is heavily based on interfaces and
>>> map/collections. I have followed this thread but have no clue on how to
>>> configure the service to serve Json using Aegis. I have also looked up
>>> in the samples bundled with the distribution but no example neither.
>>> Do you have any working example?
>>> 
>>> My current config is:
>>> 
>>>     <jaxrs:server id="myService" address="/">
>>>         <jaxrs:serviceBeans>
>>>             <ref bean="serviceImpl" />
>>> 	    <ref bean="personServiceImpl" />
>>>         </jaxrs:serviceBeans>
>>> 		<!-- uncomment to use Aegis-->
>>> 		<jaxrs:providers>
>>>     		<bean class="org.apache.cxf.jaxrs.provider.AegisElementProvider"
>>> />
>>> 		<bean class="org.apache.cxf.jaxrs.provider.JSONProvider">
>>> 	    </jaxrs:providers>
>>>         <jaxrs:extensionMappings>
>>>             <entry key="xml" value="application/xml" />
>>> 	   <entry key="json" value="application/json"/> 
>>>         </jaxrs:extensionMappings>
>>>     </jaxrs:server>
>>> 
>>> 
>>> This obviously does not work since JSONProvider uses Jaxb and not Aegis.
>>> 
>>> Thank u very much
>>> Daniel
>>> 
>>> 
>>> Sergey Beryozkin-2 wrote:
>>>> 
>>>> I did a quick update to the system test which uses Aegis and had no
>>>> problems getting JSON back. So let me know the Accept value please...
>>>> 
>>>> Cheers, Sergey
>>>> 
>>>> -----Original Message-----
>>>> From: Sergey Beryozkin [mailto:sberyozk@progress.com] 
>>>> Sent: 15 June 2009 20:52
>>>> To: users@cxf.apache.org
>>>> Subject: RE: Aegis + JSON ---> is it supported?
>>>> 
>>>> Hi Parin,
>>>> 
>>>> I'm not sure what is happening at the moment.
>>>> Can you also please post a captured HTTP Accept value ? I'll then try
>>>> to
>>>> do a test.
>>>> 
>>>> Thanks, Sergey 
>>>> 
>>>> -----Original Message-----
>>>> From: Parin [mailto:pkenia@yahoo-inc.com] 
>>>> Sent: 15 June 2009 18:19
>>>> To: users@cxf.apache.org
>>>> Subject: Re: Aegis + JSON ---> is it supported?
>>>> 
>>>> 
>>>> Hi Sergey,
>>>> 
>>>> Actually I am trying to serve JSON format and run into No message body
>>>> writer found error.
>>>> 
>>>> Thanks,
>>>> - parin
>>>> 
>>>> Sergey Beryozkin-2 wrote:
>>>>> 
>>>>> Hi,
>>>>> 
>>>>> I'm assuming it's an xml format which is not served, so try :
>>>>> 
>>>>>>    @Produces({"application/xml", "application/json"})
>>>>> 
>>>>> this should help....
>>>>> 
>>>>> cheers, Sergey
>>>>> 
>>>>>> 
>>>>>> I get the following error when I try to make Aegis and JSON work in
>>>>>> JAX-RS:
>>>>>> 
>>>>>> Jun 14, 2009 3:07:56 PM
>>>>>> org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor
>>>>>> writeResponseErrorMessage
>>>>>> WARNING: .No message body writer found for response class : Response.
>>>>>> 
>>>>>> Note: Response is my custom class as shown below.
>>>>>> 
>>>>>>    @GET
>>>>>>    @Path("/getquery")
>>>>>>    @Produces({"application/json"})
>>>>>> public Response greetQuery(@QueryParam("name") String
>>>>>> name,@QueryParam("language") String language) { ..... }
>>>>>> 
>>>>>> @XmlRootElement(name = "resp")
>>>>>> public class Response {
>>>>>> public Response(){}
>>>>>> public String getGreeting() {
>>>>>> return greeting;
>>>>>> }
>>>>>> public void setGreeting(String greeting) {
>>>>>> this.greeting = greeting;
>>>>>> }
>>>>>> public Error[] getErrors() {
>>>>>> return errors;
>>>>>> }
>>>>>> public void setErrors(Error[] errors) {
>>>>>> this.errors = errors;
>>>>>> }
>>>>>> String greeting;
>>>>>> Error[] errors;
>>>>>> 
>>>>>> }
>>>>>> I
>>>>>> have the following config in my beans.xml
>>>>>> 
>>>>>>       <bean id="aegisProvider"
>>>>>> class="org.apache.cxf.jaxrs.provider.AegisElementProvider" />
>>>>>> <jaxrs:server id="demoCXFServiceRS" address="/">
>>>>>> <jaxrs:serviceBeans>
>>>>>> <ref bean="demoCXF" />
>>>>>> </jaxrs:serviceBeans>
>>>>>> <jaxrs:providers>
>>>>>> <ref bean="aegisProvider"/>
>>>>>> </jaxrs:providers>
>>>>>> </jaxrs:server>
>>>>>> 
>>>>>> What am I missing??
>>>>>> 
>>>>>> Thanks,
>>>>>> - parin
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> Sergey Beryozkin-2 wrote:
>>>>>>> 
>>>>>>> Hi
>>>>>>> 
>>>>>>> If you do JAX-RS then you can use Aegis and JSON providers in
>>>> tandem,
>>>>>>> Aegis will handle application/xml requests, JSON one will deal with
>>>>>>> application/json.
>>>>>>> 
>>>>>>> If you use Aegis as part of SOAP processing, then you can still
>>>> annotate
>>>>>>> the same bean with JAX-RS annotations and register a jax-rs endpoint
>>>> on
>>>>>>> the same port and have JSON supported.
>>>>>>> 
>>>>>>> Cheers, Sergey 
>>>>>>> 
>>>>>>> -----Original Message-----
>>>>>>> From: Parin [mailto:pkenia@yahoo-inc.com] 
>>>>>>> Sent: 14 June 2009 20:50
>>>>>>> To: users@cxf.apache.org
>>>>>>> Subject: Aegis + JSON ---> is it supported?
>>>>>>> 
>>>>>>> 
>>>>>>> I just want to confirm that if Aegis is used as the data binding
>>>> then
>>>>>>> JSON is
>>>>>>> not supported in CXF 2.1.x and CXF 2.2.x. I couldn't find any
>>>>>>> documentation
>>>>>>> stating that or otherwise and I wasn't successful in my test code as
>>>>>>> well.
>>>>>>> 
>>>>>>> Thanks,
>>>>>>> - parin
>>>>>>> -- 
>>>>>>> View this message in context:
>>>>>>>
>>>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>>>>>> 24025149.html
>>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> -- 
>>>>>> View this message in context:
>>>>>>
>>>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>>> 24026292.html
>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>
>>>>> 
>>>>> 
>>>> 
>>>> -- 
>>>> View this message in context:
>>>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>>> 24038926.html
>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>> 
>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p24629415.html
Sent from the cxf-user mailing list archive at Nabble.com.


RE: Aegis + JSON ---> is it supported?

Posted by Sergey Beryozkin <se...@iona.com>.
Actually, I made it working - Aegis does not send 'writeEndDocument'...

Will try to merge something working shortly
Sergey


Sergey Beryozkin wrote:
> 
> Hi
> 
> I tried to create AegisJSONProvider which for now just extends
> AegisJAXBProvider and overwrites its (newly added in my snapshot)
> createStreamWriter method and gives a Jettison writer back.
> It actually appears to work, Jettison writer is being called but nothing
> is available in the output stream in the end...Something confuses
> Jettison, not sure what. I'll need to look more into it...
> 
> cheers, Sergey
> 
> 
> 
> 
> moradaniel wrote:
>> 
>> Hello Guys,
>> 
>> I am trying to serve json content from a CXF rest service using Aegis
>> since my domain model is heavily based on interfaces and map/collections.
>> I have followed this thread but have no clue on how to configure the
>> service to serve Json using Aegis. I have also looked up in the samples
>> bundled with the distribution but no example neither.
>> Do you have any working example?
>> 
>> My current config is:
>> 
>>     <jaxrs:server id="myService" address="/">
>>         <jaxrs:serviceBeans>
>>             <ref bean="serviceImpl" />
>> 	    <ref bean="personServiceImpl" />
>>         </jaxrs:serviceBeans>
>> 		<!-- uncomment to use Aegis-->
>> 		<jaxrs:providers>
>>     		<bean class="org.apache.cxf.jaxrs.provider.AegisElementProvider" />
>> 		<bean class="org.apache.cxf.jaxrs.provider.JSONProvider">
>> 	    </jaxrs:providers>
>>         <jaxrs:extensionMappings>
>>             <entry key="xml" value="application/xml" />
>> 	   <entry key="json" value="application/json"/> 
>>         </jaxrs:extensionMappings>
>>     </jaxrs:server>
>> 
>> 
>> This obviously does not work since JSONProvider uses Jaxb and not Aegis.
>> 
>> Thank u very much
>> Daniel
>> 
>> 
>> Sergey Beryozkin-2 wrote:
>>> 
>>> I did a quick update to the system test which uses Aegis and had no
>>> problems getting JSON back. So let me know the Accept value please...
>>> 
>>> Cheers, Sergey
>>> 
>>> -----Original Message-----
>>> From: Sergey Beryozkin [mailto:sberyozk@progress.com] 
>>> Sent: 15 June 2009 20:52
>>> To: users@cxf.apache.org
>>> Subject: RE: Aegis + JSON ---> is it supported?
>>> 
>>> Hi Parin,
>>> 
>>> I'm not sure what is happening at the moment.
>>> Can you also please post a captured HTTP Accept value ? I'll then try to
>>> do a test.
>>> 
>>> Thanks, Sergey 
>>> 
>>> -----Original Message-----
>>> From: Parin [mailto:pkenia@yahoo-inc.com] 
>>> Sent: 15 June 2009 18:19
>>> To: users@cxf.apache.org
>>> Subject: Re: Aegis + JSON ---> is it supported?
>>> 
>>> 
>>> Hi Sergey,
>>> 
>>> Actually I am trying to serve JSON format and run into No message body
>>> writer found error.
>>> 
>>> Thanks,
>>> - parin
>>> 
>>> Sergey Beryozkin-2 wrote:
>>>> 
>>>> Hi,
>>>> 
>>>> I'm assuming it's an xml format which is not served, so try :
>>>> 
>>>>>    @Produces({"application/xml", "application/json"})
>>>> 
>>>> this should help....
>>>> 
>>>> cheers, Sergey
>>>> 
>>>>> 
>>>>> I get the following error when I try to make Aegis and JSON work in
>>>>> JAX-RS:
>>>>> 
>>>>> Jun 14, 2009 3:07:56 PM
>>>>> org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor
>>>>> writeResponseErrorMessage
>>>>> WARNING: .No message body writer found for response class : Response.
>>>>> 
>>>>> Note: Response is my custom class as shown below.
>>>>> 
>>>>>    @GET
>>>>>    @Path("/getquery")
>>>>>    @Produces({"application/json"})
>>>>> public Response greetQuery(@QueryParam("name") String
>>>>> name,@QueryParam("language") String language) { ..... }
>>>>> 
>>>>> @XmlRootElement(name = "resp")
>>>>> public class Response {
>>>>> public Response(){}
>>>>> public String getGreeting() {
>>>>> return greeting;
>>>>> }
>>>>> public void setGreeting(String greeting) {
>>>>> this.greeting = greeting;
>>>>> }
>>>>> public Error[] getErrors() {
>>>>> return errors;
>>>>> }
>>>>> public void setErrors(Error[] errors) {
>>>>> this.errors = errors;
>>>>> }
>>>>> String greeting;
>>>>> Error[] errors;
>>>>> 
>>>>> }
>>>>> I
>>>>> have the following config in my beans.xml
>>>>> 
>>>>>       <bean id="aegisProvider"
>>>>> class="org.apache.cxf.jaxrs.provider.AegisElementProvider" />
>>>>> <jaxrs:server id="demoCXFServiceRS" address="/">
>>>>> <jaxrs:serviceBeans>
>>>>> <ref bean="demoCXF" />
>>>>> </jaxrs:serviceBeans>
>>>>> <jaxrs:providers>
>>>>> <ref bean="aegisProvider"/>
>>>>> </jaxrs:providers>
>>>>> </jaxrs:server>
>>>>> 
>>>>> What am I missing??
>>>>> 
>>>>> Thanks,
>>>>> - parin
>>>>> 
>>>>> 
>>>>> 
>>>>> Sergey Beryozkin-2 wrote:
>>>>>> 
>>>>>> Hi
>>>>>> 
>>>>>> If you do JAX-RS then you can use Aegis and JSON providers in
>>> tandem,
>>>>>> Aegis will handle application/xml requests, JSON one will deal with
>>>>>> application/json.
>>>>>> 
>>>>>> If you use Aegis as part of SOAP processing, then you can still
>>> annotate
>>>>>> the same bean with JAX-RS annotations and register a jax-rs endpoint
>>> on
>>>>>> the same port and have JSON supported.
>>>>>> 
>>>>>> Cheers, Sergey 
>>>>>> 
>>>>>> -----Original Message-----
>>>>>> From: Parin [mailto:pkenia@yahoo-inc.com] 
>>>>>> Sent: 14 June 2009 20:50
>>>>>> To: users@cxf.apache.org
>>>>>> Subject: Aegis + JSON ---> is it supported?
>>>>>> 
>>>>>> 
>>>>>> I just want to confirm that if Aegis is used as the data binding
>>> then
>>>>>> JSON is
>>>>>> not supported in CXF 2.1.x and CXF 2.2.x. I couldn't find any
>>>>>> documentation
>>>>>> stating that or otherwise and I wasn't successful in my test code as
>>>>>> well.
>>>>>> 
>>>>>> Thanks,
>>>>>> - parin
>>>>>> -- 
>>>>>> View this message in context:
>>>>>>
>>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>>>>> 24025149.html
>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>>> -- 
>>>>> View this message in context:
>>>>>
>>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>> 24026292.html
>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>
>>>> 
>>>> 
>>> 
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>> 24038926.html
>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>> 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p24610239.html
Sent from the cxf-user mailing list archive at Nabble.com.


RE: Aegis + JSON ---> is it supported?

Posted by Sergey Beryozkin <se...@iona.com>.
Hi

I tried to create AegisJSONProvider which for now just extends
AegisJAXBProvider and overwrites its (newly added in my snapshot)
createStreamWriter method and gives a Jettison writer back.
It actually appears to work, Jettison writer is being called but nothing is
available in the output stream in the end...Something confuses Jettison, not
sure what. I'll need to look more into it...

cheers, Sergey




moradaniel wrote:
> 
> Hello Guys,
> 
> I am trying to serve json content from a CXF rest service using Aegis
> since my domain model is heavily based on interfaces and map/collections.
> I have followed this thread but have no clue on how to configure the
> service to serve Json using Aegis. I have also looked up in the samples
> bundled with the distribution but no example neither.
> Do you have any working example?
> 
> My current config is:
> 
>     <jaxrs:server id="myService" address="/">
>         <jaxrs:serviceBeans>
>             <ref bean="serviceImpl" />
> 	    <ref bean="personServiceImpl" />
>         </jaxrs:serviceBeans>
> 		<!-- uncomment to use Aegis-->
> 		<jaxrs:providers>
>     		<bean class="org.apache.cxf.jaxrs.provider.AegisElementProvider" />
> 		<bean class="org.apache.cxf.jaxrs.provider.JSONProvider">
> 	    </jaxrs:providers>
>         <jaxrs:extensionMappings>
>             <entry key="xml" value="application/xml" />
> 	   <entry key="json" value="application/json"/> 
>         </jaxrs:extensionMappings>
>     </jaxrs:server>
> 
> 
> This obviously does not work since JSONProvider uses Jaxb and not Aegis.
> 
> Thank u very much
> Daniel
> 
> 
> Sergey Beryozkin-2 wrote:
>> 
>> I did a quick update to the system test which uses Aegis and had no
>> problems getting JSON back. So let me know the Accept value please...
>> 
>> Cheers, Sergey
>> 
>> -----Original Message-----
>> From: Sergey Beryozkin [mailto:sberyozk@progress.com] 
>> Sent: 15 June 2009 20:52
>> To: users@cxf.apache.org
>> Subject: RE: Aegis + JSON ---> is it supported?
>> 
>> Hi Parin,
>> 
>> I'm not sure what is happening at the moment.
>> Can you also please post a captured HTTP Accept value ? I'll then try to
>> do a test.
>> 
>> Thanks, Sergey 
>> 
>> -----Original Message-----
>> From: Parin [mailto:pkenia@yahoo-inc.com] 
>> Sent: 15 June 2009 18:19
>> To: users@cxf.apache.org
>> Subject: Re: Aegis + JSON ---> is it supported?
>> 
>> 
>> Hi Sergey,
>> 
>> Actually I am trying to serve JSON format and run into No message body
>> writer found error.
>> 
>> Thanks,
>> - parin
>> 
>> Sergey Beryozkin-2 wrote:
>>> 
>>> Hi,
>>> 
>>> I'm assuming it's an xml format which is not served, so try :
>>> 
>>>>    @Produces({"application/xml", "application/json"})
>>> 
>>> this should help....
>>> 
>>> cheers, Sergey
>>> 
>>>> 
>>>> I get the following error when I try to make Aegis and JSON work in
>>>> JAX-RS:
>>>> 
>>>> Jun 14, 2009 3:07:56 PM
>>>> org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor
>>>> writeResponseErrorMessage
>>>> WARNING: .No message body writer found for response class : Response.
>>>> 
>>>> Note: Response is my custom class as shown below.
>>>> 
>>>>    @GET
>>>>    @Path("/getquery")
>>>>    @Produces({"application/json"})
>>>> public Response greetQuery(@QueryParam("name") String
>>>> name,@QueryParam("language") String language) { ..... }
>>>> 
>>>> @XmlRootElement(name = "resp")
>>>> public class Response {
>>>> public Response(){}
>>>> public String getGreeting() {
>>>> return greeting;
>>>> }
>>>> public void setGreeting(String greeting) {
>>>> this.greeting = greeting;
>>>> }
>>>> public Error[] getErrors() {
>>>> return errors;
>>>> }
>>>> public void setErrors(Error[] errors) {
>>>> this.errors = errors;
>>>> }
>>>> String greeting;
>>>> Error[] errors;
>>>> 
>>>> }
>>>> I
>>>> have the following config in my beans.xml
>>>> 
>>>>       <bean id="aegisProvider"
>>>> class="org.apache.cxf.jaxrs.provider.AegisElementProvider" />
>>>> <jaxrs:server id="demoCXFServiceRS" address="/">
>>>> <jaxrs:serviceBeans>
>>>> <ref bean="demoCXF" />
>>>> </jaxrs:serviceBeans>
>>>> <jaxrs:providers>
>>>> <ref bean="aegisProvider"/>
>>>> </jaxrs:providers>
>>>> </jaxrs:server>
>>>> 
>>>> What am I missing??
>>>> 
>>>> Thanks,
>>>> - parin
>>>> 
>>>> 
>>>> 
>>>> Sergey Beryozkin-2 wrote:
>>>>> 
>>>>> Hi
>>>>> 
>>>>> If you do JAX-RS then you can use Aegis and JSON providers in
>> tandem,
>>>>> Aegis will handle application/xml requests, JSON one will deal with
>>>>> application/json.
>>>>> 
>>>>> If you use Aegis as part of SOAP processing, then you can still
>> annotate
>>>>> the same bean with JAX-RS annotations and register a jax-rs endpoint
>> on
>>>>> the same port and have JSON supported.
>>>>> 
>>>>> Cheers, Sergey 
>>>>> 
>>>>> -----Original Message-----
>>>>> From: Parin [mailto:pkenia@yahoo-inc.com] 
>>>>> Sent: 14 June 2009 20:50
>>>>> To: users@cxf.apache.org
>>>>> Subject: Aegis + JSON ---> is it supported?
>>>>> 
>>>>> 
>>>>> I just want to confirm that if Aegis is used as the data binding
>> then
>>>>> JSON is
>>>>> not supported in CXF 2.1.x and CXF 2.2.x. I couldn't find any
>>>>> documentation
>>>>> stating that or otherwise and I wasn't successful in my test code as
>>>>> well.
>>>>> 
>>>>> Thanks,
>>>>> - parin
>>>>> -- 
>>>>> View this message in context:
>>>>>
>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>>>> 24025149.html
>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> -- 
>>>> View this message in context:
>>>>
>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>> 24026292.html
>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>> 24038926.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p24610145.html
Sent from the cxf-user mailing list archive at Nabble.com.


RE: Aegis + JSON ---> is it supported?

Posted by moradaniel <mo...@gmail.com>.
Hello Guys,

I am trying to serve json content from a CXF rest service using Aegis since
my domain model is heavily based on interfaces and map/collections. I have
followed this thread but have no clue on how to configure the service to
serve Json using Aegis. I have also looked up in the samples bundled with
the distribution but no example neither.
Do you have any working example?

My current config is:

    <jaxrs:server id="myService" address="/">
        <jaxrs:serviceBeans>
            <ref bean="serviceImpl" />
	    <ref bean="personServiceImpl" />
        </jaxrs:serviceBeans>
		<!-- uncomment to use Aegis-->
		<jaxrs:providers>
    		<bean class="org.apache.cxf.jaxrs.provider.AegisElementProvider" />
		<bean class="org.apache.cxf.jaxrs.provider.JSONProvider">
	    </jaxrs:providers>
        <jaxrs:extensionMappings>
            <entry key="xml" value="application/xml" />
	   <entry key="json" value="application/json"/> 
        </jaxrs:extensionMappings>
    </jaxrs:server>


This obviously does not work since JSONProvider uses Jaxb and not Aegis.

Thank u very much
Daniel


Sergey Beryozkin-2 wrote:
> 
> I did a quick update to the system test which uses Aegis and had no
> problems getting JSON back. So let me know the Accept value please...
> 
> Cheers, Sergey
> 
> -----Original Message-----
> From: Sergey Beryozkin [mailto:sberyozk@progress.com] 
> Sent: 15 June 2009 20:52
> To: users@cxf.apache.org
> Subject: RE: Aegis + JSON ---> is it supported?
> 
> Hi Parin,
> 
> I'm not sure what is happening at the moment.
> Can you also please post a captured HTTP Accept value ? I'll then try to
> do a test.
> 
> Thanks, Sergey 
> 
> -----Original Message-----
> From: Parin [mailto:pkenia@yahoo-inc.com] 
> Sent: 15 June 2009 18:19
> To: users@cxf.apache.org
> Subject: Re: Aegis + JSON ---> is it supported?
> 
> 
> Hi Sergey,
> 
> Actually I am trying to serve JSON format and run into No message body
> writer found error.
> 
> Thanks,
> - parin
> 
> Sergey Beryozkin-2 wrote:
>> 
>> Hi,
>> 
>> I'm assuming it's an xml format which is not served, so try :
>> 
>>>    @Produces({"application/xml", "application/json"})
>> 
>> this should help....
>> 
>> cheers, Sergey
>> 
>>> 
>>> I get the following error when I try to make Aegis and JSON work in
>>> JAX-RS:
>>> 
>>> Jun 14, 2009 3:07:56 PM
>>> org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor
>>> writeResponseErrorMessage
>>> WARNING: .No message body writer found for response class : Response.
>>> 
>>> Note: Response is my custom class as shown below.
>>> 
>>>    @GET
>>>    @Path("/getquery")
>>>    @Produces({"application/json"})
>>> public Response greetQuery(@QueryParam("name") String
>>> name,@QueryParam("language") String language) { ..... }
>>> 
>>> @XmlRootElement(name = "resp")
>>> public class Response {
>>> public Response(){}
>>> public String getGreeting() {
>>> return greeting;
>>> }
>>> public void setGreeting(String greeting) {
>>> this.greeting = greeting;
>>> }
>>> public Error[] getErrors() {
>>> return errors;
>>> }
>>> public void setErrors(Error[] errors) {
>>> this.errors = errors;
>>> }
>>> String greeting;
>>> Error[] errors;
>>> 
>>> }
>>> I
>>> have the following config in my beans.xml
>>> 
>>>       <bean id="aegisProvider"
>>> class="org.apache.cxf.jaxrs.provider.AegisElementProvider" />
>>> <jaxrs:server id="demoCXFServiceRS" address="/">
>>> <jaxrs:serviceBeans>
>>> <ref bean="demoCXF" />
>>> </jaxrs:serviceBeans>
>>> <jaxrs:providers>
>>> <ref bean="aegisProvider"/>
>>> </jaxrs:providers>
>>> </jaxrs:server>
>>> 
>>> What am I missing??
>>> 
>>> Thanks,
>>> - parin
>>> 
>>> 
>>> 
>>> Sergey Beryozkin-2 wrote:
>>>> 
>>>> Hi
>>>> 
>>>> If you do JAX-RS then you can use Aegis and JSON providers in
> tandem,
>>>> Aegis will handle application/xml requests, JSON one will deal with
>>>> application/json.
>>>> 
>>>> If you use Aegis as part of SOAP processing, then you can still
> annotate
>>>> the same bean with JAX-RS annotations and register a jax-rs endpoint
> on
>>>> the same port and have JSON supported.
>>>> 
>>>> Cheers, Sergey 
>>>> 
>>>> -----Original Message-----
>>>> From: Parin [mailto:pkenia@yahoo-inc.com] 
>>>> Sent: 14 June 2009 20:50
>>>> To: users@cxf.apache.org
>>>> Subject: Aegis + JSON ---> is it supported?
>>>> 
>>>> 
>>>> I just want to confirm that if Aegis is used as the data binding
> then
>>>> JSON is
>>>> not supported in CXF 2.1.x and CXF 2.2.x. I couldn't find any
>>>> documentation
>>>> stating that or otherwise and I wasn't successful in my test code as
>>>> well.
>>>> 
>>>> Thanks,
>>>> - parin
>>>> -- 
>>>> View this message in context:
>>>>
> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>>> 24025149.html
>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>> 
>>>> 
>>>> 
>>> 
>>> -- 
>>> View this message in context:
>>>
> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
> 24026292.html
>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
> 24038926.html
> Sent from the cxf-user mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p24597371.html
Sent from the cxf-user mailing list archive at Nabble.com.


RE: Aegis + JSON ---> is it supported?

Posted by Sergey Beryozkin <sb...@progress.com>.
I did a quick update to the system test which uses Aegis and had no
problems getting JSON back. So let me know the Accept value please...

Cheers, Sergey

-----Original Message-----
From: Sergey Beryozkin [mailto:sberyozk@progress.com] 
Sent: 15 June 2009 20:52
To: users@cxf.apache.org
Subject: RE: Aegis + JSON ---> is it supported?

Hi Parin,

I'm not sure what is happening at the moment.
Can you also please post a captured HTTP Accept value ? I'll then try to
do a test.

Thanks, Sergey 

-----Original Message-----
From: Parin [mailto:pkenia@yahoo-inc.com] 
Sent: 15 June 2009 18:19
To: users@cxf.apache.org
Subject: Re: Aegis + JSON ---> is it supported?


Hi Sergey,

Actually I am trying to serve JSON format and run into No message body
writer found error.

Thanks,
- parin

Sergey Beryozkin-2 wrote:
> 
> Hi,
> 
> I'm assuming it's an xml format which is not served, so try :
> 
>>    @Produces({"application/xml", "application/json"})
> 
> this should help....
> 
> cheers, Sergey
> 
>> 
>> I get the following error when I try to make Aegis and JSON work in
>> JAX-RS:
>> 
>> Jun 14, 2009 3:07:56 PM
>> org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor
>> writeResponseErrorMessage
>> WARNING: .No message body writer found for response class : Response.
>> 
>> Note: Response is my custom class as shown below.
>> 
>>    @GET
>>    @Path("/getquery")
>>    @Produces({"application/json"})
>> public Response greetQuery(@QueryParam("name") String
>> name,@QueryParam("language") String language) { ..... }
>> 
>> @XmlRootElement(name = "resp")
>> public class Response {
>> public Response(){}
>> public String getGreeting() {
>> return greeting;
>> }
>> public void setGreeting(String greeting) {
>> this.greeting = greeting;
>> }
>> public Error[] getErrors() {
>> return errors;
>> }
>> public void setErrors(Error[] errors) {
>> this.errors = errors;
>> }
>> String greeting;
>> Error[] errors;
>> 
>> }
>> I
>> have the following config in my beans.xml
>> 
>>       <bean id="aegisProvider"
>> class="org.apache.cxf.jaxrs.provider.AegisElementProvider" />
>> <jaxrs:server id="demoCXFServiceRS" address="/">
>> <jaxrs:serviceBeans>
>> <ref bean="demoCXF" />
>> </jaxrs:serviceBeans>
>> <jaxrs:providers>
>> <ref bean="aegisProvider"/>
>> </jaxrs:providers>
>> </jaxrs:server>
>> 
>> What am I missing??
>> 
>> Thanks,
>> - parin
>> 
>> 
>> 
>> Sergey Beryozkin-2 wrote:
>>> 
>>> Hi
>>> 
>>> If you do JAX-RS then you can use Aegis and JSON providers in
tandem,
>>> Aegis will handle application/xml requests, JSON one will deal with
>>> application/json.
>>> 
>>> If you use Aegis as part of SOAP processing, then you can still
annotate
>>> the same bean with JAX-RS annotations and register a jax-rs endpoint
on
>>> the same port and have JSON supported.
>>> 
>>> Cheers, Sergey 
>>> 
>>> -----Original Message-----
>>> From: Parin [mailto:pkenia@yahoo-inc.com] 
>>> Sent: 14 June 2009 20:50
>>> To: users@cxf.apache.org
>>> Subject: Aegis + JSON ---> is it supported?
>>> 
>>> 
>>> I just want to confirm that if Aegis is used as the data binding
then
>>> JSON is
>>> not supported in CXF 2.1.x and CXF 2.2.x. I couldn't find any
>>> documentation
>>> stating that or otherwise and I wasn't successful in my test code as
>>> well.
>>> 
>>> Thanks,
>>> - parin
>>> -- 
>>> View this message in context:
>>>
http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>> 24025149.html
>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>> 
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>>
http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
24026292.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
> 
> 

-- 
View this message in context:
http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
24038926.html
Sent from the cxf-user mailing list archive at Nabble.com.


RE: Aegis + JSON ---> is it supported?

Posted by Sergey Beryozkin <sb...@progress.com>.
Hi Parin,

I'm not sure what is happening at the moment.
Can you also please post a captured HTTP Accept value ? I'll then try to
do a test.

Thanks, Sergey 

-----Original Message-----
From: Parin [mailto:pkenia@yahoo-inc.com] 
Sent: 15 June 2009 18:19
To: users@cxf.apache.org
Subject: Re: Aegis + JSON ---> is it supported?


Hi Sergey,

Actually I am trying to serve JSON format and run into No message body
writer found error.

Thanks,
- parin

Sergey Beryozkin-2 wrote:
> 
> Hi,
> 
> I'm assuming it's an xml format which is not served, so try :
> 
>>    @Produces({"application/xml", "application/json"})
> 
> this should help....
> 
> cheers, Sergey
> 
>> 
>> I get the following error when I try to make Aegis and JSON work in
>> JAX-RS:
>> 
>> Jun 14, 2009 3:07:56 PM
>> org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor
>> writeResponseErrorMessage
>> WARNING: .No message body writer found for response class : Response.
>> 
>> Note: Response is my custom class as shown below.
>> 
>>    @GET
>>    @Path("/getquery")
>>    @Produces({"application/json"})
>> public Response greetQuery(@QueryParam("name") String
>> name,@QueryParam("language") String language) { ..... }
>> 
>> @XmlRootElement(name = "resp")
>> public class Response {
>> public Response(){}
>> public String getGreeting() {
>> return greeting;
>> }
>> public void setGreeting(String greeting) {
>> this.greeting = greeting;
>> }
>> public Error[] getErrors() {
>> return errors;
>> }
>> public void setErrors(Error[] errors) {
>> this.errors = errors;
>> }
>> String greeting;
>> Error[] errors;
>> 
>> }
>> I
>> have the following config in my beans.xml
>> 
>>       <bean id="aegisProvider"
>> class="org.apache.cxf.jaxrs.provider.AegisElementProvider" />
>> <jaxrs:server id="demoCXFServiceRS" address="/">
>> <jaxrs:serviceBeans>
>> <ref bean="demoCXF" />
>> </jaxrs:serviceBeans>
>> <jaxrs:providers>
>> <ref bean="aegisProvider"/>
>> </jaxrs:providers>
>> </jaxrs:server>
>> 
>> What am I missing??
>> 
>> Thanks,
>> - parin
>> 
>> 
>> 
>> Sergey Beryozkin-2 wrote:
>>> 
>>> Hi
>>> 
>>> If you do JAX-RS then you can use Aegis and JSON providers in
tandem,
>>> Aegis will handle application/xml requests, JSON one will deal with
>>> application/json.
>>> 
>>> If you use Aegis as part of SOAP processing, then you can still
annotate
>>> the same bean with JAX-RS annotations and register a jax-rs endpoint
on
>>> the same port and have JSON supported.
>>> 
>>> Cheers, Sergey 
>>> 
>>> -----Original Message-----
>>> From: Parin [mailto:pkenia@yahoo-inc.com] 
>>> Sent: 14 June 2009 20:50
>>> To: users@cxf.apache.org
>>> Subject: Aegis + JSON ---> is it supported?
>>> 
>>> 
>>> I just want to confirm that if Aegis is used as the data binding
then
>>> JSON is
>>> not supported in CXF 2.1.x and CXF 2.2.x. I couldn't find any
>>> documentation
>>> stating that or otherwise and I wasn't successful in my test code as
>>> well.
>>> 
>>> Thanks,
>>> - parin
>>> -- 
>>> View this message in context:
>>>
http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>> 24025149.html
>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>> 
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>>
http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
24026292.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
> 
> 

-- 
View this message in context:
http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
24038926.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Aegis + JSON ---> is it supported?

Posted by Parin <pk...@yahoo-inc.com>.
Hi Sergey,

Actually I am trying to serve JSON format and run into No message body
writer found error.

Thanks,
- parin

Sergey Beryozkin-2 wrote:
> 
> Hi,
> 
> I'm assuming it's an xml format which is not served, so try :
> 
>>    @Produces({"application/xml", "application/json"})
> 
> this should help....
> 
> cheers, Sergey
> 
>> 
>> I get the following error when I try to make Aegis and JSON work in
>> JAX-RS:
>> 
>> Jun 14, 2009 3:07:56 PM
>> org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor
>> writeResponseErrorMessage
>> WARNING: .No message body writer found for response class : Response.
>> 
>> Note: Response is my custom class as shown below.
>> 
>>    @GET
>>    @Path("/getquery")
>>    @Produces({"application/json"})
>> public Response greetQuery(@QueryParam("name") String
>> name,@QueryParam("language") String language) { ..... }
>> 
>> @XmlRootElement(name = "resp")
>> public class Response {
>> public Response(){}
>> public String getGreeting() {
>> return greeting;
>> }
>> public void setGreeting(String greeting) {
>> this.greeting = greeting;
>> }
>> public Error[] getErrors() {
>> return errors;
>> }
>> public void setErrors(Error[] errors) {
>> this.errors = errors;
>> }
>> String greeting;
>> Error[] errors;
>> 
>> }
>> I
>> have the following config in my beans.xml
>> 
>>       <bean id="aegisProvider"
>> class="org.apache.cxf.jaxrs.provider.AegisElementProvider" />
>> <jaxrs:server id="demoCXFServiceRS" address="/">
>> <jaxrs:serviceBeans>
>> <ref bean="demoCXF" />
>> </jaxrs:serviceBeans>
>> <jaxrs:providers>
>> <ref bean="aegisProvider"/>
>> </jaxrs:providers>
>> </jaxrs:server>
>> 
>> What am I missing??
>> 
>> Thanks,
>> - parin
>> 
>> 
>> 
>> Sergey Beryozkin-2 wrote:
>>> 
>>> Hi
>>> 
>>> If you do JAX-RS then you can use Aegis and JSON providers in tandem,
>>> Aegis will handle application/xml requests, JSON one will deal with
>>> application/json.
>>> 
>>> If you use Aegis as part of SOAP processing, then you can still annotate
>>> the same bean with JAX-RS annotations and register a jax-rs endpoint on
>>> the same port and have JSON supported.
>>> 
>>> Cheers, Sergey 
>>> 
>>> -----Original Message-----
>>> From: Parin [mailto:pkenia@yahoo-inc.com] 
>>> Sent: 14 June 2009 20:50
>>> To: users@cxf.apache.org
>>> Subject: Aegis + JSON ---> is it supported?
>>> 
>>> 
>>> I just want to confirm that if Aegis is used as the data binding then
>>> JSON is
>>> not supported in CXF 2.1.x and CXF 2.2.x. I couldn't find any
>>> documentation
>>> stating that or otherwise and I wasn't successful in my test code as
>>> well.
>>> 
>>> Thanks,
>>> - parin
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>>> 24025149.html
>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>> 
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p24026292.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p24038926.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Aegis + JSON ---> is it supported?

Posted by Sergey Beryozkin <sb...@progress.com>.
Hi,

I'm assuming it's an xml format which is not served, so try :

>    @Produces({"application/xml", "application/json"})

this should help....

cheers, Sergey

> 
> I get the following error when I try to make Aegis and JSON work in JAX-RS:
> 
> Jun 14, 2009 3:07:56 PM org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor
> writeResponseErrorMessage
> WARNING: .No message body writer found for response class : Response.
> 
> Note: Response is my custom class as shown below.
> 
>    @GET
>    @Path("/getquery")
>    @Produces({"application/json"})
> public Response greetQuery(@QueryParam("name") String
> name,@QueryParam("language") String language) { ..... }
> 
> @XmlRootElement(name = "resp")
> public class Response {
> public Response(){}
> public String getGreeting() {
> return greeting;
> }
> public void setGreeting(String greeting) {
> this.greeting = greeting;
> }
> public Error[] getErrors() {
> return errors;
> }
> public void setErrors(Error[] errors) {
> this.errors = errors;
> }
> String greeting;
> Error[] errors;
> 
> }
> I
> have the following config in my beans.xml
> 
>       <bean id="aegisProvider"
> class="org.apache.cxf.jaxrs.provider.AegisElementProvider" />
> <jaxrs:server id="demoCXFServiceRS" address="/">
> <jaxrs:serviceBeans>
> <ref bean="demoCXF" />
> </jaxrs:serviceBeans>
> <jaxrs:providers>
> <ref bean="aegisProvider"/>
> </jaxrs:providers>
> </jaxrs:server>
> 
> What am I missing??
> 
> Thanks,
> - parin
> 
> 
> 
> Sergey Beryozkin-2 wrote:
>> 
>> Hi
>> 
>> If you do JAX-RS then you can use Aegis and JSON providers in tandem,
>> Aegis will handle application/xml requests, JSON one will deal with
>> application/json.
>> 
>> If you use Aegis as part of SOAP processing, then you can still annotate
>> the same bean with JAX-RS annotations and register a jax-rs endpoint on
>> the same port and have JSON supported.
>> 
>> Cheers, Sergey 
>> 
>> -----Original Message-----
>> From: Parin [mailto:pkenia@yahoo-inc.com] 
>> Sent: 14 June 2009 20:50
>> To: users@cxf.apache.org
>> Subject: Aegis + JSON ---> is it supported?
>> 
>> 
>> I just want to confirm that if Aegis is used as the data binding then
>> JSON is
>> not supported in CXF 2.1.x and CXF 2.2.x. I couldn't find any
>> documentation
>> stating that or otherwise and I wasn't successful in my test code as
>> well.
>> 
>> Thanks,
>> - parin
>> -- 
>> View this message in context:
>> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
>> 24025149.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>> 
>> 
>> 
> 
> -- 
> View this message in context: http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p24026292.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>

RE: Aegis + JSON ---> is it supported?

Posted by Parin <pk...@yahoo-inc.com>.
I get the following error when I try to make Aegis and JSON work in JAX-RS:

Jun 14, 2009 3:07:56 PM org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor
writeResponseErrorMessage
WARNING: .No message body writer found for response class : Response.

Note: Response is my custom class as shown below.

    @GET
    @Path("/getquery")
    @Produces({"application/json"})
	public Response greetQuery(@QueryParam("name") String
name,@QueryParam("language") String language) { ..... }

@XmlRootElement(name = "resp")
public class Response {
	public Response(){}
	public String getGreeting() {
		return greeting;
	}
	public void setGreeting(String greeting) {
		this.greeting = greeting;
	}
	public Error[] getErrors() {
		return errors;
	}
	public void setErrors(Error[] errors) {
		this.errors = errors;
	}
	String greeting;
	Error[] errors;

}
I
 have the following config in my beans.xml

       <bean id="aegisProvider"
class="org.apache.cxf.jaxrs.provider.AegisElementProvider" />
	<jaxrs:server id="demoCXFServiceRS" address="/">
		<jaxrs:serviceBeans>
			<ref bean="demoCXF" />
		</jaxrs:serviceBeans>
		<jaxrs:providers>
			<ref bean="aegisProvider"/>
		</jaxrs:providers>
	</jaxrs:server>

What am I missing??

Thanks,
- parin



Sergey Beryozkin-2 wrote:
> 
> Hi
> 
> If you do JAX-RS then you can use Aegis and JSON providers in tandem,
> Aegis will handle application/xml requests, JSON one will deal with
> application/json.
> 
> If you use Aegis as part of SOAP processing, then you can still annotate
> the same bean with JAX-RS annotations and register a jax-rs endpoint on
> the same port and have JSON supported.
> 
> Cheers, Sergey 
> 
> -----Original Message-----
> From: Parin [mailto:pkenia@yahoo-inc.com] 
> Sent: 14 June 2009 20:50
> To: users@cxf.apache.org
> Subject: Aegis + JSON ---> is it supported?
> 
> 
> I just want to confirm that if Aegis is used as the data binding then
> JSON is
> not supported in CXF 2.1.x and CXF 2.2.x. I couldn't find any
> documentation
> stating that or otherwise and I wasn't successful in my test code as
> well.
> 
> Thanks,
> - parin
> -- 
> View this message in context:
> http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
> 24025149.html
> Sent from the cxf-user mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p24026292.html
Sent from the cxf-user mailing list archive at Nabble.com.


RE: Aegis + JSON ---> is it supported?

Posted by Sergey Beryozkin <sb...@progress.com>.
Hi

If you do JAX-RS then you can use Aegis and JSON providers in tandem,
Aegis will handle application/xml requests, JSON one will deal with
application/json.

If you use Aegis as part of SOAP processing, then you can still annotate
the same bean with JAX-RS annotations and register a jax-rs endpoint on
the same port and have JSON supported.

Cheers, Sergey 

-----Original Message-----
From: Parin [mailto:pkenia@yahoo-inc.com] 
Sent: 14 June 2009 20:50
To: users@cxf.apache.org
Subject: Aegis + JSON ---> is it supported?


I just want to confirm that if Aegis is used as the data binding then
JSON is
not supported in CXF 2.1.x and CXF 2.2.x. I couldn't find any
documentation
stating that or otherwise and I wasn't successful in my test code as
well.

Thanks,
- parin
-- 
View this message in context:
http://www.nabble.com/Aegis-%2B-JSON----%3E-is-it-supported--tp24025149p
24025149.html
Sent from the cxf-user mailing list archive at Nabble.com.