Hi, >If you are trying to overcome the javscript domain limitation, you >need to use JSONP more like the following :
>function getGreeting() { > var name = document.getElementById("name").value; > $.getJSON('http://localhost:8081/HelloWorldService/sayHello?name=' > + name + '&callback=?', handleResponse); > } > function handleResponse(data) { > document.getElementById('greeting').innerHTML=data; > } I have also tried a similar approach like the one proposed in project binding-jsonp-runtime: <script language="JavaScript"><!-- function getGreeting() { var sortingCriteria = 'byPromotion'; var url='http://localhost:8080/CreateLearningGoalsService/getAvailableCompetences?sortingCriteria=' + sortingCriteria + '&callback=?', handleResponse; $.getJSON(url); }; function handleResponse(data) { document.getElementById('greeting').innerHTML=data; }; </script> >Please take a look at the example I ported to 2.x as it seems you are >till trying to configure your service trough promotion, this is what >is causing your service endpoint not to be available... and you are >STILL using JSON-RPC instead of JSONP binding I copied by mistake composite file from old project, but actually I used <tuscany:binding.jsonp/> >What are you trying here with the CallBack ? I tried many different thinks here in order to make this work. This was what I have tried at the end. I can't recognize what is the difference between my code and provided example. I put my project online if you can try to see if I made some mistake. http://zoranjeremic.org/files/intelleo_lpc_ws.rar Thanks, Zoran ________________________________ From: Luciano Resende <luckbr1...@gmail.com> To: Zoran Jeremic <jeremic1...@yahoo.com> Cc: user@tuscany.apache.org Sent: Sat, March 13, 2010 8:27:33 PM Subject: Re: javascript client On Sat, Mar 13, 2010 at 11:16 AM, Zoran Jeremic <jeremic1...@yahoo.com> wrote: > Hi, > > I thought that my problems are over, but unfortunately I still have a > problem to connect client web page with tuscany web server. I did everything > as you suggested but I firebug gives an error 404 method not found message. > > This is code integrated in web page: > $(document).ready(function(){ > > $.getJSON("http://ZoranPC:8080/CreateLearningGoalsService/getServiceTest"); > }); > If you are trying to overcome the javscript domain limitation, you need to use JSONP more like the following : function getGreeting() { var name = document.getElementById("name").value; $.getJSON('http://localhost:8081/HelloWorldService/sayHello?name=' + name + '&callback=?', handleResponse); } function handleResponse(data) { document.getElementById('greeting').innerHTML=data; } > This is the content of the composite file: > > <?xml version="1.0" encoding="UTF-8"?> > > xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1" > name="lpc" > targetNamespace="http://eclipse.org/intelleo-LPC/src/org/intelleo/ws/lpc"> > <component name="CreateLearningGoalsServiceComponent"> > <implementation.java > class="org.intelleo.ws.lpc.impl.CreateLearningGoalsImpl"/> > <reference name="availableCompetencesService" > target="AvailableCompetencesComponent/AvailableCompetencesService"/> > <service name="CreateLearningGoalsService"> > <interface.java > interface="org.intelleo.ws.lpc.interfaces.CreateLearningGoalsService"> > <tuscany:binding.jsonrpc/> > </interface.java> > </service> > </component> > <component name="AvailableCompetencesComponent"> > <implementation.java > class="org.intelleo.ws.lpc.impl.AvailableCompetencesImpl"/> > <service name="AvailableCompetencesService"> > <interface.java > interface="org.intelleo.ws.lpc.interfaces.AvailableCompetencesService"/> > </service> > </component> > <service name="CreateLearningGoalsService" > promote="CreateLearningGoalsServiceComponent/CreateLearningGoalsService"> > <interface.java > interface="org.intelleo.ws.lpc.interfaces.CreateLearningGoalsService"/> > <tuscany:binding.jsonrpc/> > </service> > </composite> > Please take a look at the example I ported to 2.x as it seems you are till trying to configure your service trough promotion, this is what is causing your service endpoint not to be available... and you are STILL using JSON-RPC instead of JSONP binding > CreateLearningGoalsService class defines two methods: > > @Callback > String getAvailableCompetences(String sortingCriteria); > void getServiceTest(); > What are you trying here with the CallBack ? -- Luciano Resende http://people.apache.org/~lresende http://twitter.com/lresende1975 http://lresende.blogspot.com/