You are viewing a plain text version of this content. The canonical link for it is here.
Posted to photark-dev@incubator.apache.org by Umashanthi Pavalanathan <um...@gmail.com> on 2011/08/04 14:53:11 UTC

Issues in accessing REST Services

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.


Thanks,
~Umashanthi

Re: Issues in accessing REST Services

Posted by Umashanthi Pavalanathan <um...@gmail.com>.
On Wed, Aug 10, 2011 at 4:12 AM, Luciano Resende <lu...@gmail.com>wrote:

> On Tue, Aug 9, 2011 at 8:40 AM, Umashanthi Pavalanathan
> <um...@gmail.com> wrote:
> >
> > Seems there is some progress now. There were some errors due to not
> locating
> > tuscany servlet filter and an unwanted white space in the .composite
> file,
> > etc.
> > Now when I deploy the war and start the server, I am getting the
> following
> > logs.
> >
> > http://pastebin.com/Y8RC064M
> >
> > These logs about binding end points etc were not present in my earlier
> > tries.
> >
> > But still when I do a
> >              GET http://localhost:8080/people/admin/@self
> > request, getting the 404 error.
> >
> > It would be great if someone can clarify any bugs with the current
> > configuration.
> >
>
> Not sure if this is just a typo on the URL you are trying and getting
> 404, but from the logs, Tuscany is registering :
> http://umashanthi:8080/photark/people/* ... Note the photark context
> which is different from the URL you are getting 404.
>

No. I tried both ways:
http://localhost:8080/photark/people/*
http://localhost:8080/people/*

But, both are giving 404 error.

I have attached a patch containing the current version my code to the JIRA
at [0] (Including photark-social-ui component in the same patch) for your
reference.
Still trying to figure out the issue with it.


[0]
https://issues.apache.org/jira/secure/attachment/12489938/patch_10_8_2011_v1.patch

Thanks,
~Umashanthi



>
> > One thing to note is, there is no data returned from the getPerson()
> since
> > there are no records. Does this cause the 404 issue?
> >
>
> No, no data would be 200 or 204.
>
> --
> Luciano Resende
> http://people.apache.org/~lresende
> http://twitter.com/lresende1975
> http://lresende.blogspot.com/
>

Re: Issues in accessing REST Services

Posted by Luciano Resende <lu...@gmail.com>.
On Tue, Aug 9, 2011 at 8:40 AM, Umashanthi Pavalanathan
<um...@gmail.com> wrote:
>
> Seems there is some progress now. There were some errors due to not locating
> tuscany servlet filter and an unwanted white space in the .composite file,
> etc.
> Now when I deploy the war and start the server, I am getting the following
> logs.
>
> http://pastebin.com/Y8RC064M
>
> These logs about binding end points etc were not present in my earlier
> tries.
>
> But still when I do a
>              GET http://localhost:8080/people/admin/@self
> request, getting the 404 error.
>
> It would be great if someone can clarify any bugs with the current
> configuration.
>

Not sure if this is just a typo on the URL you are trying and getting
404, but from the logs, Tuscany is registering :
http://umashanthi:8080/photark/people/* ... Note the photark context
which is different from the URL you are getting 404.

> One thing to note is, there is no data returned from the getPerson() since
> there are no records. Does this cause the 404 issue?
>

No, no data would be 200 or 204.

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

Re: Issues in accessing REST Services

Posted by Umashanthi Pavalanathan <um...@gmail.com>.
On Tue, Aug 9, 2011 at 3:40 PM, Luciano Resende <lu...@gmail.com>wrote:

> On Thu, Aug 4, 2011 at 6:21 PM, Umashanthi Pavalanathan
> <um...@gmail.com> wrote:
> > On Thu, Aug 4, 2011 at 11:35 PM, Luciano Resende <luckbr1975@gmail.com
> >wrote:
> >
> >> On Thursday, August 4, 2011, Umashanthi Pavalanathan <
> >> umashanthip@gmail.com>
> >> wrote:
> >> > On Thu, Aug 4, 2011 at 8:34 PM, Luciano Resende <luckbr1975@gmail.com
> >> >wrote:
> >> >
> >> >> On Thu, Aug 4, 2011 at 7:53 AM, Umashanthi Pavalanathan
> >> >> <um...@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
> >> >
> >> >
> >> > I added the people.composite and sca-contribution.xml to
> >> > photark-social-ui/src/main/webapp/META-INF
> >> >
> >> > <contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912
> "
> >> >              xmlns:photark="http://org.apache.photoark">
> >> >   <deployable composite="*photark:people*"/>
> >> > </contribution>
> >> >
> >> > I hope "photark:people" above in the sca-contribution.xml is correct.
> >> >
> >> > But still getting the same 404 error.
> >> >
> >> > Unfortunately there are no log entries in the tomcat logs about
> end-point
> >> > registration.
> >> >
> >> >
> >> >
> >> >
> >> > Thanks,
> >> > ~Umashanthi
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >>
> >> >>
> >>
> >> Then you might be missing the tuscany filter in web.xml, please check
> the
> >> one in trunk for an example
> >>
> >
> > I tried with the following entry in the web.xml
> >
> > <web-app ...>
> > <display-name>PhotArk photo gallery web application</display-name>
> >  <filter>
> > <filter-name>tuscany</filter-name>
> >
> <filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>
> >  </filter>
> > <filter-mapping>
> > <filter-name>tuscany</filter-name>
> >  <url-pattern>/people</url-pattern>
> > </filter-mapping>
> > </web-app>
> >
> > After doing this configuration, I couldn't access even the profile page
> > which is under photark/home/profile.html
> > How can I make this url-pattern mapping to enable both tuscany filters
> and
> > other html pages?
> >
> >
> >
>
> Try making url-pattern '/*' instead of '/people', that should solve it.
>

Seems there is some progress now. There were some errors due to not locating
tuscany servlet filter and an unwanted white space in the .composite file,
etc.
Now when I deploy the war and start the server, I am getting the following
logs.

http://pastebin.com/Y8RC064M

These logs about binding end points etc were not present in my earlier
tries.

But still when I do a
              GET http://localhost:8080/people/admin/@self
request, getting the 404 error.

It would be great if someone can clarify any bugs with the current
configuration.

One thing to note is, there is no data returned from the getPerson() since
there are no records. Does this cause the 404 issue?


Thanks,
~Umashanthi




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

Re: Issues in accessing REST Services

Posted by Luciano Resende <lu...@gmail.com>.
On Thu, Aug 4, 2011 at 6:21 PM, Umashanthi Pavalanathan
<um...@gmail.com> wrote:
> On Thu, Aug 4, 2011 at 11:35 PM, Luciano Resende <lu...@gmail.com>wrote:
>
>> On Thursday, August 4, 2011, Umashanthi Pavalanathan <
>> umashanthip@gmail.com>
>> wrote:
>> > On Thu, Aug 4, 2011 at 8:34 PM, Luciano Resende <luckbr1975@gmail.com
>> >wrote:
>> >
>> >> On Thu, Aug 4, 2011 at 7:53 AM, Umashanthi Pavalanathan
>> >> <um...@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
>> >
>> >
>> > I added the people.composite and sca-contribution.xml to
>> > photark-social-ui/src/main/webapp/META-INF
>> >
>> > <contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
>> >              xmlns:photark="http://org.apache.photoark">
>> >   <deployable composite="*photark:people*"/>
>> > </contribution>
>> >
>> > I hope "photark:people" above in the sca-contribution.xml is correct.
>> >
>> > But still getting the same 404 error.
>> >
>> > Unfortunately there are no log entries in the tomcat logs about end-point
>> > registration.
>> >
>> >
>> >
>> >
>> > Thanks,
>> > ~Umashanthi
>> >
>> >
>> >
>> >
>> >
>> >
>> >>
>> >>
>>
>> Then you might be missing the tuscany filter in web.xml, please check the
>> one in trunk for an example
>>
>
> I tried with the following entry in the web.xml
>
> <web-app ...>
> <display-name>PhotArk photo gallery web application</display-name>
>  <filter>
> <filter-name>tuscany</filter-name>
> <filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>
>  </filter>
> <filter-mapping>
> <filter-name>tuscany</filter-name>
>  <url-pattern>/people</url-pattern>
> </filter-mapping>
> </web-app>
>
> After doing this configuration, I couldn't access even the profile page
> which is under photark/home/profile.html
> How can I make this url-pattern mapping to enable both tuscany filters and
> other html pages?
>
>
>

Try making url-pattern '/*' instead of '/people', that should solve it.


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

Re: Issues in accessing REST Services

Posted by Umashanthi Pavalanathan <um...@gmail.com>.
On Thu, Aug 4, 2011 at 11:35 PM, Luciano Resende <lu...@gmail.com>wrote:

> On Thursday, August 4, 2011, Umashanthi Pavalanathan <
> umashanthip@gmail.com>
> wrote:
> > On Thu, Aug 4, 2011 at 8:34 PM, Luciano Resende <luckbr1975@gmail.com
> >wrote:
> >
> >> On Thu, Aug 4, 2011 at 7:53 AM, Umashanthi Pavalanathan
> >> <um...@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
> >
> >
> > I added the people.composite and sca-contribution.xml to
> > photark-social-ui/src/main/webapp/META-INF
> >
> > <contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
> >              xmlns:photark="http://org.apache.photoark">
> >   <deployable composite="*photark:people*"/>
> > </contribution>
> >
> > I hope "photark:people" above in the sca-contribution.xml is correct.
> >
> > But still getting the same 404 error.
> >
> > Unfortunately there are no log entries in the tomcat logs about end-point
> > registration.
> >
> >
> >
> >
> > Thanks,
> > ~Umashanthi
> >
> >
> >
> >
> >
> >
> >>
> >>
>
> Then you might be missing the tuscany filter in web.xml, please check the
> one in trunk for an example
>

I tried with the following entry in the web.xml

<web-app ...>
<display-name>PhotArk photo gallery web application</display-name>
 <filter>
<filter-name>tuscany</filter-name>
<filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>
 </filter>
<filter-mapping>
<filter-name>tuscany</filter-name>
 <url-pattern>/people</url-pattern>
</filter-mapping>
</web-app>

After doing this configuration, I couldn't access even the profile page
which is under photark/home/profile.html
How can I make this url-pattern mapping to enable both tuscany filters and
other html pages?



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

Re: Issues in accessing REST Services

Posted by Luciano Resende <lu...@gmail.com>.
On Thursday, August 4, 2011, Umashanthi Pavalanathan <um...@gmail.com>
wrote:
> On Thu, Aug 4, 2011 at 8:34 PM, Luciano Resende <luckbr1975@gmail.com
>wrote:
>
>> On Thu, Aug 4, 2011 at 7:53 AM, Umashanthi Pavalanathan
>> <um...@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
>
>
> I added the people.composite and sca-contribution.xml to
> photark-social-ui/src/main/webapp/META-INF
>
> <contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
>              xmlns:photark="http://org.apache.photoark">
>   <deployable composite="*photark:people*"/>
> </contribution>
>
> I hope "photark:people" above in the sca-contribution.xml is correct.
>
> But still getting the same 404 error.
>
> Unfortunately there are no log entries in the tomcat logs about end-point
> registration.
>
>
>
>
> Thanks,
> ~Umashanthi
>
>
>
>
>
>
>>
>>

Then you might be missing the tuscany filter in web.xml, please check the
one in trunk for an example

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

Re: Issues in accessing REST Services

Posted by Umashanthi Pavalanathan <um...@gmail.com>.
On Thu, Aug 4, 2011 at 8:34 PM, Luciano Resende <lu...@gmail.com>wrote:

> On Thu, Aug 4, 2011 at 7:53 AM, Umashanthi Pavalanathan
> <um...@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


I added the people.composite and sca-contribution.xml to
photark-social-ui/src/main/webapp/META-INF

<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
              xmlns:photark="http://org.apache.photoark">
   <deployable composite="*photark:people*"/>
</contribution>

I hope "photark:people" above in the sca-contribution.xml is correct.

But still getting the same 404 error.

Unfortunately there are no log entries in the tomcat logs about end-point
registration.




Thanks,
~Umashanthi






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

Re: Issues in accessing REST Services

Posted by Luciano Resende <lu...@gmail.com>.
On Thu, Aug 4, 2011 at 7:53 AM, Umashanthi Pavalanathan
<um...@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/