K2 BlackPearl REST Services

  • 6 September 2011
  • 6 replies
  • 4 views

Badge +3

Hello everyone,


I am trying to display the k2 worklist items for users from REST.svc using the below link:

http://localhost:81/K2Services/rest.svc/Worklist/Items?$format=json 


I am using Jquery in order to display user worklist items. Below is my code:

  $(document).ready(function() {
            getWorklist();
        });


        function getWorklist() {
            $.ajax({
            url: "http://dlx:81/K2Services/rest.svc/Worklist/Items?$format=json",
                method: "GET",
                dataType: "JSON",
                cache: false,
                crossDomain: false,
                error: function(data, error, status) { alert("Error " + status); },
                success: function(data) { alert("Success"); }


            });
        }


 when the  client code execute i got the following error:


ErrorType: Access is denied.


In addition to that, If i remove crossDomain:false from the code, I go the following error:
No Transport.


Can you help me Please.


6 replies

Badge +9

I haven't tried this myself but I checked with some guys who have.  They mentioned you might want to try this binding setting:


<binding name="SourceCode.Services.RestBinding+HTTP">
  <security mode="TransportCredentialOnly">
    <transport clientCredentialType="Ntlm" />
  </security>
</binding>




Badge +3

Unfortuanilty It does not work.

Badge +9

I think maybe log a support ticket on this.  A support engineer can probably take a deeper look at your configuration and see if there is anything wrong.

Badge +8

A couple of other things to check/try:



  1. In IIS for the site hosting the K2 services, add an HTTP response header of Access-Control-Allow-Origin with a value of *
  2. put the html page and javascript file under the same site as the K2 services to avoid the cross domain javascript challenge

 

Badge +1

So, has anybody been able to get this working?

 

I'm noticing a perculair behaviour on our system and I wonder if this might shed some light:

 

Leaving Javascript behind for the moment, if I browse to the web service on our test server: https://k2-test.mr.au/K2Services/syncREST.svc/Task/Items?$format=json, I get nothing.

 

However, if I change the format to XML: https://k2-test.mr.au/K2Services/syncREST.svc/Task/Items?$format=xml, I get a result.

 

THEN, if I change the format back to json: https://k2-test.mr.au/K2Services/syncREST.svc/Task/Items?$format=json, I get a JSON file (as I should have done in the first place).

 

Are we looking at an authentication issue here with json requests?

 

Regards,

 

David

 

Badge

I have seen this behavior and believe others have as well in reading through some older threads. 

Reply