On Wed, Oct 27, 2010 at 9:30 PM, Vitor Rodrigues <
vitor.rodrig...@pessoaseprocessos.com> wrote:

> Just to give and update on this "issue".
>
> I got JSON response( get ) like this:
>
> Added  [1] to :
> $WSAS_HOME/repository/deployment/server/axis2modules
>
> Added [2] to :
>  $WSAS_HOME/webapps/ROOT/WEB-INF/lib
>  Changed axis2.xml ( $WSAS_HOME/repository/conf ) to :
> <axisconfig name="AxisJava2.0"> <!--
> ================================================= --> <!-- Globally engaged
> modules --> <!-- ================================================= --> ..
> <module ref="DynamicResponseHandler"/>
>  ...
>
> Added also in axis2.xml :
>
>  <messageBuilder contentType="application/json"
> class="org.apache.axis2.json.JSONOMBuilder"/>
>
> <messageBuilder contentType="application/json/badgerfish"
> class="org.apache.axis2.json.JSONBadgerfishOMBuilder"/>
> <messageBuilder contentType="text/javascript"
> class="org.apache.axis2.json.JSONOMBuilder"/>
>
> <messageFormatter contentType="application/json"
> class="org.apache.axis2.json.JSONMessageFormatter"/>
> <messageFormatter contentType="application/json/badgerfish"
> class="org.apache.axis2.json.JSONBadgerfishMessageFormatter"/>
> <messageFormatter contentType="text/javascript"
> class="org.apache.axis2.json.JSONMessageFormatter"/>
>
> Restart Server.
>
> Test (WS=getCAE with param id = A and agent = something):
>
>
> http://entitas-d.corp.turismodeportugal.pt:9763/services/Entity.EntityHttpEndpoint/getCAE?id=A&agent=something&;
> response=application/json/badgerfish
>
> And it returned [3]
>
> Strange is that with : response=application/json or text/javascript it
> didn't worked.... Any thoughts ?
>

That is because you've got namespaces in your response. Only
application/json/badgerfish
can handle namespaces.

Thanks,
~Isuru


>
> [1]
> http://dist.wso2.org/maven2/org/wso2/dynamicresponse/wso2dynamic-response/SNAPSHOT/wso2dynamic-response-20080916.170559-241.mar
> [2]
> http://www.marcusschiesser.de/wp-content/uploads/2009/01/jettison-11-snapshot.jar
> [3] http://dl.dropbox.com/u/6197079/getCAE
>
>
>
> 2010/10/15 Vitor Rodrigues <vitor.rodrig...@pessoaseprocessos.com>
>
> First of thks Lahiru Gunathilake and Sanjiva Weerawarana for the answers ;)
>>
>> I will explain the why i want a JSON response "in the browser". Are you
>> all familiar with GWT  ( http://code.google.com/intl/pt-PT/webtoolkit/ )
>> ?
>>
>> My boss is a very very very straight forward person in Open Source
>> solutions and bigger now because of the economics problem there are in our
>> country Portugal.
>>
>> We have the functions for a normal application , like insert , update,
>> delete, undelete, search all provided by the Web Services that we made using
>> Java and deployed in WSO2 WSAS ( great tool ).
>> So we have .NET and Outsystems (http://www.outsystems.com/) applications
>> feeding of our web services. But all the applications have a big cost of
>> license and personel.
>>  So, how can we work-around this ? Build are own interface solution and
>> graduly substitute that non-free applications ( and putting some companies
>> without work...evil smile...just kidding :P ).
>>
>> I "discovered" GWT, because of is potencial and the Java to
>> Javascript/Ajax. But here comes the "problem". Because of the Same-Origin
>> Policy, the work-around is to have the Web Services returning JSON. GWT can
>> work with XML but is very very , sorry for the bad words, a pain in the ass.
>> :P
>>
>> Does anyone worked with GWT and WSO2 WSAS Web services ? Well, googling
>> it, it seems that i'm re-inventing the wheel.
>>
>> I have made Gadgets, for the Gadget Server ( based on Web services of WSAS
>> or from WSO2 Data Services ) , using HighCharts and Google (
>> http://code.google.com/apis/ajax/playground/?exp=libraries#pie_chart)
>> like :
>>
>> From WSAS:
>>
>>
>> http://lh4.ggpht.com/_9W-bLvZvQUQ/TH4auUYkAiI/AAAAAAAAAIg/HQLZjZuE7yI/s800/Impressoes%20Custo%20de%20um%20determinado%20utilizador%20num%20determinado%20ano.png
>>
>>
>> http://lh5.ggpht.com/_9W-bLvZvQUQ/TH0vB9Gcx6I/AAAAAAAAAIc/ZMWGGdz1AYs/s800/Top%20n%20localiza%C3%A7%C3%A3o%20por%20custo%20em%20determinado%20m%C3%AAs%20de%20determinado%20ano.png
>>
>>
>> http://lh5.ggpht.com/_9W-bLvZvQUQ/TH5s88H3lzI/AAAAAAAAAI0/o3QVBTjm6Tk/s800/Impress%C3%B5es%20de%20determinada%20m%C3%A1quina%20%28origem%29%20mensalmente%20em%20determinado%20ano.png
>>
>> From Data Services:
>>
>>
>> http://lh6.ggpht.com/_9W-bLvZvQUQ/TLggrD41F7I/AAAAAAAAAjs/sipIWzBHKUQ/s800/ds1.jpg
>>
>>
>> http://lh4.ggpht.com/_9W-bLvZvQUQ/TLggrXSmXAI/AAAAAAAAAjw/lrzTqzP23RQ/s800/ds2.jpg
>>
>>
>> http://lh4.ggpht.com/_9W-bLvZvQUQ/TLggrq7d5-I/AAAAAAAAAj0/7RuFYmdPFn4/s800/ds3.jpg
>>
>>
>> @Lahiru Gunathilake
>> Sorry if i mistake it wrong but you want me to have a xml with the
>> "query", on the server. Where is the flexiablity on that ? for example :
>>
>> <getCAE>
>> <id>A</id>
>> <agent>f28c4324-0dc3-531b-98f1-d3c00cc6a36c</agent>
>> </getCAE>
>>
>> The id field can have up to 9000 distinct values. Do i have to create 9000
>> xml's ? Sorry if i understood it wrong. :(
>>
>> @Sanjiva Weerawarana
>> "To get it working with GET you should have to send the HTTP header
>> "Accept: application/json", just like with POST."
>>
>> You mean "curl -X GET -H 'Accept: application/json' -d @post.xml
>> http://entitas-.
>> corp.turismodeportugal.pt:9763/services/Entity.EntityHttpSoap12Endpoint "
>> ?
>>
>> If the solution passes by having multiple xml's on the server with the
>> possible query's, that will not be my way.
>>
>> Why can WSO2 WSAS have JSON response, like the Youtube GData API , Google
>> Social Graph API , GeoNames webservice , etc ?
>>
>> For some information related here :
>>
>> http://www.gwtsite.com/how-to-access-web-services-with-gwt/
>>
>>
>> http://java.dzone.com/articles/efective-json-google-web?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed:+javalobby/frontpage+(Javalobby+/+Java+Zone)<http://java.dzone.com/articles/efective-json-google-web?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed:+javalobby/frontpage+%28Javalobby+/+Java+Zone%29>
>>
>> http://www.javacodegeeks.com/2010/07/add-json-gwt-application.html
>>
>> http://www.gwtapps.com/?p=42
>>
>> http://eclipse.dzone.com/news/making-gwt-remote-procedure-ca
>>
>>
>>
>> 2010/10/15 Sanjiva Weerawarana <sanj...@wso2.com>
>>
>> To get it working with GET you should have to send the HTTP header
>>> "Accept: application/json", just like with POST.
>>>
>>> Sanjiva.
>>>
>>>
>>> On Thu, Oct 14, 2010 at 11:05 PM, Hiranya Jayathilaka 
>>> <hira...@wso2.com>wrote:
>>>
>>>> Hi Victor,
>>>>
>>>> On Thu, Oct 14, 2010 at 2:21 PM, Vitor Rodrigues <
>>>> vitor.rodrig...@pessoaseprocessos.com> wrote:
>>>>
>>>>> Sorry, copied it wrong :
>>>>>
>>>>> "
>>>>>
>>>>> But i'm i requesting it wrong ? The webservice call i'm making simple
>>>>> adds *response=application/json*
>>>>>
>>>>>
>>>>> http://entitas-d.corp.turismodeportugal.pt:9763/services/Entity.EntityHttpSoap12Endpoint/getCAE?id=A&agent=f28c4324-0dc3-531b-98f1-d3c00cc6a36c&response=<http://entitas-d.corp.turismodeportugal.pt:9763/services/Entity.EntityHttpSoap12Endpoint/getCAE?id=A&agent=f28c4324-0dc3-531b-98f1-d3c00cc6a36c&response=text/json>
>>>>> *application/json*
>>>>>
>>>>> "
>>>>>
>>>>
>>>> So it seems you are making a GET request with some query parameters. I
>>>> don't think WSAS can send you back JSON just because you have  
>>>> *response=application/json
>>>> *as a query parameter. But with your current settings if you POST a
>>>> JSON payload to WSAS with the content-type set to application/json it will
>>>> send you a JSON response back.
>>>>
>>>> May be Isuru has an idea how to get this working with GET.
>>>>
>>>> Thanks,
>>>> Hiranya
>>>>
>>>>
>>>>>
>>>>> Still doesn't work :S
>>>>>
>>>>>
>>>>>
>>>>> 2010/10/14 Vitor Rodrigues <vitor.rodrig...@pessoaseprocessos.com>
>>>>>
>>>>> Thks Isuru.
>>>>>>
>>>>>> With the Axis2 JSON jar [1] and the Jettison jar[2]
>>>>>> in repository/components/dropins, and repository/conf/axis2.xml with :
>>>>>>
>>>>>> <messageFormatter contentType="application/json"
>>>>>> class="org.apache.axis2.json.JSONMessageFormatter"/>
>>>>>> <messageFormatter contentType="application/json/badgerfish"
>>>>>> class="org.apache.axis2.json.JSONBadgerfishMessageFormatter"/>
>>>>>> <messageFormatter contentType="text/javascript"
>>>>>> class="org.apache.axis2.json.JSONMessageFormatter"/>
>>>>>>
>>>>>> and
>>>>>>
>>>>>> <messageBuilder contentType="application/json"
>>>>>> class="org.apache.axis2.json.JSONOMBuilder"/>
>>>>>> <messageBuilder contentType="application/json/badgerfish"
>>>>>> class="org.apache.axis2.json.JSONBadgerfishOMBuilder"/>
>>>>>> <messageBuilder contentType="text/javascript"
>>>>>> class="org.apache.axis2.json.JSONOMBuilder"/>
>>>>>>
>>>>>> Stoped the server and started again, No errors found :)
>>>>>>
>>>>>> But i'm i requesting it wrong ? The webservice call i'm making simple
>>>>>> adds response=aplication/json
>>>>>>
>>>>>>
>>>>>> http://entitas-d.corp.turismodeportugal.pt:9763/services/Entity.EntityHttpSoap12Endpoint/getCAE?id=A&agent=f28c4324-0dc3-531b-98f1-d3c00cc6a36c&response=text/json
>>>>>>
>>>>>> But the result still came in xml ( in Firefox and Chrome ). Any help ?
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> [1]
>>>>>> http://dist.wso2.org/maven2/org/apache/axis2/wso2/axis2-json/1.6.0-wso2v1/
>>>>>> [2]
>>>>>> http://dist.wso2.org/maven2/org/codehaus/jettison/wso2/jettison/1.0.1.wso2v1/
>>>>>>
>>>>>> 2010/10/14 Isuru Suriarachchi <is...@wso2.com>
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> On Wed, Oct 13, 2010 at 10:36 PM, Hiranya Jayathilaka <
>>>>>>> hira...@wso2.com> wrote:
>>>>>>>
>>>>>>>> Hi Victor,
>>>>>>>>
>>>>>>>> The jettison OSGi bundle can be downloaded from [1]. You can deploy
>>>>>>>> it into repository/components/dropins directory. Axis2 JSON jar can be
>>>>>>>> downloaded from [2]. This however is not an OSGi bundle. So you should 
>>>>>>>> copy
>>>>>>>> it into repository/components/lib.
>>>>>>>>
>>>>>>>
>>>>>>> It's even better if you can get [3] instead of above [2]. Because it
>>>>>>> is already an OSGi bundle and you can directly copy it into
>>>>>>> repository/components/dropins.
>>>>>>>
>>>>>>> Thanks,
>>>>>>> ~Isuru
>>>>>>>
>>>>>>> [3]
>>>>>>> http://dist.wso2.org/maven2/org/apache/axis2/wso2/axis2-json/1.6.0-wso2v1/
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Hiranya
>>>>>>>>
>>>>>>>> [1] -
>>>>>>>> http://dist.wso2.org/maven2/org/codehaus/jettison/wso2/jettison/1.0.1.wso2v1/
>>>>>>>> [2] - http://dist.wso2.org/maven2/org/apache/axis2/axis2-json/
>>>>>>>>
>>>>>>>> On Wed, Oct 13, 2010 at 9:21 PM, Vitor Rodrigues <
>>>>>>>> vitor.rodrig...@pessoaseprocessos.com> wrote:
>>>>>>>>
>>>>>>>>> Hi all,
>>>>>>>>>
>>>>>>>>> I use WSO2 WSAS for my Web services for a long time but today my
>>>>>>>>> boss wants the response of the webservices to be in JSON. I look up in
>>>>>>>>> google and your post:
>>>>>>>>> http://wso2.org/library/knowledge-base/add-json-support-wso2-wsas come
>>>>>>>>> up.
>>>>>>>>> But where are the OSGI bundles of the jars? I log in and didn't saw
>>>>>>>>> them attached to the post. Can someone provide them to me please?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> Carbon-dev mailing list
>>>>>>>>> Carbon-dev@wso2.org
>>>>>>>>> https://wso2.org/cgi-bin/mailman/listinfo/carbon-dev
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Hiranya Jayathilaka
>>>>>>>> Senior Software Engineer;
>>>>>>>> WSO2 Inc.;  http://wso2.org
>>>>>>>> E-mail: hira...@wso2.com;  Mobile: +94 77 633 3491
>>>>>>>> Blog: http://techfeast-hiranya.blogspot.com
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Carbon-dev mailing list
>>>>>>>> Carbon-dev@wso2.org
>>>>>>>> https://wso2.org/cgi-bin/mailman/listinfo/carbon-dev
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Isuru Suriarachchi
>>>>>>> Technical Lead & Product Manager, WSO2 Web Services Application
>>>>>>> Server
>>>>>>>
>>>>>>> WSO2 Inc. http://wso2.com
>>>>>>> email : is...@wso2.com
>>>>>>> blog : http://isurues.wordpress.com/
>>>>>>>
>>>>>>> lean . enterprise . middleware
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Carbon-dev mailing list
>>>>>>> Carbon-dev@wso2.org
>>>>>>> https://wso2.org/cgi-bin/mailman/listinfo/carbon-dev
>>>>>>
>>>>>>
>>>>>>  <https://wso2.org/cgi-bin/mailman/listinfo/carbon-dev>
>>>>>> <https://wso2.org/cgi-bin/mailman/listinfo/carbon-dev>
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Carbon-dev mailing list
>>>>> Carbon-dev@wso2.org
>>>>> https://wso2.org/cgi-bin/mailman/listinfo/carbon-dev
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Hiranya Jayathilaka
>>>> Senior Software Engineer;
>>>> WSO2 Inc.;  http://wso2.org
>>>> E-mail: hira...@wso2.com;  Mobile: +94 77 633 3491
>>>> Blog: http://techfeast-hiranya.blogspot.com
>>>>
>>>> _______________________________________________
>>>> Carbon-dev mailing list
>>>> Carbon-dev@wso2.org
>>>> https://wso2.org/cgi-bin/mailman/listinfo/carbon-dev
>>>>
>>>>
>>>
>>>
>>> --
>>> Sanjiva Weerawarana, Ph.D.
>>> Founder, Chairman & CEO; WSO2, Inc.;  http://wso2.com/
>>> email: sanj...@wso2.com; phone: +1 408 754 7388 x51726; cell: +94 77 787
>>> 6880 | +1 650 265 8311
>>> blog: http://sanjiva.weerawarana.org/
>>>
>>> Lean . Enterprise . Middleware
>>>
>>> _______________________________________________
>>> Carbon-dev mailing list
>>> Carbon-dev@wso2.org
>>> https://wso2.org/cgi-bin/mailman/listinfo/carbon-dev
>>
>>
>>  <https://wso2.org/cgi-bin/mailman/listinfo/carbon-dev>
>>
>
> _______________________________________________
> Carbon-dev mailing list
> Carbon-dev@wso2.org
> https://wso2.org/cgi-bin/mailman/listinfo/carbon-dev
>
>


-- 
Isuru Suriarachchi
Technical Lead & Product Manager, WSO2 Application Server
WSO2 Inc. http://wso2.com
email : is...@wso2.com
blog : http://isurues.wordpress.com/

lean . enterprise . middleware
_______________________________________________
Carbon-dev mailing list
Carbon-dev@wso2.org
https://wso2.org/cgi-bin/mailman/listinfo/carbon-dev

Reply via email to