AnsweredAssumed Answered

Posting a folder results in a document without content

Question asked by mgagnon on Jan 11, 2010
Latest reply on Jul 5, 2012 by jpotts
I've seen a few posts with this same problem.  I'm trying to create a folder but instead it creates a document.

In the related posts they solved their problem by changing the namespace in the xml

I tried that but no-go.  Any help would be appreciated.

Here is my post code

    public void PostInfo()
        StringWriter sw = new StringWriter();
        PrintWriter  pw = new PrintWriter(sw);
          String xmlData = "<?xml version='1.0' encoding='utf-8'?>"+
          "<entry xmlns='' xmlns:app='' xmlns:cmis='' xmlns:alf=''>"+
          "<cmis:propertyId cmis:name='ObjectTypeId'><cmis:value>folder</cmis:value></cmis:propertyId>"+
          String href = "";
          URL url = new URL (href);   
          String userPassword = "admin:admin";   
           // Encode String
            String encoding = new sun.misc.BASE64Encoder().encode (userPassword.getBytes());
           // Need to work with URLConnection to set request property
            URLConnection uc = url.openConnection();
              uc.setDoInput(true); //Only if you expect to read a response…
           //   uc.setUseCaches(false); //Highly recommended…
            //uc.setRequestProperty("Content-Type", "application/atom+xml");
              uc.setRequestProperty("Content-Type", "application/atom+xml;type=entry");
            uc.setRequestProperty  ("Authorization", "Basic " + encoding);
            OutputStreamWriter out = new OutputStreamWriter(uc.getOutputStream());
            BufferedReader in = new BufferedReader(
                  new InputStreamReader(
            String decodedString;
            while ((decodedString = in.readLine()) != null) {
          catch (MalformedURLException e)
          pw.println ("Invalid URL");
          catch (Exception e)
          System.out.println ("Error reading URL"+e.getMessage());