viewLoader questions

Hi, i have the following code:

isc.HLayout.create({
width:“100%”,height:“100%”,
members:[
isc.ViewLoader.create({
autoDraw:false,
viewURL:“http://alex/Webservice2/service2.asmx/view1”,
//viewURL:“loaded_view.js”,
loadingMessage:“Loading ..”

        })
     ]

});

in the above code viewURL makes reference to a webmethod in a webservice which returns the view code (javascript), this works fine in IE but when i try it in Mozilla it fails, i think this occurs because i need to force the use of the proxy, but i dont know how to do it.
i want to make some questions:

  1. ¿ how can i force the use of the proxy in the viewLoader ?
  2. ¿ how can i force the use of the proxy in a callOperation method ?
  3. ¿ how can i force the use of the proxy in a sendRequest method ?
  4. i was looking for info about the setView method of the viewLoader but i can’t find any thing.

Thanks in advance

What error are you seeing in Mozilla/Firefox? This can’t be a proxy problem because ViewLoader URLs are never proxied. Regarding your questions:

  1. At the moment, the only way would be to do the proxying yourself by specifying a viewURL that targets your proxy endpoint and passing the actual URL you want to access via a query parameter. This looks like a useful feature, however, so we’ll look into rolling in an enhancement like this into a future release of SmartClient.

  2. You mean for web services, right? If so, then proxying is automatic in that layer. If the URL in the WSDL (or most of the routines on XMLTools) does not match the origin server URL, SmartClient proxies the request automatically.

  3. You can call RPCManager.sendProxied() instead.

  4. Right - that’s not documented at present. A ViewLoader loads its views from a URL. Instead of using something like setView(), we actually recommend that you simply replace it with whatever it is you wanted to show in its stead. Does that make sense?

Good questions - hopefully these answers work for you.

Thanks for your fast answer, but i have a question: ¿ can you give me a sample code that show me the way to make the operation described in point 1 (proxy) ?
Thanks.

Hi alex,

We recommend you go with #2 or #3, that is, call your webservice via APIs that already use the built-in proxy, then if the service is returning JavaScript, use eval() to create components.

If you still want to persue #1, you might search the web for a tutorial on how to proxy an HTTP request using the servlet APIs - this doesn’t have anything specifically to do with SmartClient.

Also, I’m not sure what has led you to using the ViewLoader, but you should make sure you’re familiar with the recommended SmartClient Architecture:

http://www.smartclient.com/docs/5.5.1/a/b/c/go.html#group..smartArchitecture

The most efficient architecture loads component definitions up front, then loads only data dynamically (including data that may configure how or whether certain components are shown). If you dynamically load components that could have been loaded staticly, then those component definitions cannot be cached.

Thanks for your answer. ¿ do you mean eval or evalresult ? .i was triying to use eval (or evalresult) but i can’t find an example in the docs. ¿ can you give an example that show me how to use eval (evalresult) to create dynamic components?.
Thanks.

eval() is built into the JavaScript language.

eval("isc.Canvas.create()")

rpcRequest.evalResult simply calls eval() on the result of an RPCRequest - you can do so yourself on any String of valid JavaScript code you retrieve from your web service.