REST Service invoke from finesse in IE8

Version 1
    This document was generated from CDN thread

    Created by: Karthik Bahiradhan on 27-03-2013 09:30:16 AM
    Hi,   I am using Finesse 9.1,i have to get the data from the database to bind the grid on finesse agent desktop. I have created  custom application and REST WCF service which returns data in Json,i am invoking REST service in "render" method inside "screepop.js"  and try to assign in Jqgrid.i have converted application into xml file to run as gadget.   REST service request is not success full in IE8 but working in firefox.I am using Jquery Ajax method to invoke url, please let me know any configuration should done to work in IE 8.   Note : it is working when i run the custom application in direct IE8 as webapplication but not working as gadget inside finesse  ( i have done all configuration to avoid cross domain issues)

    Subject: RE: New Message from Karthik Bahiradhan in Cisco Finesse - General Question
    Replied by: David Lender on 27-03-2013 09:38:50 AM
    There is nothing in the gadget features that directly supports using a jQuery.Ajax method. A gadget is an iframe so you may wish to test your web application inside an iframe.
    You also can try using gadgets.io.makerequest to perform the request.  See  APIs available to Gadget Javascript in the Finesse Webservices Developer Guide.

    Subject: RE: REST Service invoke from finesse in IE8
    Replied by: Karthik Bahiradhan on 27-03-2013 09:58:54 AM
    Thanks for you replay, I have used that gadget.io.makerequiest request on init method as follows  gadgets.io.makerequest('http://XXX/XXX/FinesseService.svc/IVRTransferList',function(data){ alert('data'); },''); i didnt get above alert.Could you provide any sample.   if i use iframe i could not access the any text boxes or label controls form the "secreen pop.js" to assign value from dialogs,since access denied error accoured in IE8.   Thanks  

    Subject: RE: New Message from Karthik Bahiradhan in Cisco Finesse - General Question
    Replied by: David Lender on 27-03-2013 11:28:50 AM
    I’ll soon post a  SampleGadget_WebService gadget that demonstrates a gadgets.io.makerequest.
    The function call I use is:

    gadgets.io.makeRequest(encodeURI("http://10.88.194.158:8080") + url, handler, params);

    Subject: RE: New Message from Karthik Bahiradhan in Cisco Finesse - General Question
    Replied by: Arul Selvan on 28-03-2013 01:28:13 AM
    Thanks David insted of desing my  screenpon inside xml file, now i am giving request to my .net webpage and render inside my gadget as a html, my code also  easy to maintain. can you give one sample for how to send call information to my webpage using post method. Ex: gadgets.io.makeRequest("http://172.16.12.119/ScriptDetails", gResponseHandler, null);

    Subject: RE: New Message from Arul Selvan in Cisco Finesse - General Questions: RE:
    Replied by: David Lender on 28-03-2013 09:40:12 AM
    There is a webservice sample gadget now posted on the documentation page that shows how to use gadgets.io.makerequest.

    Subject: RE: New Message from Arul Selvan in Cisco Finesse - General Questions: RE:
    Replied by: Arul Selvan on 18-04-2013 12:57:49 AM
    hi 
    i am using "gadget.io.makerequest" to send  the data (Which is in THAI language) from Custom gadget to External REST service using POST_DATA parameter.


    While receiving at REST service end it received as Junck values.if i am send the same thai data using Fiddler it was received as Thai value.
     
    please let me know if any configuration requried to send the THAI values in Make request. We are using finesse 9.1
     
    Thanks
     

    Subject: RE: New Message from Arul Selvan in Finesse - General Questions: RE: New Me
    Replied by: David Lender on 18-04-2013 12:46:15 PM
    Have you compared the headers from the request from fiddler that passes versus the request via gadgets.io.makerequest?   Are you using the correct ‘Content-Type’ and the correct ‘Encoding’ when making the Post request via gadgets.io.makerequest?

    Subject: RE: REST Service invoke from finesse in IE8
    Replied by: Arul Selvan on 22-04-2013 07:32:08 AM
    hi
    I have set the value as following (this is  i have configured in fiddler) but still i am getting as Junk value
                var header = { "Content-Type": "application/json;charset=utf-8" };
        param = { METHOD: "POST",HEADERS: header, POST_DATA: JSON.stringify(jsonWrapupObjects),CONTENT_TYPE:"json" };
           gadgets.io.makeRequest(encodeURI(loadonceURL + "InsertWrapupCode"), callbackfunction, param);
     
    but when i trace the Net capture in IE8 it still shows  => Content-Type:application/x-www-form-urlencoded
     
    i have debuged the makerequest method in that param contains Content-Type as "application/json' i bit confused on this.
     
    Thanks
     
     

    Subject: RE: New Message from Arul Selvan in Finesse - General Questions: RE: REST S
    Replied by: David Lender on 22-04-2013 02:32:04 PM
    Do you have a proxy sitting in the pipeline to check for these requests?

    Our engineers tested a post request with data in Thai and it works correctly:

    All gadget.io.makerequest requests that are made to  Shindig (Finesse) are made as POST requests with the content-type as 'application/x-www-form-urlencoded'. The headers that are to be passed to the actual request that will be made from Shindig (Finesse)  to the backend server are passed as 'parameters' to that original POST request. Shindig (Finesse) then takes these parameters and creates a request with the correct headers that will go to the backend server.

    To demonstrate this, our Finesse engineers created a reasonCode using Finesse Admin in Thai (you can try it as well). They used FireBug to capture these traces of the request and took screenshots. The first screenshot is of the 'headers' tab of the makeRequest (in the firebug console). As you can see the content-type is indeed application/x-www-form-urlencoded. The 2nd screen shot is of the 'post' tab of the same makeRequest. As you can see it passes a parameter called 'headers'  and in that the content type is actually application/xml.The 3rd item I captured is Finesse backend logs showing this request, where the thai data is making it intact.

    [cid7AF5B35-B672-40C8-B0BE-283C443940B6]

    [cid:034A3264-3D41-409A-B433-24E66D4CA650]

    So it appears you are not doing something correctly in your pipeline. Fiddler is a proxy, do you have a proxy sitting in the actual pipeline somewhere ? Is it that when you  directly do request from Fiddler to the backend it works but when it goes from Shindig (Finesse) to Fiddler to your backend it fails ? A  good way to debug this issue would be to setup logs at every point in the pipeline and see where exactly the request is getting garbled.

    FINESSE LOG SNIPPET

    0007072779: 192.168.1.25: Apr 22 2013 11:05:06.077 -0700: %CCBU_http-8080-4-6-API_REQUEST: %[REQUEST_URL=ReasonCode][agent_id=administrator][request_identifier=null][request_method=reasonCode.POST][request_parameters=ReasonCode {uri=null, category='NOT_READY', code='1', label='วางสำเนา', forAll='true'}]: Request from client to webservice api
    0007072780: 192.168.1.25: Apr 22 2013 11:05:06.082 -0700: %CCBU_http-8080-4-6-REQUEST_END: %[elapsed_time=10]: Request complete

    (Finesse logs this because it is an API request.  My understanding is that proxied requests are not logged)

    We log all the makeRequests via the Shindig (Finesse) in the localhost logs which can be fetched using the CLI to get platform tomcat logs. However those logs don't capture the value of the entire request… i.e we don't log the value of the different headers and the actual content in the body of the HttpRequest. After that point any logging is application specific. So for Finesse backend requests, we log whatever we need in our logs, and similarly a 3rd party rest server would log whatever they need in their logs. These don't need to be permanent logs, just logs that are needed for development, but that’s basically the reason why the external rest service will have to log the details of the request to debug this issue further.

    Subject: RE: REST Service invoke from finesse in IE8
    Replied by: David Lender on 22-04-2013 02:37:25 PM
    RE: REST Service invoke from finesse in IE8

    Do you have a proxy sitting in the pipeline to check for these requests? 

     

    Our engineers tested a post request with data in Thai and it works correctly:

     

    All gadget.io.makerequest requests that are made to  Shindig (Finesse) are made as POST requests with the content-type as 'application/x-www-form-urlencoded'. The headers that are to be passed to the actual request that will be made from Shindig (Finesse)  to the backend server are passed as 'parameters' to that original POST request. Shindig (Finesse) then takes these parameters and creates a request with the correct headers that will go to the backend server.

     

    To demonstrate this, our Finesse engineers created a reasonCode using Finesse Admin in Thai (you can try it as well). They used FireBug to capture these traces of the request and took screenshots. The first screenshot is of the 'headers' tab of the makeRequest (in the firebug console). As you can see the content-type is indeed application/x-www-form-urlencoded. The 2nd screen shot is of the 'post' tab of the same makeRequest. As you can see it passes a parameter called 'headers'  and in that the content type is actually application/xml.The 3rd item I captured is Finesse backend logs showing this request, where the thai data is making it intact.

    So it appears you are not doing something correctly in your pipeline. Fiddler is a proxy, do you have a proxy sitting in the actual pipeline somewhere ? Is it that when you  directly do request from Fiddler to the backend it works but when it goes from Shindig (Finesse) to Fiddler to your backend it fails ? A  good way to debug this issue would be to setup logs at every point in the pipeline and see where exactly the request is getting garbled.
     
     
     
    FINESSE LOG SNIPPET
     
     
     
    0007072779: 192.168.1.25: Apr 22 2013 11:05:06.077 -0700: %CCBU_http-8080-4-6-API_REQUEST: %[REQUEST_URL=ReasonCode][agent_id=administrator][request_identifier=null][request_method=reasonCode.POST][request_parameters=ReasonCode {uri=null, category='NOT_READY', code='1', label='วางสำเนา', forAll='true'}]: Request from client to webservice api 
     
    0007072780: 192.168.1.25: Apr 22 2013 11:05:06.082 -0700: %CCBU_http-8080-4-6-REQUEST_END: %[elapsed_time=10]: Request complete 
     
     
     
    (Finesse logs this because it is an API request.  My understanding is that proxied requests are not logged)
     
     
     
    We log all the makeRequests via the Shindig (Finesse) in the localhost logs which can be fetched using the CLI to get platform tomcat logs. However those logs don't capture the value of the entire request… i.e we don't log the value of the different headers and the actual content in the body of the HttpRequest. After that point any logging is application specific. So for Finesse backend requests, we log whatever we need in our logs, and similarly a 3rd party rest server would log whatever they need in their logs. These don't need to be permanent logs, just logs that are needed for development, but that’s basically the reason why the external rest service will have to log the details of the request to debug this issue further.
     
     

     

     

    Subject: RE: New Message from David Lender in Finesse - General Questions: RE: REST
    Replied by: David Lender on 24-04-2013 01:05:06 PM
    If you are unable to resolve the issue I suggest you open a Service Request (specify “Other” for Technology and “CDN – Customer Contact Applications” for sub Technology.)