0 Replies Latest reply on Dec 1, 2011 10:29 AM by Jonathan Clarke

    No REST for the Wiki

    Jonathan Clarke Newbie
      Hi, I'm struggling with this problem, and I can't find any examples online or in the Seam example directory that could help with this one. I'm trying to implement a RESTful interface between two .ears on two separate machines. The whole transference mechanism works splendidly, but the data set in the object prior to the transference is not being maintained on the other side. I can see that the default constructor is being called on the recipient side, but the data is not making it. Here's some source to demonstrate the point:


      --------------------------------

      @XmlRootElement (name = "com.myapp.WebServices.RESTfulWrappedObject")
      public class RESTfulWrappedObject
           extends MyBaseClass {               
           
           private String fTest = "Nothing";
           
           public RESTfulWrappedObject() {
                super();
           }

           public void setTest() {
                fTest = "SetDone";
           }
           
           public String getTest() {
                return fTest;
           }
      }

      @Path("/ParticipantResource")
      public interface ParticipantResource {

           @POST
           @Path("/Object")     
           @Consumes("application/xml")
           public String addObject(
                RESTfulWrappedObject aRESTfulWrappedObject);     
      }

      @Name("participantHandler")
      @Scope(ScopeType.STATELESS)
      public class ParticipantHandler
           extends MyBaseClass
           implements ParticipantResource {

           public String addObject(
                RESTfulWrappedObject aRESTfulWrappedObject) {
           }
      }

      public class Worker {


           void doWork() {
               RESTfulWrappedObject fRESTfulWrappedObject = new
                    RESTfulWrappedObject(fProcessableURLsObject);
               fRESTfulWrappedObject.setTest();

              // HTTPClient Post method with fRestfulWrapperObject as XML string.
           }
      }

      ---------------------------

      The Worker class is where the WrappedObject is constructed and then posted from the origin .ear to the destination .ear. The fTest field is not making it to the destination with a value of "SetDone." It only ever stays as "Nothing." What am I missing that means that the data will be maintained during the unmarshalling?

      I hope you can help.

      Thanks.
      Jonathan.