Moderator: ScalixSupport
Code: Select all
String serverURL = "https://host/api/username@domain/mailbox/Calendar";
try {
java.net.URLConnection conn;
java.net.URL url;
try {
url = new URL(serverURL);
conn = url.openConnection();
// Try to open the connection...
conn.addRequestProperty("Content-Type", "text/calendar");
conn.addRequestProperty("Authorization", "Basic "
+ HttpUtils.basicAuth(userName, password)); // Uses Base64 encoding
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setUseCaches(false); // ensure up-to-date from server;
conn.connect();
} catch (IOException e) {
...
}
PrintWriter pw = new PrintWriter(new OutputStreamWriter(conn.getOutputStream())); // HERE'S WHERE IT BREAKS: CAN'T SEEM TO GET
// AN OUTPUTSTREAM PROPERLY
writeEvent(pw, a);
pw.println();
pw.close();
...
} catch (IOException e) {
throw new RuntimeException("IO Error", e);
}
Code: Select all
{ Error | 2009-08-06 09:50:14.962 | } hdu Unable to store user's response (found below) to service request.:java.lang.RuntimeException: IO Error
{Stack Trace
java.lang.RuntimeException: IO Error
at tcp.caleventservice.CalendarEventServiceScalixImpl.enterEvent(CalendarEventServiceScalixImpl.java:78)
...
Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: http://mail2.X.ca/api/dav/Mailstore/tgcore@X.ca/Calendar
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1290)
at tcp.caleventservice.CalendarEventServiceScalixImpl.enterEvent(CalendarEventServiceScalixImpl.java:65)
... 45 more
}
Code: Select all
2009-08-06 ... WARN [PlatformDispatcherServlet.service:83] Problem processing request method=POST URI=/api/user@domain/mailbox/Calendar
Code: Select all
url = new URL(URL);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
...
conn.setRequestMethod("POST");
System.out.println(conn.getRequestMethod()); // prints "POST"
Code: Select all
2009-08-06 ... WARN [PlatformDispatcherServlet.service:83] Problem processing request method=POST URI=/api/user@domain/mailbox/Calendar
Code: Select all
String serverURL = "https://mail2.X.ca/api/tgcore@mail2.X.ca/mailbox/Calendar";
try {
java.net.HttpURLConnection conn;
java.net.URL url;
url = new URL(serverURL);
conn = (HttpURLConnection) url.openConnection();
// Try to open the connection...
conn.addRequestProperty("Content-Type", "text/calendar");
conn.addRequestProperty("Authorization", "Basic "
+ HttpUtils.basicAuth(userName, password)); // Uses Base64 encoding
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setUseCaches(false); // ensure up-to-date from server;
conn.setRequestMethod("POST");
conn.connect();
PrintWriter pw = new PrintWriter(new OutputStreamWriter(conn.getOutputStream()));
writeEvent(pw, a);
pw.println();
pw.close();
} catch (IOException e) {
throw new RuntimeException("IO Error", e);
}
Return to “Scalix Messaging Services”
Users browsing this forum: No registered users and 1 guest