[Paraview] No rendering in ParaviewWeb with javascript

Sebastien Jourdain sebastien.jourdain at kitware.com
Mon Oct 29 09:27:11 EDT 2012


Hi Sumit,

the bug seems to be related to the content of that method

/*
 * Helper method used to simplify the construction of JsonRPC objects
 */
function JsonRpcObjectBuilder( methodName, methodArguments ) {
    var args = [];
    if(typeof(methodArguments) != "undefined") {
        if(typeof(methodArguments) != "object") {
            args = [ methodArguments ];
        } else {
            args = methodArguments;
        }
    }
    return {
        id      : 1,
        method  : methodName,
        params  : args
    };
}

inside the file WebServer/PWService/web/js/dev/paraview.js which you
can point to in your testing process instead of its parent compressed
one ParaViewWeb.js. Although, don't forget to add /dev/json2.js and
/dev/jsonrpc.js too when you are using the development version of the
js.

Once you figured out, what need to be done to prevent those extra "
around [] then you can either send me the full paraview.js or just the
diff so I can patch and update the ParaViewWeb repository.

Thanks for your help,

Seb

On Fri, Oct 26, 2012 at 2:05 PM, Purohit, Sumit <Sumit.Purohit at pnnl.gov> wrote:
> Thank Seb for the reply,
>
> 1. Yes, i am using exactly the same javascript in both the contexts.
> 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.
>
> 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.
>
>
> Thanks
> Sumit
>
> ________________________________________
> From: Sebastien Jourdain [sebastien.jourdain at kitware.com]
> Sent: Friday, October 26, 2012 3:48 AM
> To: Purohit, Sumit
> Cc: paraview at paraview.org
> Subject: Re: [Paraview] No rendering in ParaviewWeb with javascript
>
> Hum...
>
> I guess it is exactly the same JavaScript code that you execute in both context.
> To me it seems to be a bug in the way the ParaViewWeb javascript is behaving.
>
> But in the mean time, do you try to embed the 3D renderer in an iFrame
> or do you properly embed it into the current HTML document ? Because,
> if you were planing to use some iFrame, the ParaViewWeb javascript
> part could be done in that iFrame page and that might work as is...
> (At least as a first step)
>
> A third solution, could also be to patch ParaViewWeb javascript so it
> could properly work in your context or depending on how complex your
> web application is going to be, create an ad-hoc JavaScript library
> that will make only the call you need and the way you want.
>
> Hope my comments helped you,
>
> Thanks,
>
> Seb
>
>
> On Thu, Oct 25, 2012 at 4:48 PM, Purohit, Sumit <Sumit.Purohit at pnnl.gov> wrote:
>> Thanks Seb,
>>
>> 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
>>
>> 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"
>>
>> I see one deference in the way internal paraviewWeb POST calls are made.
>>
>> 1. When running outside Mediawiki (This Works) :
>>   {id:3,method:"VisualizationsManager.invoke",params:["87095ed9081c5fc32c76f43105d74c32-28", "{\"id\":1,\"method\":\"get_module\",\"params\":[]}"]}
>>
>> 2. Within MW ( This gives above exception)
>> {id:3,method:"VisualizationsManager.invoke",params:["87095ed9081c5fc32c76f43105d74c32-27", "{\"id\":1,\"method\":\"get_module\",\"params\":\"[]\"}"]}
>>
>> the difference is  how empty param are specified in both the POST requests.   [] Vs. \"[]\"
>>
>> 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 ??
>>
>>
>> Thanks
>> Sumit Purohit
>>
>>
>>
>> ________________________________________
>> From: Sebastien Jourdain [sebastien.jourdain at kitware.com]
>> Sent: Wednesday, October 24, 2012 4:33 AM
>> To: Purohit, Sumit
>> Cc: paraview at paraview.org
>> Subject: Re: [Paraview] No rendering  in ParaviewWeb with javascript
>>
>> Try to move the script section between </table> and </body> . Moreover does the other applications let you properly see 3d content?
>>
>> Seb
>>
>> On Oct 23, 2012, at 4:08 PM, "Purohit, Sumit" <Sumit.Purohit at pnnl.gov> wrote:
>>
>>> Hi Everyone,
>>>
>>> I am a newbie (and this is a cliche ) in paraview and trying to run ParaViewWeb using javascript rendering.
>>> I installed the Paraview Web and i can access various webapps Ex :
>>>
>>> http://localhost:8180/PWApp/index.jsp
>>> http://localhost:8180/PWService/
>>>
>>> [ i installed ParaviewWeb on port 8180]
>>>
>>> As a next step i am tried to use its javascript rendering but could not see any thing on the page.
>>> JavaScript console shows "Error: Connection failed" in line 116 ParaviewWeb.js
>>>
>>> Here is my complete HTML
>>> <html>
>>>     <head>
>>>         <script type="text/javascript" src="http://localhost:8180/PWService/js/ParaViewWeb.js"></script>
>>>     </head>
>>>     <body>
>>>       <table width='100%'>
>>>        <tr>
>>>           <td>Viewport title</td>
>>>        </tr>
>>>        <tr>
>>>           <td id='renderer-container-id'>
>>>               <!-- The renderer will be inserted here -->
>>>
>>>    <script type="text/javascript">
>>>         // Set the web service base URL
>>>         var serverUrl = "http://localhost:8180/PWService";
>>>
>>>         //
>>>         // Create a paraview proxy
>>>         //
>>>         var paraview = new Paraview(serverUrl);
>>>         paraview.createSession("Session name", "Session comment", "default");
>>>
>>>         var activeView = paraview.CreateIfNeededRenderView();
>>>
>>>         // Create and bind renderer
>>>         var renderer = new JavaScriptRenderer("rendererName", serverUrl);
>>>         renderer.init(paraview.sessionId, activeView.__selfid__);
>>>         renderer.setSize('200','200');
>>>         renderer.bindToElementId("renderer-container-id");
>>>         renderer.start();
>>>      </script>
>>>           </td>
>>>        </tr>
>>>        </table>
>>>     </body>
>>> </html>
>>>
>>> Thank you for the help.
>>> Sumit Purohit
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>>
>>> Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.paraview.org/mailman/listinfo/paraview


More information about the ParaView mailing list