cancel
Showing results for 
Search instead for 
Did you mean: 

webscript for publishing content

hanu
Champ in-the-making
Champ in-the-making
Hi,

How to call webscript for publishing assets from java. I nee to do to it programatically.  I tried with the following code.
Please suggest me anyone have idea on this.

HttpClient pubClient = new HttpClient();           
            pubClient.getState().setCredentials(new AuthScope("localhost", 8080, "Alfresco"),new UsernamePasswordCredentials("admin", "admin"));
              PostMethod puPost = new PostMethod("http://localhost:8080/alfresco/service/api/wcm/webprojects/Content/sandboxes/Content--admin/submitte...");
              //PostMethod puPost = new PostMethod("http://localhost:8080/alfresco/service/api/wcm/webprojects/Content/sandboxes/Content--admin/admin");
              puPost.setDoAuthentication( true );
                          
              JSONObject myObject = new JSONObject();
              myObject.put("label", "Publish");
           myObject.put("comment", "Publish IRSContent");
           myObject.put("all", "true");
           myObject.put("assets", "");
           myObject.put("paths", "");
            puPost.addParameter("store", "IRSContent–admin");
              puPost.addParameter("json", myObject.toString());
             
              String resultString="";
            try {
               int status = pubClient.executeMethod( puPost );
              System.out.println("status is:"+status);
               resultString = puPost.getResponseBodyAsString();
               System.out.println("result string is:"+resultString);
            }
1 REPLY 1

romschn
Star Collaborator
Star Collaborator
If you could let me know what are you trying to achieve here, it would help to provide you any solution if I can.

Publish content from authoring server to delivery server or publish content from user sandbox to staging sandbox?

Thanks,