Hi. I Have problem with this code which suppose to call web service operation through proxy server.
private static void startMeals() {
String message =
""
+" ";
HttpURLConnection uc = null;
URL url = null;
byte[] data = message.getBytes();
try {
url = new URL("http://saintbook.org/MightyMeals/MightyMeals.asmx");
Properties sysProps = System.getProperties();
sysProps.put( "proxySet", "true" );
sysProps.put( "proxyHost", "proxy.myproxy.com");
sysProps.put( "proxyPort", "3128" );
} catch (MalformedURLException e1) {
System.err.println("URL EXCEPTION");
e1.printStackTrace();
}
try {
uc = (HttpURLConnection) url.openConnection();
uc.setDoInput(true);
uc.setDoOutput(true);
uc.setUseCaches(false);
uc.setRequestProperty("Content-Length", " " + message.length());
uc.connect();
DataOutputStream dos = new DataOutputStream(uc.getOutputStream());
dos.write(data, 0, data.length);
dos.flush();
dos.close();
BufferedReader br = new BufferedReader(new InputStreamReader(uc
.getInputStream()));
String res = null;
while ((res = br.readLine()) != null)
System.out.println(res);
br.close();
} catch (IOException e) {
System.err.println("From client: " + e);
e.printStackTrace(System.out);
uc.disconnect();
System.err.println("Disconnected...");
}
}
And have following error:
From client: java.io.IOException: Server returned HTTP response code: 500 for URL:
http://saintbook.org/MightyMeals/MightyMeals.asmxjava.io.IOException: Server returned HTTP response code: 500 for URL:
http://saintbook.org/MightyMeals/MightyMeals.asmx
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1170)
at Starter.startMeals(Starter.java:63)
at Starter.main(Starter.java:28)
What could be wrong?