Hi Himasha,

Where have you defined the url variable? Seems it is null at the time of
ajax call.

On Sat, Jun 20, 2015 at 10:54 AM, Himasha Guruge <[email protected]> wrote:

> Hi Nirmal,
>
> it passes the intended url to send the form data.
> var httpUrl = location.protocol + "//" + location.host;   (
> https://192.168.1.2:9443)
> var url = "/" + CONTEXT + "/send?req=/bpmn/runtime/tasks/" + id +
> "/attachments";
>
> On Sat, Jun 20, 2015 at 10:44 AM, Nirmal Fernando <[email protected]> wrote:
>
>>
>>
>> On Sat, Jun 20, 2015 at 9:47 AM, Himasha Guruge <[email protected]>
>> wrote:
>>
>>> Hi All,
>>>
>>> In order to send an input file using Ajax I'm using [1] which is also
>>> used in ES and ML . My ajax call looks like following where the url value
>>> is (
>>> https://192.168.1.2:9443/bpmn-explorer/send?req=/bpmn/runtime/tasks/15048/attachments
>>> ).
>>>
>>> $('#attachForm').ajaxForm({
>>>         url: httpUrl + url,
>>>
>> What does the above line do?
>>
>>
>>>         success : function(res){
>>>             window.location = httpUrl + "/" + CONTEXT + "/inbox";
>>>
>>>         },
>>>         error :  function(res){
>>>             var errorText = res.responseText
>>>             alert('ERROR' + errorText);
>>>         }
>>>
>>>     });
>>>
>>> When clicking on submit button of form, it goes to error function and
>>> i'm getting following exception trace on console.
>>>
>>> Caused by: org.mozilla.javascript.WrappedException: Wrapped
>>> java.lang.IllegalArgumentException: Invalid uri '
>>> *http://192.168.1.2:9763null'*: invalid port number
>>> (<<http>>/META-INF/scripts/http.js#220)
>>>
>>> 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.<<http>>.META_INF.scripts.c0._c_anonymous_5(<<http>>/META-INF/scripts/http.js:220)
>>>
>>> at
>>> org.jaggeryjs.rhino.<<http>>.META_INF.scripts.c0.call(<<http>>/META-INF/scripts/http.js)
>>>
>>> at
>>> org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63)
>>>
>>> at
>>> org.jaggeryjs.rhino.<<http>>.META_INF.scripts.c0._c_anonymous_8(<<http>>/META-INF/scripts/http.js:232)
>>>
>>> at
>>> org.jaggeryjs.rhino.<<http>>.META_INF.scripts.c0.call(<<http>>/META-INF/scripts/http.js)
>>>
>>> at
>>> org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63)
>>>
>>> at
>>> org.jaggeryjs.rhino.bpmn_explorer.controller.c4._c_script_0(/bpmn-explorer/controller/communication.jag:39)
>>>
>>> at
>>> org.jaggeryjs.rhino.bpmn_explorer.controller.c4.call(/bpmn-explorer/controller/communication.jag)
>>>
>>> at
>>> org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
>>>
>>> at
>>> org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
>>>
>>> at
>>> org.jaggeryjs.rhino.bpmn_explorer.controller.c4.call(/bpmn-explorer/controller/communication.jag)
>>>
>>> at
>>> org.jaggeryjs.rhino.bpmn_explorer.controller.c4.exec(/bpmn-explorer/controller/communication.jag)
>>>
>>> at
>>> org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:567)
>>>
>>> ... 41 more
>>>
>>> Caused by: java.lang.IllegalArgumentException: Invalid uri
>>> 'http://192.168.1.2:9763null': invalid port number
>>>
>>> at
>>> org.apache.commons.httpclient.HttpMethodBase.<init>(HttpMethodBase.java:222)
>>>
>>> at
>>> org.apache.commons.httpclient.methods.ExpectContinueMethod.<init>(ExpectContinueMethod.java:93)
>>>
>>> at
>>> org.apache.commons.httpclient.methods.EntityEnclosingMethod.<init>(EntityEnclosingMethod.java:119)
>>>
>>> at
>>> org.apache.commons.httpclient.methods.PostMethod.<init>(PostMethod.java:106)
>>>
>>> at
>>> org.jaggeryjs.hostobjects.xhr.XMLHttpRequestHostObject.send(XMLHttpRequestHostObject.java:472)
>>>
>>> at
>>> org.jaggeryjs.hostobjects.xhr.XMLHttpRequestHostObject.jsFunction_send(XMLHttpRequestHostObject.java:284)
>>>
>>> at sun.reflect.GeneratedMethodAccessor82.invoke(Unknown Source)
>>>
>>> at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>
>>> at java.lang.reflect.Method.invoke(Method.java:601)
>>>
>>> at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
>>>
>>> I can't figure out what's being passed as null, because when analyzing
>>> the request file binary value is sent as expected. Any ideas/hints on what
>>> could be the issue would be appreciated.
>>>
>>> Thanks,
>>> Himasha Guruge
>>> *Software Engineer*
>>> WS*O2* *Inc.*
>>> Mobile: +94 777459299
>>> [email protected]
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> [email protected]
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>>
>> Thanks & regards,
>> Nirmal
>>
>> Associate Technical Lead - Data Technologies Team, WSO2 Inc.
>> Mobile: +94715779733
>> Blog: http://nirmalfdo.blogspot.com/
>>
>>
>>
>
>
> --
> Himasha Guruge
> *Software Engineer*
> WS*O2* *Inc.*
> Mobile: +94 777459299
> [email protected]
>



-- 

Thanks & regards,
Nirmal

Associate Technical Lead - Data Technologies Team, WSO2 Inc.
Mobile: +94715779733
Blog: http://nirmalfdo.blogspot.com/
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to