incubator-photark-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luciano Resende <luckbr1...@gmail.com>
Subject Re: Issues in accessing REST Services
Date Thu, 04 Aug 2011 15:04:56 GMT
On Thu, Aug 4, 2011 at 7:53 AM, Umashanthi Pavalanathan
<umashanthip@gmail.com> wrote:
> Hi Devs,
>
> I added a UI component to the REST branch to implement UI features for the
> social component. I build a war out of it and deployed in tomcat.
> The configurations as below:
>  (1) Composite file: I have this in path
> "/photark-social/src/main/resources/personservice.composite"
> <composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
> xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
>  targetNamespace="http://org.apache.photoark"
> name="people">
>
>    <!-- Component responsible for providing JCR Management Support -->
>    <component name="RepositoryManager">
> <implementation.java
> class="org.apache.photark.services.jcr.JCRRepositoryManager"/>
>  <property name="repositoryHome">target/photark</property>
> </component>
>  <component name="PersonServiceComponent">
> <implementation.java
> class="org.apache.photark.social.services.impl.JCRPersonServiceImpl "/>
>  <service name="PersonService">
> <tuscany:binding.rest uri="/people">
>    <tuscany:operationSelector.jaxrs />
>     </tuscany:binding.rest>
>   </service>
>   <reference name="repositoryManager" target="RepositoryManager" />
>  </component>
> </composite>
>
> (2) Service interface PersonService has method and JCRPersonServiceImpl has
> the implementation of this method
> @GET
> @Produces(MediaType.APPLICATION_JSON)
> @Path("/people/{userId}/@self")
>  Person getPerson(@PathParam("userId") String personId, String[] fields)
> throws PhotArkSocialException;
>
> When I tried with the following request from the UI, I am getting 404
> resource not found error.
>
> (3)
> userId = "admin"; // need to retrieve the userId of the loggen in user
>  var xhrArgs = {
> url : "/people/" + userId + "/@self",
>  handleAs : "json",
> headers : {
> "Accept" : "application/json"
>  }
> };
> var deferred = dojo.xhrGet(xhrArgs);
>  deferred.addCallback(getPersonCallback);
> deferred.addErrback(function(error) {
>  alert("An unexpected error occurred: " + error);
> });
>
> It would be great if you can let me know the possible changes to be done to
> make this working.

Check catalina.out and see if the /people/* endpoint is being
registered, if not, you might need to add a sca-contribution.xml and
define "people" composite as deployable. See [1] for an example.

[1] https://svn.apache.org/repos/asf/incubator/photark/trunk/photark-webapp/src/main/webapp/META-INF/sca-contribution.xml

-- 
Luciano Resende
http://people.apache.org/~lresende
http://twitter.com/lresende1975
http://lresende.blogspot.com/

Mime
View raw message