1 Reply Latest reply on Mar 24, 2011 8:57 AM by injpix

    BlazeDS Service creation




      Which class does BlazeDS use to create the remote service object?


      e.g: I say to the BlazeDS the destination. (e.g = "helloWorldService"). So, where this destination is turned into a concrete class?

        • 1. Re: BlazeDS Service creation
          injpix Level 3

          I am fairly new to BlazeDS, but from my understanding is that, the remote objects are created by hand.  They're Java objects, POJOs.  Then on the server, in the services-config.xml, you would create your end-point.


          <!-- services-config.xml -->
               <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
                    <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>


          You will then need to config the web.xml to handle the servlets...

          <!-- web.xml -->
          <servlet-mapping id="RDS_DISPATCH_MAPPING">


          If you are asking about what remote class is mirrored for the Flex application, the data wizard in Flash Builder generated a com.adobe.fiber.services.wrapper.RemoteObjectServiceWrapper  sub-class for my remote service.  In the construct of this sub-class, it has the following:


              public function _Super_Foo()
                  // initialize service control
                  _serviceControl = new mx.rpc.remoting.RemoteObject();
                  // initialize RemoteClass alias for all entities returned by functions of this service
                  var operations:Object = new Object();
                  var operation:mx.rpc.remoting.Operation;
                  operation = new mx.rpc.remoting.Operation(null, "getBars");
                   operation.resultElementType = valueObjects.Bar;
                  operations["getBars"] = operation;
                  operation = new mx.rpc.remoting.Operation(null, "addBar");
                  operations["addBar"] = operation;
                  operation = new mx.rpc.remoting.Operation(null, "removeBar");
                  operations["removeBar"] = operation;
                  _serviceControl.operations = operations;
                  _serviceControl.convertResultHandler = com.adobe.serializers.utility.TypeUtility.convertResultHandler;
                  _serviceControl.endpoint = "http://localhost:8080//messagebroker/amf";
                  destination = "foo";


          The remote service that I have is a Java class named 'Foo'.  Notice the destination is 'foo'.


          I'm using Spring BlazeDS with Hibernate, so there my be some differences.  The only references that I have used to grasp Spring BlazeDS is from James Ward.  All of the code above, is mostly explained by him in the following references.