Download java class and required jar files from following URL
Consuming Liferay Json Web Service
Consuming Liferay Json Web Service
1) Write
fooling java program in your java project.
public static void main(String[] args) throws ClientProtocolException, IOException {
ArrayList<HashMap<String,
String>>mylist = new ArrayList<HashMap<String,
String>>();
//Get the data
(see above)
HttpHost
targetHost = new HttpHost("localhost", 8080, "http");
DefaultHttpClient
httpclient = new DefaultHttpClient();
httpclient.getCredentialsProvider().setCredentials(new AuthScope(targetHost.getHostName(), targetHost.getPort()),new UsernamePasswordCredentials("test@liferay.com", "test"));
AuthCache authCache = new BasicAuthCache();
BasicScheme basicAuth
= new BasicScheme();
authCache.put(targetHost,
basicAuth);
BasicHttpContext ctx =
new BasicHttpContext();
//ctx.setAttribute(ClientContext.AUTH_CACHE,authCache);
HttpPost post = new HttpPost("/tunnel-web/secure/json");
List<NameValuePair>
params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("serviceClassName", "com.liferay.portal.service.CountryServiceUtil"));
params.add(new BasicNameValuePair("serviceMethodName", "getCountries"));
params.add(new BasicNameValuePair("serviceParameters", "[]"));
UrlEncodedFormEntity
entity = new UrlEncodedFormEntity(params, "UTF-8");
post.setEntity(entity);
HttpResponse resp =
httpclient.execute(targetHost, post, ctx);
resp.getEntity().writeTo(System.out);
httpclient.getConnectionManager().shutdown();
}
}
|
2) Compile and Run the java program using dos
command prompt or using eclipse.
3) See
the console you will get the all Countries data in the json format.
Following are the required Jar
files
commons-codec-1.7.jar
httpclient-4.1-beta1.jar
|
Add above jar file in your project build path. these are required to compile and run the the java client program.
it's far profitable analyzing this blog. i was looking such kind of blog for a long time however now I assume I had been given a weblog of my interest. i'm thankful for those all hints noted beneath this weblog. Avaya Cloud
ReplyDeleteAn excellent web design should not only be visually appealing but alsopowerful concerning achieving the goals of the site. If you're also one
ReplyDeletesearching for the best web design business in India then think about Webtids.online
If your organization wants a responsive, beautiful website, give us acall today! Make sure you aren't sold on an organization, only to discover they
ReplyDeleteare likely to outsource your design and coding to somebody else.web design singapore
I genuinely enjoyed this. It was incredibly educational and useful. I will return to examine on upcoming posts web design manhattan
ReplyDeleteOh my goodness! an amazing article dude. Thanks Nevertheless I am experiencing concern with ur rss . Don’t know why Unable to subscribe to it. Is there anybody getting an identical rss downside? Anyone who is aware of kindly respond. Thnkx new york website design company
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteHi, you used to write excellent articles, but the last several posts have been kinda boring… I miss your tremendous posts. Past few posts are just a little out of track! san francisco brand agency
ReplyDeletecx
ReplyDeleteHi to everybody, here everyone is sharing web design agencies such knowledge, so it’s fastidious to see this site, and I used to visit this blog daily.
ReplyDeletewonderful post, very informative. I wonder why the other experts of this sector do not notice this. You must continue your writing. I’m sure, you’ve a great readers’ base already! see
ReplyDeleteHeya i’m for the first time here. I found this board and I to find It truly helpful & it helped me out a lot. I hope to provide something back and aid others such as you helped me. website design san francisco
ReplyDeleteWe cater to all levels of site development from small business sites to large e-commerce websites. web development agency in usa
ReplyDeleteI’m having a small problem. I’m unable to subscribe to your rss feed for some reason. I’m using google reader by the way. web design agency san francisco
ReplyDeleteThe actual challenge to become is normally you can actually SOLE check out that level of your tax discount over the internet by looking at your RATES web-site. website designers san francisco
ReplyDeleteI really like your site.. excellent colorations & motif. Would people design and style this fabulous website your self or would you actually hire an attorney to acheive it available for you? Plz answer while I!|m trying to style my own website and would choose to learn wherever ough acquired the following coming from. thank you web design agency san francisco
ReplyDeleteThanks for the tips you have provided here. One more thing I would like to mention is that laptop memory requirements generally increase along with other breakthroughs in the engineering. For instance, as soon as new generations of processors are introduced to the market, there is usually a matching increase in the shape demands of all computer system memory plus hard drive room. This is because the application operated by these cpus will inevitably boost in power to leverage the new engineering. design agency san francisco
ReplyDeleteNice blog. Fine theme except of footer. I really like this post. It`s amazing what you wrote here. I hope you will write something so amazing soon. web design company san francisco
ReplyDeleteVery efficiently written information. It will be beneficial to anybody who utilizes it, including me. Keep up the good work. For sure i will check out more posts. This site seems to get a good amount of visitors. Javascript Commission Bot Review
ReplyDeleteMusic started playing anytime I opened up this web-site, so irritating! la web design
ReplyDeleteColin Ferrell and Jennifer Aniston step out of their usual roles and surprisingly deliver plenty of laughs with their own cruelly aggressive mannerisms. web design agency los angeles
ReplyDeletei just started dating and well, dating is a very exciting experience. i just love to date women** web design company los angeles
ReplyDeleteI’m not sure exactly how I discovered your blog because I had been researching information on Real Estate in Lake Mary, FL, but anyway, I have had a pleasant time reading it, keep it up! design firms los angeles
ReplyDeleteI love your wp format, where did you get a hold of it? website tips
ReplyDeletebless you with regard to the particular blog post ive really been looking with regard to this kind of advice on the net for sum time these days hence with thanks web design company
ReplyDeletei always look for golf courses with well-maintained lawn and golf courses with very clean recreational area,, los angeles branding
ReplyDeleteBig thanks to you for sharing such great information.industrial ui services
ReplyDeleteeCommerce Website Designers who are 100% Australian developers from Website Development Australia. We build high performing eCommerce websites. ecommerce
ReplyDeleteShare great information about your blog , Blog really helpful for us . We read your blog , share most useful information in blog . Thanks for share your blog here .
ReplyDeleteHomeowners association website
While the admin of the web site is working, no question soon it will likely be famous, due to its feature blogs.
ReplyDeletepremium corporate gifts
Thanks for the blog loaded with so many information. Stopping by your blog helped me to get what I was looking for. wordpress developers
ReplyDeleteThank you for another great article. Where else could anyone get that kind of information in such a perfect way of writing? I have a presentation next week, and I am on the look for such information. web design in Switzerland
ReplyDeleteDownload All Movie Subtitles Here for Hollywood, Bollywood and all kinds of movies. Download English SRT Subtitles Here subtitleplanet.com
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteI have found your article very informative and interesting. I appreciate your points of view and I agree with so many. You’ve done a great job with making this clear enough for anyone to understand.
ReplyDeletedigital marketing agency near me
I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article. Epik-protocolEPIK
ReplyDeleteThis appears undeniably remarkable. All of these very small facts are constructed choosing large selection about qualifying measures know-how. Document gift a good deal quite a lot. web design company denver
ReplyDeleteI am happy to find your distinguished way of writing the post. Now you make it easy for me to understand and implement the concept. Thank you for the post. edge apps
ReplyDeleteThank you for your informative article, I have been doing research on this subject, and for three days I keep entering sites that are supposed to have what I am searching for, only to be discouraged with the lack of what I needed. create a dropshipping website
ReplyDeleteI really like your writing style, good information, appreciate it for posting . POS Software in UK
ReplyDeleteAs a rule, the shopping trips come full circle into a bad dream, with not all that arranged and chaotic extravagance at the customers end. 'Web based shopping' on other hand is one where you actually have a controlled shopping climate and thusly, similarly lesser odds of rampage spending and lamenting, later on. By the by, the burdens that go with are as essential to the customers. besimple.com/
ReplyDeleteSuch a very useful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. Webdesign
ReplyDeleteNonetheless, while employing a specialist, there are a couple of things you should know to safeguard that you select the most ideal consultant and that your venture is finished agreeable to you. Professional graphic design
ReplyDeleteI recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often. ICAR Webmail
ReplyDeleteGreat survey, I'm sure you're getting a great response. The useless web
ReplyDeleteYou made such an interesting piece to read, giving every subject enlightenment for us to gain knowledge. Thanks for sharing the such information with us to read this... photographe
ReplyDeleteI am happy to find this post Very useful for me, as it contains lot of information. I Always prefer to read The Quality and glad I found this thing in you post. Thanks cuevana peliculas on line
ReplyDeleteCustom web design is for business owners who want to stand out from the rest by spending more time refining their branded messaging, visual brand, and customer experience. cheap professional website design
ReplyDeleteBe that as it may, as I told prior, everybody can't design the website. Website Design Agency
ReplyDeleteWow! Such an amazing and helpful post this is. I really really love it. It's so good and so awesome. I am just amazed. I hope that you continue to do your work like this in the future also sviluppo siti web
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteWhat is an outstanding post! “I’ll be back” (to read more of your content). Thanks for the nudge! freelance sites like fiverr
ReplyDeleteI would not purchase web hosting services from a company who does not offer at least a 30 day money back guarantee, unless they have proven themselves to be a leader in the industry and have an excellent reputation. ssd vps hosting
ReplyDeleteWeb 2.0 applications are the most recent pattern in website design . Webdesign Genk
ReplyDeletePositive site, where did u come up with the information on this posting? I'm pleased I discovered it though, ill be checking back soon to find out what additional posts you include. Webdesign SEO Antwerpen
ReplyDeleteTook me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also entertained! Webdesign
ReplyDeleteThank you for the update, very nice site.. Webdevelopment
ReplyDeletePositive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work. Webdesign bureau
ReplyDeleteWhen your website or blog goes live for the first time, it is exciting. That is until you realize no one but you and your. WordPress Developer Brisbane
ReplyDeleteHello, this weekend is good for me, since this time i am reading this enormous informative article here at my home.
ReplyDeletequenza app
Thank you because you have been willing to share information with us. we will always appreciate all you have done here because I know you are very concerned with our. pay monthly web design
ReplyDelete