You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Ashish Malviya <as...@yahoo.co.in> on 2009/06/08 09:56:55 UTC
Regarding Tuscany 1.4 example :helloworld-jsonrpc-webapp
Hi Team,
As I can understand from this example, this SCA component is included in the web app by using a Javascript scaDomain.js.
<script type="text/javascript" src="SCADomain/scaDomain.js"></script> is added to the html.
Is there any way I can use this scaDomain.js in some other webapp and call the methods.
Suppose the name of the application which is generating this Javascript is helloworld , we get this javascript on
http://localhost:8080/helloworld/SCADomain/scaDomain.js
What I want is to use this link in another application eg myhelloworld, so I want to do something like the following in the myhelloworld application
<html>
<head>
<script src=”http://localhost:8080/helloworld/SCADomain/scaDomain.js”</script>
</head>
<body>
</body>
</html>
Please let me know if it’s possible or not.
Thanks and Regards
Ashish Malviya
Mobile No:+919999342340
__________________________________________________________________________
What gets us into trouble is not what we don't know. Its what we know for sure that just ain't so.
Explore and discover exciting holidays and getaways with Yahoo! India Travel http://in.travel.yahoo.com/
Re: Regarding Tuscany 1.4 example :helloworld-jsonrpc-webapp
Posted by Luciano Resende <lu...@gmail.com>.
I'd recommend looking into the store-webapp sample [1], it uses
implementation.widget which gives you little more flexibility and a
programming model more similar to what you have been using with SCA.
See more info in [2]
[1] https://svn.apache.org/repos/asf/tuscany/branches/sca-java-1.x/samples/store-webapp/
[2] http://tuscany.apache.org/sca-java-implementationwidget.html
On Mon, Jun 8, 2009 at 12:56 AM, Ashish
Malviya<as...@yahoo.co.in> wrote:
>
>
>
> Hi Team,
>
>
>
> As I can understand from this example, this SCA component is included in the
> web app by using a Javascript scaDomain.js.
>
>
>
> <script type="text/javascript" src="SCADomain/scaDomain.js"></script> is
> added to the html.
>
>
>
> Is there any way I can use this scaDomain.js in some other webapp and call
> the methods.
>
>
>
> Suppose the name of the application which is generating this Javascript is
> helloworld , we get this javascript on
>
> http://localhost:8080/helloworld/SCADomain/scaDomain.js
>
>
>
> What I want is to use this link in another application eg myhelloworld, so I
> want to do something like the following in the myhelloworld application
>
> <html>
>
> <head>
>
> <script
> src=”http://localhost:8080/helloworld/SCADomain/scaDomain.js”</script>
>
> </head>
>
> <body>
>
> </body>
>
> </html>
>
>
>
>
>
> Please let me know if it’s possible or not.
>
>
>
> Thanks and Regards
> Ashish Malviya
> Mobile No:+919999342340
> __________________________________________________________________________
> What gets us into trouble is not what we don't know. Its what we know for
> sure that just ain't so.
>
>
> ________________________________
> Share files, take polls, and make new friends - all under one roof. Click
> here.
--
Luciano Resende
Apache Tuscany, Apache PhotArk
http://people.apache.org/~lresende
http://lresende.blogspot.com/
Re: Regarding Tuscany 1.4 example :helloworld-jsonrpc-webapp
Posted by ant elder <an...@gmail.com>.
On Mon, Jun 8, 2009 at 8:56 AM, Ashish
Malviya<as...@yahoo.co.in> wrote:
>
>
>
> Hi Team,
>
>
>
> As I can understand from this example, this SCA component is included in the
> web app by using a Javascript scaDomain.js.
>
>
>
> <script type="text/javascript" src="SCADomain/scaDomain.js"></script> is
> added to the html.
>
>
>
> Is there any way I can use this scaDomain.js in some other webapp and call
> the methods.
>
>
>
> Suppose the name of the application which is generating this Javascript is
> helloworld , we get this javascript on
>
> http://localhost:8080/helloworld/SCADomain/scaDomain.js
>
>
>
> What I want is to use this link in another application eg myhelloworld, so I
> want to do something like the following in the myhelloworld application
>
> <html>
>
> <head>
>
> <script
> src=”http://localhost:8080/helloworld/SCADomain/scaDomain.js”</script>
>
> </head>
>
> <body>
>
> </body>
>
> </html>
>
>
>
>
>
> Please let me know if it’s possible or not.
>
>
>
> Thanks and Regards
> Ashish Malviya
No i don't think that would work, and nor will trying
<implementation.widget as suggested on the other thread. The problem
is that the client requests will get sent relative to the client not
to the origin of where the SCADomain script is loaded from so the
requests get sent to the client webapp which doesn't host the services
instead of the webapp where the scadomain script was loaded from.
We might be able to fix the scripts to make this work by determining
the script origin during initilization, however its likely you'd
sooner or later endup being hit by the browser "same origin policy"
restriction. The problem is that this isn't really what the JSONRPC is
for, we should really use the JSONP protocol to do what you want but
we've not finished that binding yet.
In the meantime you can "fiddle" things to make what you want work by
explicitly defining the service yourself. So in your myhelloworld html
replace the script line:
<script type="text/javascript" src="SCADomain/scaDomain.js"></script>
with these lines:
<script type="text/javascript"
src="http://localhost:8080/sample-helloworld-jsonrpc-webapp/SCADomain/scaDomain.js"></script>
<script language="JavaScript">
scaDomain.HelloWorldService = new
JSONRpcClient("http://localhost:8080/sample-helloworld-jsonrpc-webapp/HelloWorldService");
HelloWorldService = scaDomain.HelloWorldService.Service;
</script>
...ant