August 03, 2018

How to use xml x-www-form-urlencoded and logging in okhttp

How to use xml x-www-form-urlencoded and logging in okhttp

/**
* Consumerfed IT Section Kozhikode
*/

private String okhttpPost(String xmlRequest) {

String responseStr = null;
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
logging.setLevel(Level.BASIC);
OkHttpClient client = new OkHttpClient().newBuilder().addInterceptor(logging).connectTimeout(60, TimeUnit.SECONDS).writeTimeout(60, TimeUnit.SECONDS).readTimeout(60, TimeUnit.SECONDS).build();
RequestBody formBody = new FormBody.Builder().add("XML", xmlRequest).build();
Request request = new Request.Builder().url("https://consumerfed/itsection/findData").post(formBody).addHeader("Content-Type", "application/x-www-form-urlencoded")
.addHeader("Connection", "Keep-Alive").addHeader("Accept-Language", "en-US").addHeader("Accept-Encoding", "application/gzip").build();
try {Response response = client.newCall(request).execute();
if (response.isSuccessful()) {
responseStr = response.body().string();}} catch (IOException exception) {
exception.printStackTrace();}
return responseStr;
}

InterruptedIOException



java.io.InterruptedIOException: thread interrupted
at okio.Timeout.throwIfReached(Timeout.java:145)
at okio.Okio$1.write(Okio.java:75


okhttp will check whether current running is interrupted. so check the main thread, why the main thread is interrupted , may be you have to increase the waiting time of that thread

13 comments:

  1. He forms the enjoyable and informative articles related to Web Design Company
    and SEO Company in the UK. They do their level
    best to make a site attractive and beautiful. asia expert in providing website designing, website development, seo services, website hosting, digital marketing services and offering professional readymade scripts without any hesitation work and these Yourneeds.

    ReplyDelete
  2. They mainly put their efforts in making space at the page by designing
    locations of everything, including navigation bars, search box and all.
    They would try to make your site famous through social networking
    sites like my space, Facebook, Twitter, Digo, Digg, Delicious, etc as a
    part of their SEO services London. By using a service that can provide you will all of the various choices, you will save time and money getting online and noticed.

    ReplyDelete
  3. It is just the process of making specific search phrases, that are relevant to your website visible
    high up in the search engine rankings. The company can provide online businesses with the means to
    reach goals and achieve greatly. You need to check that they are qualified accountants as many will not be.

    ReplyDelete
  4. Some SEO companies may only offer basic professional SEO services.

    It provides flexible operating here we are at the employees and
    one can have pretty large wage along with the appropriate spare time.
    Many organisations are finding that they have a better outcome when they employ a service to perform their London web design as well as Facebook development and social media UK options.

    ReplyDelete
  5. It is just the process of making specific search phrases, that are relevant to your website
    visible high up in the search engine rankings. They would try to make your site famous through
    social networking sites like my space, Facebook, Twitter, Digo, Digg, Delicious, etc as a part of
    their SEO services London. Many organisations are finding that they have
    a better outcome when they employ a service to perform their London web
    design as well as Facebook development and social media UK options.

    ReplyDelete
  6. It is just the process of making specific search phrases, that are relevant to your website visible high
    up in the search engine rankings. They do their level best to make a site attractive and beautiful.
    You can get the contact details of the various seo companies by
    surfing around the globally web and create sure that you go through details of the training organization successfully before you
    be a part of your name for having a bright profession ahead.

    ReplyDelete
  7. You will draw more loyal readers to your site and keep your readers coming back because you are sharing the
    best with them. They would try to make your site famous through
    social networking sites like my space, Facebook,
    Twitter, Digo, Digg, Delicious, etc as a part of their
    SEO services London. This means that all of the content that your users can see,
    including buttons, menus and clickable links will be index-able.

    ReplyDelete
  8. He forms the enjoyable and informative articles related
    to Web Design Company and SEO Company in the UK.

    It provides flexible operating here we are at the employees and one can have pretty
    large wage along with the appropriate spare time.

    asia expert in providing website designing, website development,
    seo services, website hosting, digital marketing services and offering professional readymade
    scripts without any hesitation work and these
    Yourneeds.

    ReplyDelete
  9. AnonymousMay 14, 2019

    So sites with excellent quality content become valuable to search engines.
    The company can provide online businesses with the means to reach goals and achieve greatly.

    But if you are not, then you have to create a distinct identity for your business.

    ReplyDelete
  10. AnonymousMay 26, 2019

    It is just the process of making specific search phrases, that are relevant
    to your website visible high up in the search engine rankings.
    The company can provide online businesses with the means to reach goals and achieve greatly.
    Whether you promote yourself as a solo or business brand (< learn 10 ways to improve your SEO with Google+) Google+ is now a necessity.

    ReplyDelete
  11. AnonymousJuly 01, 2019

    Some SEO companies may only offer basic professional SEO services.
    They would try to make your site famous through social networking
    sites like my space, Facebook, Twitter, Digo, Digg, Delicious, etc as a part of their
    SEO services London. You need to check that they are qualified accountants as many will not be.

    ReplyDelete
  12. AnonymousJuly 08, 2019

    It is just the process of making specific search phrases, that are relevant to your website
    visible high up in the search engine rankings. It provides flexible operating here we are at the employees and one can have pretty large wage along with the appropriate spare time.

    Whether you promote yourself as a solo or business brand (< learn 10 ways to improve your SEO with Google+) Google+ is now a necessity.

    ReplyDelete
  13. So, additional efforts have to be undertaken to develop the visiting page of your website.

    Typically, it's good practice to maintain about a 5% usage for your keywords or phrases.

    While it may take a little while for changes in design culture to filter out into the more
    remote regions of the UK, London because of its position as the
    capital city gets to see new concepts first, thanks to a plethora of
    exhibitions and shows dedicated to web design.

    ReplyDelete

Your feedback may help others !!!

Facebook comments