- First step is to download the certificate for the site, but the InstallCert.java is no available on Oracle blog, instead i had to download it from here
- The next step is to compile the InstallCert.java by executing
javac InstallCert.java
- One issue in using the trust store with Mule is that the password for the trust store file should be not null. So i had to execute the InstallCert command with changeit as password (same as oracle java's default password) like this
java InstallCert wpcertification.blogspot.com changeit
- After executing last step you should see
jssecacerts
file in your local directory, that is your trust store file -
Next step is to create a HTTP connector in mule and while configuring go to security tab, check Enable HTTPS and configure the trust store to point to the
jssecacerts
file created in the last step and usechangeit
as password - Last step is to add HTTP call in your flow, while adding that call use the HTTP connector that you configured in the previous step
- Now you can go ahead and test the flow and you should be able to make HTTPS call
Showing posts with label mule. Show all posts
Showing posts with label mule. Show all posts
Making HTTPS outbound calls from mule
In the Getting markup from HTTPS connection in Java program entry i talked about how to make HTTPS call from stand alone java application. Recently i had to figure out how to make HTTPS call from Mule as part of flow, and these are the steps that i followed
Using Mule to get Geo Code for address
For last few days i am playing around with Mule, its really cool integration framework. You can use it to build integration applications by using small amount of code. I had this requirement where given address i wanted to get the Geo Coding information for that address, I wanted to use Google Maps API for getting GeoCode information for the address.
The way Google Maps API works is it has a REST API, it takes address as query string and it returns JSON structure. Ex. If you copy paste this URL in the browser
http://maps.googleapis.com/maps/api/geocode/json?address=3055 Oak Road,Walnut Creek,CA,94597&sensor=false
You will get a JSON structure with longitude and latitude embedded in lot of other information
{
"results" : [
{
"address_components" : [
{
"long_name" : "3055",
"short_name" : "3055",
"types" : [ "street_number" ]
},
{
"long_name" : "Oak Road",
"short_name" : "Oak Rd",
"types" : [ "route" ]
},
{
"long_name" : "Walnut Creek",
"short_name" : "Walnut Creek",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Contra Costa County",
"short_name" : "Contra Costa County",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "California",
"short_name" : "CA",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "United States",
"short_name" : "US",
"types" : [ "country", "political" ]
},
{
"long_name" : "94597",
"short_name" : "94597",
"types" : [ "postal_code" ]
}
],
"formatted_address" : "3055 Oak Road, Walnut Creek, CA 94597, USA",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 37.9302338,
"lng" : -122.0582288
},
"southwest" : {
"lat" : 37.9302299,
"lng" : -122.0582466
}
},
"location" : {
"lat" : 37.9302299,
"lng" : -122.0582466
},
"location_type" : "RANGE_INTERPOLATED",
"viewport" : {
"northeast" : {
"lat" : 37.93158083029149,
"lng" : -122.0568887197085
},
"southwest" : {
"lat" : 37.9288828697085,
"lng" : -122.0595866802915
}
}
},
"types" : [ "street_address" ]
}
],
"status" : "OK"
}
Out of all the data returned by Google MAPS api i am only interested in the Lat and Long and i want to return it in GeoJSON format like this
[
-122.0582466,
37.9302299
]
Which is [lng,lat]
format, some open source JavaScript Mapping frameworks understand the GeoJSON format.
I built a simple Mule integration application which takes STREETLINE1, CITY, STATE, ZIPCODE as argument and returns geo location in GeoJSON format like this [lng,lat]
. I followed these steps to build the application
- First i built a Mule Flow which looks like this In this flow i have a composite input source that could take input on either VM transport or HTTP transport and then uses the values submitted by user to make a request to Google Maps API. Once the response is returned it uses DataMapper to convert the big response that Google Maps API returns into simple GeoJSON response.
- This is how the Data Mapping file looks like If you look at the script of this file it looks like this
Subscribe to:
Posts (Atom)