David Staudt | The IP Phone Services SDK has a JSP sample for Push2Phone. Unfortunately some of the helper classes haven't been updated to work with CM5+. The trick in your case is to add the Authorization header for basic auth: ------------------ String pushAuth = Text2Base64.getBase64(pushUserId + ":" + pushPassword); String pushXML = "<CiscoIPPhoneExecute>"; for (int i = 0; i < uris.length; i++) { pushXML = pushXML + "<ExecuteItem Priority=\"0\" URL=\"" + uris + "\"/>"; } pushXML = pushXML + "</CiscoIPPhoneExecute>"; StringBuffer response = new StringBuffer(); try { String httpData = "XML=" + URLEncoder.encode(pushXML); System.out.println("xml="+httpData); URL url = new URL("http://" + phoneIP + "/CGI/Execute"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoInput(true); conn.setDoOutput(true); conn.setRequestMethod("POST"); conn.setFollowRedirects(getResult); conn.setRequestProperty("Content-type", "application/x-www-form-urlencoded"); conn.setRequestProperty("Authorization", "Basic " + pushAuth); PrintWriter pout = new PrintWriter(new OutputStreamWriter(conn. getOutputStream()), true); pout.print(httpData); pout.flush(); |
| Please sign in to flag this as inappropriate. |