5 Replies Latest reply on Aug 25, 2013 8:04 PM by calca

    REST switchyard.xml configuration

    anikulin

      I tried to define a service binding via REST, created a promote service and binded it with REST binding in SwitchYard Visual Editor in Eclipse. But after saving a have an error in this xml file.
      My switchyard.xml is like this:

       

      <?xml version="1.0" encoding="UTF-8"?>

      <switchyard xmlns="urn:switchyard-config:switchyard:1.0" xmlns:bean="urn:switchyard-component-bean:config:1.0" xmlns:rest="urn:switchyard-component-resteasy:config:1.0" xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912">

        <sca:composite name="trade-service" targetNamespace="urn:com.magick:trade-service:0.0.1-SNAPSHOT">

          <sca:component name="OrderServiceBean">

            <bean:implementation.bean class="com.magick.trade_service.service.OrderServiceBean"/>

            <sca:service name="OrderService">

              <sca:interface.java interface="com.magick.trade_service.service.OrderService"/>

            </sca:service>

          </sca:component>

          <sca:service name="OrderService" promote="OrderServiceBean/OrderService">

            <sca:interface.java interface="com.magick.trade_service.service.OrderService"/>

            <rest:binding.rest>

              <rest:interfaces>com.magick.trade_service.service.OrderService</rest:interfaces>

              <rest:contextPath>order-service</rest:contextPath>

            </rest:binding.rest>

          </sca:service>

        </sca:composite>

      </switchyard>

       

      And I have such error:

      cvc-complex-type.2.4.a: Invalid content was found starting with element 'rest:binding.rest'. One of '{"http://docs.oasis-open.org/ns/opencsa/sca/200912":binding, "http://docs.oasis-open.org/ns/opencsa/sca/200912":callback, "http://docs.oasis-open.org/ns/opencsa/sca/200912":requires, "http://docs.oasis-open.org/ns/opencsa/sca/200912":policySetAttachment, "http://docs.oasis-open.org/ns/opencsa/sca/200912":extensions}' is expected.


      I've compared this xml with SwitchYard rest-binding quickstart, it is almost the same.

       

      Can you help me to solve this problem?

       

      thanks.

        • 1. Re: REST switchyard.xml configuration
          kcbabo

          Do you see this in Eclipse or via a Maven build from command-line?


          For Eclipse, you need to disable the following setting

          Preferences -> XML -> XML Files -> Validation -> Honour all XML schema locations

           

          If you see it in Maven, try forcing an update of your local repository

          mvn -U clean install
          
          • 2. Re: REST switchyard.xml configuration
            anikulin

            I see this as error an Eclipse. I've already disable Honour all XML schema locations field, but I still have such error.

             

            Moreover, when I try to run tests using 0.6.0-SNAPSHOT version I have such error:

            java.lang.NoClassDefFoundError: org/apache/camel/impl/DefaultCamelContext

             

            But if I change version to 0.5.0.Final they successfully passed.

            • 3. Re: REST switchyard.xml configuration
              kcbabo

              If this works with 0.5.0.Final then it's almost certainly an issue with stale 0.6.0-SNAPSHOT artifacts in your repository.  When running maven from the command-line to build your project, just use the "-U" flag as suggested above.

              • 4. Re: REST switchyard.xml configuration
                anikulin

                Thanks a lot. It helped me.

                • 5. Re: REST switchyard.xml configuration
                  calca

                  Hey Guys.

                  I am using SY 0.8, and having the same error. My switchyard.xml looks like this:

                   

                  <?xml version="1.0" encoding="UTF-8"?>

                  <switchyard xmlns="urn:switchyard-config:switchyard:1.0" xmlns:bean="urn:switchyard-component-bean:config:1.0" xmlns:rest="urn:switchyard-component-resteasy:config:1.0" xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912">

                    <sca:composite name="my-service" targetNamespace="urn:com.myservice:0.0.1-SNAPSHOT">

                      <sca:component name="SomeServiceImpl">

                        <bean:implementation.bean class="com.SomeServiceImpl"/>

                        <sca:service name="SomeService">

                          <sca:interface.java interface="com.SomeService"/>

                        </sca:service>

                      </sca:component>

                      <sca:service name="SomeService" promote="SomeService/SomeService">

                        <sca:interface.java interface="com.SomeService"/>

                        <rest:binding.rest>

                          <rest:interfaces>com.SomeService</rest:interfaces>

                          <rest:contextPath>rest-binding</rest:contextPath>

                        </rest:binding.rest>

                      </sca:service>

                    </sca:composite>

                  </switchyard>

                   

                  And when I try to compile my project I get (mvn clean install -Dmaven.test.skip=true -U).

                   

                  Any idea?

                   

                  Thanks!

                  Demian

                  [ERROR] Failed to execute goal org.switchyard:switchyard-plugin:0.8.0.Final:configure (default) on project myproject: Model [org.switchyard.config.model.switchyard.v1.V1SwitchYardModel] is invalid: cvc-complex-type.2.4.a: Se ha encontrado contenido no válido a partir del elemento 'rest:binding.rest'. Se esperaba uno de '{"http://docs.oasis-open.org/ns/opencsa/sca/200912":binding, "http://docs.oasis-open.org/ns/opencsa/sca/200912":callback, "http://docs.oasis-open.org/ns/opencsa/sca/200912":requires, "http://docs.oasis-open.org/ns/opencsa/sca/200912":policySetAttachment, "http://docs.oasis-open.org/ns/opencsa/sca/200912":extensions}'. -> [Help 1]