Hi all, According to public jira [1] how can we handle connection refused exception come from this issue . This come from the send method.
code snippest for this issue > > try{ > var xhr = new XMLHttpRequest(); > var site = require("/site/conf/site.json"); > var endpoint = > site.workflows.applicationWorkFlowServerURL+"AuthenticationAdmin"; > xhr.open("POST", endpoint); > var payload = '<soap:Envelope xmlns:soap=" > http://www.w3.org/2003/05/soap-envelope" xmlns:aut=" > http://authentication.services.core.carbon.wso2.org"><soap:Header/><soap:Body><aut:login><aut:username>' > + username + '</aut:username><aut:password>' + password + > '</aut:password><aut:remoteAddress>localhost</aut:remoteAddress></aut:login></soap:Body></soap:Envelope>'; > xhr.send(payload); > var cookie = (xhr.getAllResponseHeaders()); > log.info(xhr.readyState); > //session.put("workflowCookie",cookie.split(";")[0].split(":")[1]); > var sessionCookie = xhr.getResponseHeader("Set-Cookie"); > session.put("workflowCookie",sessionCookie); > }catch (e) { > // log.error(e.message); > } Exception come from the following jaggery hostobject code private static void executeRequest(Context cx, XMLHttpRequestHostObject > xhr) throws ScriptException { > try { > xhr.httpClient.executeMethod(xhr.method); > xhr.statusLine = xhr.method.getStatusLine(); > xhr.responseHeaders = xhr.method.getResponseHeaders(); > updateReadyState(cx, xhr, HEADERS_RECEIVED); > byte[] response = xhr.method.getResponseBody(); > if (response.length > 0) { > xhr.responseText = new String(response); > } > Header contentType = xhr.method.getResponseHeader("Content-Type"); > if (contentType != null) { > xhr.responseType = contentType.getValue(); > } > updateReadyState(cx, xhr, DONE); > } catch (IOException e) { > log.error(e.getMessage(), e); > throw new ScriptException(e); > } finally { > xhr.method.releaseConnection(); > } > } XMLHttpRequestHostObject.java [1] - https://wso2.org/jira/browse/APIMANAGER-3139 Thanks and regards *Tharindu Dharmarathna*Associate Software Engineer WSO2 Inc.; http://wso2.com lean.enterprise.middleware mobile: *+94779109091*
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev