Return-Path: Delivered-To: apmail-ws-axis-user-archive@www.apache.org Received: (qmail 34115 invoked from network); 4 May 2008 14:41:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 May 2008 14:41:44 -0000 Received: (qmail 82984 invoked by uid 500); 4 May 2008 14:41:36 -0000 Delivered-To: apmail-ws-axis-user-archive@ws.apache.org Received: (qmail 82974 invoked by uid 500); 4 May 2008 14:41:36 -0000 Mailing-List: contact axis-user-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-user@ws.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-user@ws.apache.org Received: (qmail 82963 invoked by uid 99); 4 May 2008 14:41:36 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 04 May 2008 07:41:36 -0700 X-ASF-Spam-Status: No, hits=4.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS,URIBL_BLACK X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of keithgchapman@gmail.com designates 66.249.82.228 as permitted sender) Received: from [66.249.82.228] (HELO wx-out-0506.google.com) (66.249.82.228) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 04 May 2008 14:40:40 +0000 Received: by wx-out-0506.google.com with SMTP id r21so621993wxc.28 for ; Sun, 04 May 2008 07:41:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; bh=jf7Kd3NwyIfbf64jbV/LCiwkk7QejxxnD6zhtmCQOMQ=; b=glyL00UlvKWTDcY+T3EADnnBwebDLf/BtpvnDhOq7ldSaeCTS4Qk8sfRZr6d+8flB62ZEA2EUmXuK1Ree8mmRacLpffqFm8tj0+FIXi6y+elekP9Xcg6nbthRHoBzehh89zEi2c6glN1s9f1UW+q8OO9iYF/AnjYshUSV6kfhh8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=iR3q9ld/bth3UO2IbA+D+qodunyhGDwajRIIDYbFsXVhBS9+JCxWgr5NUuWPix084W3zhyIHX3AAq/SBaC3GTTkXtF9bJFAZnGfQaQX9sX5rjQIWBB2t35PFYTPs8NToav5X86Wij5b5vGbGggAuZuUm2Y9tbHSRPgdMgyopl1w= Received: by 10.70.41.11 with SMTP id o11mr5526399wxo.41.1209912061167; Sun, 04 May 2008 07:41:01 -0700 (PDT) Received: by 10.70.51.17 with HTTP; Sun, 4 May 2008 07:41:01 -0700 (PDT) Message-ID: Date: Sun, 4 May 2008 20:11:01 +0530 From: "keith chapman" To: axis-user@ws.apache.org Subject: Re: JSON + POJO Service In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_4309_15048892.1209912061157" References: X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_4309_15048892.1209912061157 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Cristian, Nice to hear that you got something working. The current Formatters don't support that. BTW I know the guy who implemented JSON support in axis2. I will be meeting him next week. I will ask him the reasoning behind implementing it this way. For now you should be able to implement your requirement by hacking one of the above formatters. Thanks, Keith. On Sun, May 4, 2008 at 7:49 PM, Cristian Bullokles < cristian.bullokles@gmail.com> wrote: > Thanks Keith, > Looks like something has started working. > When i use: > http://localhost:8080/axis2/services/Version/getVersion?response=application/json/badgerfish > It works and return: > > {"ns:getVersionResponse":{"@xmlns":{"ns":"http:\/\/axisversion.sample"},"ns:return":{"$":"Hello > I am Axis2 version service , My version is 1.4"}}} > Now my problem is that i don't want to get namespaces in > responses, but when i've used > > http://localhost:8080/axis2/services/Version/getVersion?response=application/json > I've received the same fault. > > {"Fault":" xmlns:soapenv=\"http:\/\/www.w3.org\/2003\/05\/soap-envelope\">soapenv:Receiver<\/soapenv:Value><\/soapenv:Code> xml:lang=\"en-US\">Mapped formatted JSON with namespaces are not supported > in Axis2. Make sure that your request doesn't include namespaces or use the > Badgerfish convention<\/soapenv:Text><\/soapenv:Reason> \/><\/soapenv:Fault>"} > > You think that we can't use json format without namespaces using > get? > I need to create my own formatter? > > Thanks > Cristian > > > > > On Sun, May 4, 2008 at 5:31 AM, keith chapman > wrote: > > > Hi Cristian, > > > > There are two json notations supported in axis2. > > application/json/badgerfish and application/json. In this case you need to > > use the former. Add both formatters to your axis2.xml as below, > > > > > > > class="org.apache.axis2.json.JSONMessageFormatter"/> > > > > > class="org.apache.axis2.json.JSONBadgerfishMessageFormatter"/> > > > > Then you can try c/badgerfish > > > > I updated the above module to map application/json/badgerfish to > > ?response=json and application/json to ?response=application/json > > > > Thanks, > > Keith. > > > > > > On Sun, May 4, 2008 at 1:12 AM, Cristian Bullokles < > > cristian.bullokles@gmail.com> wrote: > > > > > Now looks like the parser is working the response is json format but > > > allways is a fault. like that: > > > > > > {"Fault":" > > xmlns:soapenv=\"http:\/\/www.w3.org\/2003\/05\/soap-envelope\">soapenv:Receiver<\/soapenv:Value><\/soapenv:Code> > > xml:lang=\"en-US\">Mapped formatted JSON with namespaces are not supported > > > in Axis2. Make sure that your request doesn't include namespaces or use the > > > Badgerfish convention<\/soapenv:Text><\/soapenv:Reason> > > \/><\/soapenv:Fault>"} > > > > > > My request is only a get from a browser: > > > > > > > > > http://localhost:8080/axis2/services/Version/getVersion?response=application/json > > > > > > > > > > > > > > > On Sat, May 3, 2008 at 12:43 AM, keith chapman < > > > keithgchapman@gmail.com> wrote: > > > > > > > Hi Cristian, > > > > > > > > Have you engaged DynamicResponseHandler on the version service? If > > > > you want to engage this blobally (That will effect all services running on > > > > your system) you can do so by adding > > > > to your axis2.xml. > > > > > > > > Thanks, > > > > Keith. > > > > > > > > > > > > On Sat, May 3, 2008 at 1:53 AM, Cristian Bullokles < > > > > cristian.bullokles@gmail.com> wrote: > > > > > > > > > Hi all > > > > > I've modified the axis2.xml file adding this lines: > > > > > > > > > > > > > > > > > > > > > > > > class="org.apache.axis2.json.JSONMessageFormatter"/> > > > > > > > > > > > > > > > > > > > > > > > > class="org.apache.axis2.json.JSONOMBuilder"/> > > > > > > > > > > Also as Keith said in a previous thread I've compiled and > > > > > installed the module dynamic response: > > > > > > > > > > > > > > > http://wso2.org/repos/wso2/trunk/commons/dynamic-response/ > > > > > > > > > > Then i've restarted tomcat and all continues working at the > > > > > same way, when i tried: > > > > > > > > > > > > > > > > > > > > http://localhost:8080/axis2/services/Version/getVersion?response=application/json > > > > > > > > > > I've received the same XML response: > > > > > > > > > > > > > > > > > > > > Hello I am Axis2 version service , My version is 1.4 > > > > > > > > > > > > > > > > > > > > I'm using axis2 1.4 in tomcat6. > > > > > > > > > > Any idea? I need a JSON response when I invoke using REST with > > > > > response=application/json > > > > > > > > > > Regards > > > > > Cristian > > > > > > > > > > > > > > > > > > > > > > -- > > > > Keith Chapman > > > > Senior Software Engineer > > > > WSO2 Inc. > > > > Oxygenating the Web Service Platform. > > > > http://wso2.org/ > > > > > > > > blog: http://www.keith-chapman.org > > > > > > > > > > > > > > > -- > > Keith Chapman > > Senior Software Engineer > > WSO2 Inc. > > Oxygenating the Web Service Platform. > > http://wso2.org/ > > > > blog: http://www.keith-chapman.org > > > > -- Keith Chapman Senior Software Engineer WSO2 Inc. Oxygenating the Web Service Platform. http://wso2.org/ blog: http://www.keith-chapman.org ------=_Part_4309_15048892.1209912061157 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Cristian,

Nice to hear that you got something working.  The current Formatters don't support that. BTW I know the guy who implemented JSON support in axis2. I will be meeting him next week. I will ask him the reasoning behind implementing it this way. For now you should be able to implement your requirement by hacking one of the above formatters.

Thanks,
Keith.

On Sun, May 4, 2008 at 7:49 PM, Cristian Bullokles <cristian.bullokles@gmail.com> wrote:
Thanks Keith,
         Looks like something has started working.
         When i use: http://localhost:8080/axis2/services/Version/getVersion?response=application/json/badgerfish
         It works and return:
                {"ns:getVersionResponse":{"@xmlns":{"ns":"http:\/\/axisversion.sample"},"ns:return":{"$":"Hello I am Axis2 version service , My version is 1.4"}}}
         Now my problem is that i don't want to get namespaces in responses, but when i've used          I've received the same fault.

 
                {"Fault":"<soapenv:Fault xmlns:soapenv=\"http:\/\/www.w3.org\/2003\/05\/soap-envelope\"><soapenv:Code><soapenv:Value>soapenv:Receiver<\/soapenv:Value><\/soapenv:Code><soapenv:Reason><soapenv:Text xml:lang=\"en-US\">Mapped formatted JSON with namespaces are not supported in Axis2. Make sure that your request doesn't include namespaces or use the Badgerfish convention<\/soapenv:Text><\/soapenv:Reason><soapenv:Detail \/><\/soapenv:Fault>"}
 
        You think that we can't use json format without namespaces using get?
         I need to create my own formatter?

Thanks
Cristian




On Sun, May 4, 2008 at 5:31 AM, keith chapman <keithgchapman@gmail.com> wrote:
Hi Cristian,

There are two json notations supported in axis2. application/json/badgerfish and application/json. In this case you need to use the former. Add both formatters to your axis2.xml as below,


<messageFormatter contentType="application/json"
                         class="org.apache.axis2.json.JSONMessageFormatter"/>
        <messageFormatter contentType="application/json/badgerfish"
                         class="org.apache.axis2.json.JSONBadgerfishMessageFormatter"/>

Then you can try       c/badgerfish

I updated the above module to map application/json/badgerfish to ?response=json and application/json to ?response=application/json

Thanks,
Keith.


On Sun, May 4, 2008 at 1:12 AM, Cristian Bullokles <cristian.bullokles@gmail.com> wrote:
Now looks like the parser is working the response is json format but allways is a fault. like that:

{"Fault":"<soapenv:Fault xmlns:soapenv=\"http:\/\/www.w3.org\/2003\/05\/soap-envelope\"><soapenv:Code><soapenv:Value>soapenv:Receiver<\/soapenv:Value><\/soapenv:Code><soapenv:Reason><soapenv:Text xml:lang=\"en-US\">Mapped formatted JSON with namespaces are not supported in Axis2. Make sure that your request doesn't include namespaces or use the Badgerfish convention<\/soapenv:Text><\/soapenv:Reason><soapenv:Detail \/><\/soapenv:Fault>"}
 
My request is only a get from a browser:
On Sat, May 3, 2008 at 12:43 AM, keith chapman <keithgchapman@gmail.com> wrote:
Hi Cristian,

Have you engaged DynamicResponseHandler on the version service? If you want to engage this blobally (That will effect all services running on your system) you can do so by adding <module ref="DynamicResponseHandler"/> to your axis2.xml.

Thanks,
Keith.


On Sat, May 3, 2008 at 1:53 AM, Cristian Bullokles <cristian.bullokles@gmail.com> wrote:
Hi all
      I've modified the axis2.xml file adding this lines:

    <messageFormatters>
          <messageFormatter     contentType="application/json"
                              class="org.apache.axis2.json.JSONMessageFormatter"/>

    <messageBuilders>
        <messageBuilder contentType="application/json"
                        class="org.apache.axis2.json.JSONOMBuilder"/>

    Also as Keith said in a previous thread I've compiled and installed the module dynamic response:

                   http://wso2.org/repos/wso2/trunk/commons/dynamic-response/

    Then i've restarted tomcat and all continues working at the same way, when i tried:
        

                    http://localhost:8080/axis2/services/Version/getVersion?response=application/json

     I've received the same XML response:

    <ns:getVersionResponse>
    <ns:return>
Hello I am Axis2 version service , My version is 1.4
</ns:return>
</ns:getVersionResponse>
      
         I'm using axis2 1.4 in tomcat6.

Any idea? I need a JSON response when I invoke using REST with response=application/json

Regards
Cristian




--
Keith Chapman
Senior Software Engineer
WSO2 Inc.
Oxygenating the Web Service Platform.
http://wso2.org/

blog: http://www.keith-chapman.org




--
Keith Chapman
Senior Software Engineer
WSO2 Inc.
Oxygenating the Web Service Platform.
http://wso2.org/

blog: http://www.keith-chapman.org




--
Keith Chapman
Senior Software Engineer
WSO2 Inc.
Oxygenating the Web Service Platform.
http://wso2.org/

blog: http://www.keith-chapman.org ------=_Part_4309_15048892.1209912061157--