I am trying to use the IBM Connection API and want to stop one user after profile with the following API .
I'm getting a "400 bad request" error.
Public class StopProfile {public static zero main (string [] args) {try {SocketFactory factory = SSLSocketFactory.getDefault (); Socket socket = factory.cent socket ("greenhouse.lotus.com", 443); OutputStreamWriter Out = New OutputStream Water (socket .getOutputStream (), "UTF8"); Out.written ("post / profile / follow-up / atom / resource? Source = profile http / 1.1 \ r \ n"); Out.written ("HOST: server name \ r \ n"); String Encoding = New String (base 64. Exodbase 64 ("Username: Password" .getBytes ()); Out.written ("authorization: basic" + encoding + "\ r \ n"); String Data = "& lt; Entry xmlns = \" http: //www.w3.org/2005/Atom \ "xmlns: AP = \" http: //www.w3.org/2007/app \ "xmlns: SNX = \ "Http: //www.ibm.com/xmlns/prod/sn \" & gt; \ n "+" Category duration = \ "resource-follow-up \" plan = \ "http: / /www.ibm .com / xmlns / prod / sn / type \ "& gt; & lt; / category & gt; \ n" + "& lt; Category duration = \" Profile \ "scheme = \" http: //www.ibm.com/xmlns/ Prod / sn / source \ "& gt; & lt; / category & gt; \ n" + "& lt; Category Period = \" Profile \ "plan = \" http : //www.ibm.com/xmlns/prod/sn/resource-type \ "& gt; & lt; / category & gt; \ n" + "Category duration = \" 4f520868-ac2a-40bd -98da-a24e5227f529 \ "Plan = \" http://www.ibm.com/xmlns/ Prod / sn / Sons Money-ID \ "& gt; & lt; / category & gt; \ n" + "& lt; / Entry & gt;"; outside. Type ("content-length:" + data. Length () + "\ r \ n"); Out.write ("content-type: application / atom + xml; charset = UTF-8 \ r \ n"); Out.write ("\ r \ n"); Out.write (data); Out.flush (); BufferedReader = new in BufferedReader (new InputStreamReader (socket.getInputStream ())); String line; While ((line = r. rummy ()) = null) {System.out.println (line); }} Hold (exception e) {System.out.println ("exception" + e); }}}
No comments:
Post a Comment