The request is an object of WSRequest object. Sorry for incomplete answer
previously. Make it as
*var *cookieString = version.getResponseHeader(
"Set-Cookie");
*var *cookie = cookieString.split(";")[0];
Thanks & Regards
Danushka Fernando
Software Engineer
WSO2 inc. http://wso2.com/
Mobile : +94716332729
On Thu, Jul 31, 2014 at 12:50 PM, Akila Nimantha [IT/EKO/LOITS] <
[email protected]> wrote:
> Hi Danushka,
>
>
>
> I put the code u sent me in my application code. But still there is error.
> Now it says error about “canot find getResponseHeader” . please check below
> for AS error part.
>
>
>
> TypeError: Cannot find function getResponseHeader in object [object
> Request].org.mozilla.javascript.WrappedException: Wrapped
> org.jaggeryjs.scriptengine.exceptions.ScriptException: Error occured while
> invoking the service (/slogin//pageOne.jag#91) at
> org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1754) at
> org.mozilla.javascript.MemberBox.invoke(MemberBox.java:148) at
> org.mozilla.javascript.FunctionObject.call(FunctionObject.java:386) at
> org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32) at
> org.jaggeryjs.rhino.slogin.c6._c_anonymous_2(/slogin//pageOne.jag:91) at
> org.jaggeryjs.rhino.slogin.c6.call(/slogin//pageOne.jag) at
> org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:74)
> at org.jaggeryjs.rhino.slogin.c6._c_script_0(/slogin//pageOne.jag:108) at
> org.jaggeryjs.rhino.slogin.c6.call(/slogin//pageOne.jag) at
> org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394) at
> org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091) at
> org.jaggeryjs.rhino.slogin.c6.call(/slogin//pageOne.jag) at
> org.jaggeryjs.rhino.slogin.c6.exec(/slogin//pageOne.jag) at
> org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:570)
> at org.jaggeryjs.scriptengine.engine.RhinoEngine.exec(RhinoEngine.java:273)
> at
> org.jaggeryjs.jaggery.core.manager.WebAppManager.execute(WebAppManager.java:435)
> at org.jaggeryjs.jaggery.core.JaggeryServlet.doGet(JaggeryServlet.java:24)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:735) at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:848) at
>
>
>
> In bps log still same.
>
> In Jaggery application I changed invokeWebService function as mentioned
> below,
>
>
>
> *function *invokeWebServices() {
>
> // var log = new Log();
>
> *var *ws = require("ws");
>
> *var *version = *new *ws.WSRequest();
>
> *var *options = *new Array*();
>
> options.useSOAP = 1.2;
>
> options.action = "urn:login";
>
> *var *usrName = "regionalClerkUser";
>
> *var *pass = "regionalClerkUser";
>
> *var *remote = "192.168.255.150";
>
>
>
> *var *payload = '<aut:login xmlns:aut="
> http://authentication.services.core.carbon.wso2.org"><aut:username>' +
> usrName + '</aut:username><aut:password>' + pass +
> '</aut:password><aut:remoteAddress>'+ remote +
> '</aut:remoteAddress></aut:login>';
>
> *var *result;
>
>
>
> try {
>
> //version.open(options,"
> http://192.168.255.150:9767/services/AuthenticationAdmin",true);
>
> version.open(options,"
> https://192.168.255.150:9443/services/AuthenticationAdmin.AuthenticationAdminHttpsSoap12Endpoint/
> ",*false*);
>
> version.send(payload);
>
> //result = version.responseE4X;
>
>
>
> //result = request.getAllHeaders();
>
> //result = request.getAllCookies();
>
> //result =
> request.getCookie("JSESSIONID").name + "=" +
> request.getCookie("JSESSIONID").value + ";";
>
> *var *cookieString = request.getResponseHeader(
> "Set-Cookie");
>
> *var *cookie = cookieString.split(";")[0];
>
> //var result2 = result.split(" ")[0];
>
> //var result2 = result.toString();
>
> //var result3 =
> request.getParameter("Set-Cookie");
>
> session.put('cookie', cookie);
>
> } catch (e) {
>
> log.error(e.toString());
>
> *return *e.toString();
>
> }
>
>
>
> *return *cookieString;
>
>
>
> };
>
>
>
> Regards,
>
> Akila
>
>
>
> *From:* Danushka Fernando [mailto:[email protected]]
> *Sent:* Thursday, July 31, 2014 12:01 PM
>
> *To:* Akila Nimantha [IT/EKO/LOITS]
> *Cc:* [email protected]
> *Subject:* Re: [Dev] canot invoke bps service using jaggery app
>
>
>
> Hi Akila
>
> Seems you are not extracting the cookie correct.
>
>
>
> Try this code
>
>
>
> var cookieString = request.getResponseHeader("Set-Cookie");
>
> var cookie = cookieString.split(";")[0];
>
>
>
>
> Thanks & Regards
>
> Danushka Fernando
>
> Software Engineer
>
> WSO2 inc. http://wso2.com/
>
> Mobile : +94716332729
>
>
>
> On Thu, Jul 31, 2014 at 11:40 AM, Akila Nimantha [IT/EKO/LOITS] <
> [email protected]> wrote:
>
> Hi Danushka,
>
>
>
> FYI I did some changes in jaggery code, inserting session.put() and
> session.get() to pass cockie value through functions I created. Now it
> shows canot invoke service error(previous “HTTPHeader” problem solved).
>
> Please check attached files for both AS log and BPS log and jaggery
> application code.
>
>
>
> Regards,
>
> Akila
>
>
>
> *From:* Danushka Fernando [mailto:[email protected]]
> *Sent:* Wednesday, July 30, 2014 6:55 PM
> *To:* Akila Nimantha [IT/EKO/LOITS]
> *Cc:* [email protected]
> *Subject:* Re: [Dev] canot invoke bps service using jaggery app
>
>
>
> Hi Akila
>
> I guess error you attached is the error in the AS / tomcat side. Can you
> attach the BPS side error logs as well.
>
>
> Thanks & Regards
>
> Danushka Fernando
>
> Software Engineer
>
> WSO2 inc. http://wso2.com/
>
> Mobile : +94716332729
>
>
>
> On Wed, Jul 30, 2014 at 6:02 PM, Akila Nimantha [IT/EKO/LOITS] <
> [email protected]> wrote:
>
> Hi all,
>
>
>
> I am trying to invoke human task adminService using jaggery application.
> What I did was, first created a function called “invokeWebService” to
> create “login” to bps server. Its working fine and give the result as
> “true”. Next I get the JSESSIONID using same function. Afterthat I created
> another function called “viewAllTasks” to invoke “simpleQuery” adminService
> with “ALL_TASKS” parameter. I passes previously created JSESSIONID as a
> header with name “Cookie”. But its not working in jaggery application and
> give errors.
>
> *Please check attached jaggery application page and error log I prompted*.
>
> (*these “login” and “simpleQuery” services and all services works
> properly in SoapUI*)
>
>
>
> Regards,
>
> Akila
>
> This message (including any attachments) is intended only for the use of
> the individual or entity to which it is addressed and may contain
> information that is non-public, proprietary, privileged, confidential, and
> exempt from disclosure under applicable law or may constitute as attorney
> work product. If you are not the intended recipient, you are hereby
> notified that any use, dissemination, distribution, or copying of this
> communication is strictly prohibited. If you have received this
> communication in error, notify us immediately by telephone and (i) destroy
> this message if a facsimile or (ii) delete this message immediately if this
> is an electronic communication. Thank you.
>
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>
>
> This message (including any attachments) is intended only for the use of
> the individual or entity to which it is addressed and may contain
> information that is non-public, proprietary, privileged, confidential, and
> exempt from disclosure under applicable law or may constitute as attorney
> work product. If you are not the intended recipient, you are hereby
> notified that any use, dissemination, distribution, or copying of this
> communication is strictly prohibited. If you have received this
> communication in error, notify us immediately by telephone and (i) destroy
> this message if a facsimile or (ii) delete this message immediately if this
> is an electronic communication. Thank you.
>
>
>
> This message (including any attachments) is intended only for the use of
> the individual or entity to which it is addressed and may contain
> information that is non-public, proprietary, privileged, confidential, and
> exempt from disclosure under applicable law or may constitute as attorney
> work product. If you are not the intended recipient, you are hereby
> notified that any use, dissemination, distribution, or copying of this
> communication is strictly prohibited. If you have received this
> communication in error, notify us immediately by telephone and (i) destroy
> this message if a facsimile or (ii) delete this message immediately if this
> is an electronic communication. Thank you.
>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev