2

i am writing a simple program to translate convert korean text entered to english i am using microsoft-translator-java-api-0.6.1-jar for tha. even tried it with google translate API and getting the same issue i.e. unkownHostException

here is the servlet code of the post method

     String koreanText=request.getParameter("koreanText");

    System.out.println(koreanText);
    System.setProperty("http.proxyHost", "proxy");
    System.setProperty("http.proxyPort", "8080");
    Translate.setClientId("client id");
    Translate.setClientSecret("client secret");




   System.out.println(Language.KOREAN);
   System.out.println(koreanText);
try {
    **String translatedText = Translate.execute(koreanText, Language.KOREAN, Language.ENGLISH)**;

    System.out.println(translatedText);

} catch (Exception e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

the place where am getting the exception is ** marked

user1643087
  • 643
  • 1
  • 6
  • 11

1 Answers1

0

I assume you have put the proxy system properties there because you need to go through a proxy to access external web services? Check it is working by reading some bytes from a URL in the java code.

matt burns
  • 24,742
  • 13
  • 105
  • 107