cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to call assign workflow

veena16
Champ in-the-making
Champ in-the-making
Hi all,

I have taken RemoteClient Java file, to call alfresco services and get the responce.

I tried with this service "http://localhost:8080/alfresco/service/api/login?u=admin&pw=admin" , I got the xml response as Ticket.

Next, I would like to access assign workflow service like below code……..

    String st2 = "http://localhost:8080/alfresco/service/slingshot/doclib/action/assign-workflow?alf_ticket='+ticket+";
   
    RemoteClientTest rct1 = new RemoteClientTest(st2);
    rct1.setRequestMethod(HttpMethod.POST);
    Map<String, String> requestProperties = new HashMap<String, String>();
    requestProperties.put("date",
                          "Wed Feb 08 2012 00:00:00 GMT+0530 (India Standard Time)");
    requestProperties.put("description", "success");
    requestProperties.put("nodeRefs",
                          "workspace://SpacesStore/5a782342-e2c2-434b-a169-75f1808ab46c");
    requestProperties.put("people", "admin");
    requestProperties.put("id", "Ask Flow.doc");
    requestProperties.put("type", "wf:review");
    rct1.setRequestProperties(requestProperties);
    rct1.endpoint = st2;
    resp = rct1.call(st2);

  I'm getting empty response…..

Please tell me any wrong in the code and need to pass more parameters….suggest me.

And also……

  Can anyone tell me, how to access alfresco webservices from other web application using normal javascript(using jquery) or java file. Could please provide   sample application(not using surf implememtation)

Thank you a lot in advanced
Regards,
2 REPLIES 2

jpotts
World-Class Innovator
World-Class Innovator
I don't know what that RemoteClient class is. Is that something you wrote? Also, I don't know what version of Alfresco you are using, so I'll assume 3.2 as that is what is set on your forum user profile.

Note that the assign-workflow web script expects JSON. Maybe the RemoteClient class you are using translates that parameters Map into a JSON object. If so, that's good. You also need to make sure that the content-type header is being set to application/json or the web script won't be invoked for your post.

You may already be aware of this, but the controller for the web script you are trying to call lives in $TOMCAT_HOME/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/assign-workflow.js. You can inspect that to see what the controller is expecting.

Another approach to figuring this out is to turn on the Rhino JavaScript debugger and set a breakpoint. Then, use Share to assign a workflow. You can then inspect the object as it is passed in to the controller. Alternatively, you could use Firebug or your browser's developer console to debug the client-side JavaScript so that you can see the structure of the object as it is passed to the server.

The last question in your post is really about making AJAX calls and is not specific to Alfresco. Look at the JQuery documentation to figure out how to do that.

Hope that helps,

Jeff

ddraper
World-Class Innovator
World-Class Innovator
I'm assuming you're referring to the Surf class: org.springframework.extensions.webscripts.connector.RemoteClient ?  Are you actually doing anything specific with this class because by the looks of the rest of your post you're just using the WebScript service context to access repository WebScripts. The "slingshot" WebScript you're referenced is specifically designed to be used by the Share application though, so I'm not entirely sure what you're expecting, however using FireBug or Web Developer Tools you should be able to see all the parameters that are passed when Share uses this REST call.

The fact that you're not getting a 401 response at least indicates that whatever you're doing you're authenticating correctly whatever it is you're doing. A bit more information may help us to help you,

Regards,
Dave