axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Freitag <Jan_Frei...@gmx.de>
Subject Re: How to Use JSON Objects in a Web Service
Date Fri, 12 Dec 2008 16:57:35 GMT
Hi,

I want to write the web service with plain Axis2, but I'm open for  
other solutions. Here is an example request and response from the  
geolocation api:

Gears Request


{
   "version": "1.1.0",
   "host": "maps.google.com",
   "access_token": "2:k7j3G6LaL6u_lafw:4iXOeOpTh1glSXe",
   "home_mobile_country_code": 310,
   "home_mobile_network_code": 410,
   "radio_type": "gsm",
   "carrier": "Vodafone",
   "request_address": true,
   "address_language": "en_GB",
   "location": {
     "latitude": 51.0,
     "longitude": -0.1
   },
   "cell_towers": [
     {
       "cell_id": 42,
       "location_area_code": 415,
       "mobile_country_code": 310,
       "mobile_network_code": 410,
       "age": 0,
       "signal_strength": -60,
       "timing_advance": 5555
     },
     {
       "cell_id": 88,
       "location_area_code": 415,
       "mobile_country_code": 310,
       "mobile_network_code": 580,
       "age": 0,
       "signal_strength": -70,
       "timing_advance": 7777
     }
   ],
   "wifi_towers": [
     {
       "mac_address": "01-23-45-67-89-ab",
       "signal_strength": 8,
       "age": 0
     },
     {
       "mac_address": "01-23-45-67-89-ac",
       "signal_strength": 4,
       "age": 0
     }
   ]
}

Server Response


{
   "location": {
     "latitude": 51.0,
     "longitude": -0.1,
     "altitude": 30.1,
     "accuracy": 1200.4,
     "altitude_accuracy": 10.6,
     "address": {
       "street_number": "100",
       "street": "Amphibian Walkway",
       "postal_code": "94043",
       "city": "Mountain View",
       "county": "Mountain View County",
       "region": "California",
       "country": "United States of America",
       "country_code": "US"
     }
   },
   "access_token": "2:k7j3G6LaL6u_lafw:4iXOeOpTh1glSXe"
}

Greets,

JF

Am 12.12.2008 um 17:44 schrieb keith chapman:

> I'm not familiar with the Geolocation API. Could you post a sample  
> request and response message (or JSON objects) for this scenario.
>
> No you do not need to start from WSDL. you could use Java code if  
> you wanna use plain Axis2 or you could alternatively use the WSO2  
> Mashup Server [1] and write your service using JavaScript.
>
> Thanks,
> Keith.
>
> [1] http://wso2.org/projects/mashup
>
> On Fri, Dec 12, 2008 at 10:08 PM, Jan Freitag <Jan_Freitag@gmx.de>  
> wrote:
> Hi,
>
> thank you for the answer. I've seen your blog before, but I don't  
> know how to start. Should I start to implement my web service (with  
> java) or should i write the wsdl file? I don't know where i can  
> configure the rquest format for the JSOn object. The Geolocation Api  
> tells me how the JSOn Request Objects look like, but I'm to new to  
> Web Services and Axis and JSON to find where I can start.
>
> Perhaps you have som tips how I can start to implement the  web  
> Service?
>
> Do you know the Geolocation API ?
>
> Greets
>
> JF
>
> Am 12.12.2008 um 13:44 schrieb keith chapman:
>
>> These links might help you. [1] and [2].
>>
>> Thanks,
>> Keith.
>>
>> [1] http://www.keith-chapman.org/2008/09/enabling-json-in-apache-axis2.html
>> [2] http://www.keith-chapman.org/2008/09/invoking-mashups-using-json.html
>>
>> On Fri, Dec 12, 2008 at 5:27 PM, Jan Freitag <jan_freitag@gmx.de>  
>> wrote:
>> Hi,
>>
>> I'm trying to implement a Web Service that gets as Request JSON
>> Objects ( I try to write my own Location Proivder Service for the
>> Google Gears Geolocation API). I want to write these JSOn Objects  
>> on a
>> HTML page to display them and I want to create a response to the JSOn
>> Request that is also a JSON Response.
>>
>> When you know how I can use JSON Objects out of the Request and
>> respond also as JSOn let me know. I looked at the Yahoo example but  
>> it
>> did not helped me enough.
>>
>> Greets.
>>
>> JF
>>
>>
>>
>> -- 
>> 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


Mime
View raw message