6 Replies Latest reply on Jul 4, 2013 6:56 AM by luisdeltoro

    Service References from different components are overwritten

    luisdeltoro

      I'm trying to accomplish the following:

       

      having a Service A with a java interface (ServiceA)

      having a Service B and a Service C that reference Service A, but instead of using the java interface defined by the service (ServiceA), they use two variants or this interface (ServiceBToServiceARef and ServiceCtoServiceARef). These are very similar to ServiceA but the input parameters are different.

      In this way that want to assure that ServiceA uses its own "model" ObjectA, while ServiceB and Service use as well their own "models" ObjectB and ObjectC and leave to the Switchyard transformers the responsibility of transforming (ObjectB to ObjectA and ObjectC to ObjectA)

       

      The behaviour I'm observing in Switchyard is that the Service Reference defined by ServiceBToServiceARef is overwriten by the Service Reference defined by ServiceCToServiceARef.

       

      I was wondering if this behaviour is normal.

       

      Example:

       

      public class ServiceA {

           void operation1(ObjectA input);

      }

       

      public class ServiceBToServiceARef {

           void operation1(ObjectB input);

      }

       

      public class ServiceCtoServiceARef {

           void operation1(ObjectC input);

      }

       

      <?xml version="1.0" encoding="UTF-8"?><switchyard xmlns="urn:switchyard-config:switchyard:1.0" name="xx" targetNamespace="urn:sxx:xx:0.1.0">

          <composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" name="orders" targetNamespace="urn:xx:xx:0.1.0">

              <component name="ServiceA">

                  <implementation.bean xmlns="urn:switchyard-component-bean:config:1.0" class="xx"/>

                  <service name="ServiceA">

                      <interface.java interface="ServiceA"/>

                  </service>

              </component>

              <component name="ServiceB">

                  <implementation.bean xmlns="urn:switchyard-component-bean:config:1.0" class="xx"/>

                  <service name="ServiceB">

                      <interface.java interface="ServiceB"/>

                  </service>

                  <reference name="ServiceA">

                      <interface.java interface="ServiceBToServiceARef"/>

                  </reference>

              </component>

              <component name="ServiceC">

                  <implementation.bean xmlns="urn:switchyard-component-bean:config:1.0" class="xx"/>

                  <service name="ServiceC">

                      <interface.java interface="ServiceC"/>

                  </service>

                  <reference name="ServiceA">

                      <interface.java interface="ServiceCToServiceARef"/>

                  </reference>

              </component>

          </composite>

          <transforms>

                     {here that transformers from ObjectB to ObjectA and ObjectC to ObjectA are defined}

          </transforms>

      </switchyard>