Hi Sumit,<div><br></div><div>That's great that you figured that out.That part is handle by jabsorb on ParaViewWeb server side but you might not be able to do anything about the way it handle "[]" compare to [].</div>
<div>The jabsorb library automatically try to map some Java class/method to the given json rpc request that it get.</div><div>So it might be easier to just fix the request on the client side the way you did.</div><div><br>
</div><div>Seb</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Nov 1, 2012 at 9:36 PM, Purohit, Sumit <span dir="ltr"><<a href="mailto:Sumit.Purohit@pnnl.gov" target="_blank">Sumit.Purohit@pnnl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Seb,<br>
<br>
I think there is an issue with the way Prototyp library construct JSON Vs how PraviewWeb uses it??.<br>
As for some reason when I call JSON.stringify() in the paraview.js::executeRemote() method, it returns json object with double quotes around it.<br>
It is a valid JSON structure but paraviewInstance.jsonRpcClient.VisualizationsManager does not support it.<br>
<br>
I tried using browser's native toJSON mathod and it worked.<br>
for that in paraview.js i added :<br>
if(window.Prototype) {<br>
delete Array.prototype.toJSON;<br>
}<br>
<br>
before code :<br>
var reply_string =<br>
paraviewInstance.jsonRpcClient.VisualizationsManager.invoke(<br>
paraviewInstance.sessionId,<br>
JSON.stringify(JsonRpcObjectBuilder(methodName, methodArguments)));<br>
<br>
<br>
in function executeRemote( paraviewInstance, methodName, methodArguments ) {..............<br>
<br>
and it worked. got clue from here : <a href="http://stackoverflow.com/questions/710586/json-stringify-bizarreness" target="_blank">http://stackoverflow.com/questions/710586/json-stringify-bizarreness</a><br>
<br>
<br>
Ideally \"params\":\"[]\" should work as it is Valid JSON.<br>
where can i find code for VisualizationsManager.invoke() method so that i can see how is it using input parameters ?<br>
<div class="im"><br>
Thanks<br>
Sumit Purohit<br>
<br>
________________________________________<br>
From: Sebastien Jourdain [<a href="mailto:sebastien.jourdain@kitware.com">sebastien.jourdain@kitware.com</a>]<br>
</div>Sent: Monday, October 29, 2012 6:27 AM<br>
<div class="HOEnZb"><div class="h5">To: Purohit, Sumit<br>
Cc: <a href="mailto:paraview@paraview.org">paraview@paraview.org</a><br>
Subject: Re: [Paraview] No rendering in ParaviewWeb with javascript<br>
<br>
Hi Sumit,<br>
<br>
the bug seems to be related to the content of that method<br>
<br>
/*<br>
* Helper method used to simplify the construction of JsonRPC objects<br>
*/<br>
function JsonRpcObjectBuilder( methodName, methodArguments ) {<br>
var args = [];<br>
if(typeof(methodArguments) != "undefined") {<br>
if(typeof(methodArguments) != "object") {<br>
args = [ methodArguments ];<br>
} else {<br>
args = methodArguments;<br>
}<br>
}<br>
return {<br>
id : 1,<br>
method : methodName,<br>
params : args<br>
};<br>
}<br>
<br>
inside the file WebServer/PWService/web/js/dev/paraview.js which you<br>
can point to in your testing process instead of its parent compressed<br>
one ParaViewWeb.js. Although, don't forget to add /dev/json2.js and<br>
/dev/jsonrpc.js too when you are using the development version of the<br>
js.<br>
<br>
Once you figured out, what need to be done to prevent those extra "<br>
around [] then you can either send me the full paraview.js or just the<br>
diff so I can patch and update the ParaViewWeb repository.<br>
<br>
Thanks for your help,<br>
<br>
Seb<br>
<br>
On Fri, Oct 26, 2012 at 2:05 PM, Purohit, Sumit <<a href="mailto:Sumit.Purohit@pnnl.gov">Sumit.Purohit@pnnl.gov</a>> wrote:<br>
> Thank Seb for the reply,<br>
><br>
> 1. Yes, i am using exactly the same javascript in both the contexts.<br>
> 2. I tried your suggestion of using iframe and I AM ABLE TO EMBEDDED the functional html page into my non-functional page and visualize it.<br>
><br>
> Can you suggest me where/what to make a patch in ParaViewWeb javascript as using iframe is not a "solution" for me. I want to dynamically create this visualization.<br>
><br>
><br>
> Thanks<br>
> Sumit<br>
><br>
> ________________________________________<br>
> From: Sebastien Jourdain [<a href="mailto:sebastien.jourdain@kitware.com">sebastien.jourdain@kitware.com</a>]<br>
> Sent: Friday, October 26, 2012 3:48 AM<br>
> To: Purohit, Sumit<br>
> Cc: <a href="mailto:paraview@paraview.org">paraview@paraview.org</a><br>
> Subject: Re: [Paraview] No rendering in ParaviewWeb with javascript<br>
><br>
> Hum...<br>
><br>
> I guess it is exactly the same JavaScript code that you execute in both context.<br>
> To me it seems to be a bug in the way the ParaViewWeb javascript is behaving.<br>
><br>
> But in the mean time, do you try to embed the 3D renderer in an iFrame<br>
> or do you properly embed it into the current HTML document ? Because,<br>
> if you were planing to use some iFrame, the ParaViewWeb javascript<br>
> part could be done in that iFrame page and that might work as is...<br>
> (At least as a first step)<br>
><br>
> A third solution, could also be to patch ParaViewWeb javascript so it<br>
> could properly work in your context or depending on how complex your<br>
> web application is going to be, create an ad-hoc JavaScript library<br>
> that will make only the call you need and the way you want.<br>
><br>
> Hope my comments helped you,<br>
><br>
> Thanks,<br>
><br>
> Seb<br>
><br>
><br>
> On Thu, Oct 25, 2012 at 4:48 PM, Purohit, Sumit <<a href="mailto:Sumit.Purohit@pnnl.gov">Sumit.Purohit@pnnl.gov</a>> wrote:<br>
>> Thanks Seb,<br>
>><br>
>> I realized that i was running my html page under Apache but it was not properly configured to talk to paraviweWeb which is under. tomcat. I Fixed that and i worked fine. Thanks<br>
>><br>
>> My goal is to add this code under a Mediawiki Page and run it on a button click BUT when i do that i get "uncaught exception: get_module() takes no arguments (2 given). Paraview.js line 231"<br>
>><br>
>> I see one deference in the way internal paraviewWeb POST calls are made.<br>
>><br>
>> 1. When running outside Mediawiki (This Works) :<br>
>> {id:3,method:"VisualizationsManager.invoke",params:["87095ed9081c5fc32c76f43105d74c32-28", "{\"id\":1,\"method\":\"get_module\",\"params\":[]}"]}<br>
>><br>
>> 2. Within MW ( This gives above exception)<br>
>> {id:3,method:"VisualizationsManager.invoke",params:["87095ed9081c5fc32c76f43105d74c32-27", "{\"id\":1,\"method\":\"get_module\",\"params\":\"[]\"}"]}<br>
>><br>
>> the difference is how empty param are specified in both the POST requests. [] Vs. \"[]\"<br>
>><br>
>> Both are made internally by ParaViewWeb, so do you think i can control this in my javascript ( actually jQuery) code ?? OR on ParaviewWeb code/config side ??<br>
>><br>
>><br>
>> Thanks<br>
>> Sumit Purohit<br>
>><br>
>><br>
>><br>
>> ________________________________________<br>
>> From: Sebastien Jourdain [<a href="mailto:sebastien.jourdain@kitware.com">sebastien.jourdain@kitware.com</a>]<br>
>> Sent: Wednesday, October 24, 2012 4:33 AM<br>
>> To: Purohit, Sumit<br>
>> Cc: <a href="mailto:paraview@paraview.org">paraview@paraview.org</a><br>
>> Subject: Re: [Paraview] No rendering in ParaviewWeb with javascript<br>
>><br>
>> Try to move the script section between </table> and </body> . Moreover does the other applications let you properly see 3d content?<br>
>><br>
>> Seb<br>
>><br>
>> On Oct 23, 2012, at 4:08 PM, "Purohit, Sumit" <<a href="mailto:Sumit.Purohit@pnnl.gov">Sumit.Purohit@pnnl.gov</a>> wrote:<br>
>><br>
>>> Hi Everyone,<br>
>>><br>
>>> I am a newbie (and this is a cliche ) in paraview and trying to run ParaViewWeb using javascript rendering.<br>
>>> I installed the Paraview Web and i can access various webapps Ex :<br>
>>><br>
>>> <a href="http://localhost:8180/PWApp/index.jsp" target="_blank">http://localhost:8180/PWApp/index.jsp</a><br>
>>> <a href="http://localhost:8180/PWService/" target="_blank">http://localhost:8180/PWService/</a><br>
>>><br>
>>> [ i installed ParaviewWeb on port 8180]<br>
>>><br>
>>> As a next step i am tried to use its javascript rendering but could not see any thing on the page.<br>
>>> JavaScript console shows "Error: Connection failed" in line 116 ParaviewWeb.js<br>
>>><br>
>>> Here is my complete HTML<br>
>>> <html><br>
>>> <head><br>
>>> <script type="text/javascript" src="<a href="http://localhost:8180/PWService/js/ParaViewWeb.js" target="_blank">http://localhost:8180/PWService/js/ParaViewWeb.js</a>"></script><br>
>>> </head><br>
>>> <body><br>
>>> <table width='100%'><br>
>>> <tr><br>
>>> <td>Viewport title</td><br>
>>> </tr><br>
>>> <tr><br>
>>> <td id='renderer-container-id'><br>
>>> <!-- The renderer will be inserted here --><br>
>>><br>
>>> <script type="text/javascript"><br>
>>> // Set the web service base URL<br>
>>> var serverUrl = "<a href="http://localhost:8180/PWService" target="_blank">http://localhost:8180/PWService</a>";<br>
>>><br>
>>> //<br>
>>> // Create a paraview proxy<br>
>>> //<br>
>>> var paraview = new Paraview(serverUrl);<br>
>>> paraview.createSession("Session name", "Session comment", "default");<br>
>>><br>
>>> var activeView = paraview.CreateIfNeededRenderView();<br>
>>><br>
>>> // Create and bind renderer<br>
>>> var renderer = new JavaScriptRenderer("rendererName", serverUrl);<br>
>>> renderer.init(paraview.sessionId, activeView.__selfid__);<br>
>>> renderer.setSize('200','200');<br>
>>> renderer.bindToElementId("renderer-container-id");<br>
>>> renderer.start();<br>
>>> </script><br>
>>> </td><br>
>>> </tr><br>
>>> </table><br>
>>> </body><br>
>>> </html><br>
>>><br>
>>> Thank you for the help.<br>
>>> Sumit Purohit<br>
>>> _______________________________________________<br>
>>> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>>><br>
>>> Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>>><br>
>>> Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
>>><br>
>>> Follow this link to subscribe/unsubscribe:<br>
>>> <a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
</div></div></blockquote></div><br></div>