Hi,
I have .jsp file, in which I want to invoke a jaggery api.
The content inside .jsp file is as below:
URL url = new URL(baseURL + *"/user-login/user/authenticate/add*?scope=" +
URLEncoder.encode(scope, "UTF-8") + "&redirecturi=" + redirectUri +
"&clientid=" + clientId + "&acrvalue=" + arc + "
Hi Denuwanthi,
Can you please change your jag to the following:
<%
try {
} catch (e) {
log.error(e);
response.status=500;
var msg = {};
msg.status = 500;
msg.error = "Failed invoking remote endpoint";
print(msg);
}
%>
On Fri, Sep 23, 2016 at 5:04 PM, Denuwanthi De
EDIT:
Please post the error you get afterwards.
On Fri, Sep 23, 2016 at 5:11 PM, Sameera Medagammaddegedara <
samee...@wso2.com> wrote:
> Hi Denuwanthi,
>
> Can you please change your jag to the following:
>
> <%
> try {
>
> } catch (e) {
> log.error(e);
> response.status=500;
>
Some additional suggestions for organizing the above code:
<%
(function(request,response){
var method = request.getMethod();
function doGet(req,res) {
}
switch(method) {
case 'GET':
doGet(request,response);
break;
default:
b
Hi Sameera,
Please find the stacktrace
Stacktrace:
at
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(Js
Hi Sameera,
I could get it working with following approach[1]:
var headers ={"Accept" : "application/json"};
var response = get(url,null,headers,'text');
[1]
http://stackoverflow.com/questions/34505509/jaggeryjs-ajax-call-get-method
Thanks
On Fri, Sep 23, 2016 at 5:21 PM, Denuwanthi De Silva
Hi ,
The above get() method returned the response as null.
After several attempts finally got it working with following approach with
the help of Nipuna.
Thanks a lot Nipuna for helping to sort this out.
var xhr = new XMLHttpRequest();
xhr.open("GET", url);
xhr.setRequestHeader("Accept" , "app