1 2 Previous Next 15 Replies Latest reply: Jul 3, 2012 9:41 AM by Rob Cernich RSS

    Issue with switchyard.xml generated in SCA editor 0.5.0.beta1

    Gary Brown Master

      Hi

       

      I created the following switchyard.xml using the SCA editor:

       

       

      <?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:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" name="switchyard-example" targetNamespace="urn:com.example.switchyard:switchyard-example:0.0.1-SNAPSHOT">
        <sca:composite name="switchyard-example" targetNamespace="urn:com.example.switchyard:switchyard-example:0.0.1-SNAPSHOT">
          <sca:component name="StoreImpl">
            <bean:implementation.bean class="org.savara.examples.store.StoreImpl"/>
            <sca:service name="Store">
              <sca:interface.java interface="org.savara.examples.store.Store"/>
            </sca:service>
            <sca:reference name="CreditAgency">
              <sca:interface.java interface="org.savara.examples.creditagency.CreditAgency"/>
            </sca:reference>
            <sca:reference name="Logistics">
              <sca:interface.java interface="org.savara.examples.logistics.Logistics"/>
            </sca:reference>
          </sca:component>
          <sca:service name="Store" promote="StoreImpl/Store">
            <sca:interface.wsdl interface="wsdl/PurchaseGoods_Store.wsdl#wsdl.porttype(Store)"/>
          </sca:service>
          <sca:reference name="CreditAgency" multiplicity="0..1" promote="StoreImpl/CreditAgency">
            <sca:interface.wsdl interface="wsdl/PurchaseGoods_CreditAgency.wsdl#wsdl.porttype(CreditAgency)"/>
          </sca:reference>
          <sca:reference name="Logistics" multiplicity="0..1" promote="StoreImpl/Logistics">
            <sca:interface.wsdl interface="wsdl/PurchaseGoods_Logistics.wsdl#wsdl.porttype(Logistics)"/>
          </sca:reference>
        </sca:composite>
      </switchyard>
      

       

      but I'm getting XML schema validation errors of the form:

       

      cvc-complex-type.2.4.a: Invalid content was found starting with element 'sca:interface.java'. One of '{"http://docs.oasis-open.org/ns/opencsa/sca/200912":documentation, "http://docs.oasis-open.org/ns/opencsa/sca/200912":interface, "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.

       

      related to the sca:interface.java and sca:interface.wsdl elements.

       

      Any ideas? I'm using indigo with the site assembly from the download page.

       

      Regards

      Gary

        • 1. Re: Issue with switchyard.xml generated in SCA editor 0.5.0.beta1
          Keith Babo Master


          Does it build from the command-line with Maven?  If so, then it's likely an issue with your Eclipse settings.  Under XML - Validation - respect all schema locations (or something like that) needs to be disabled.  If it doesn't build from command-line, then it might be a jaxen incompatibility with our config stuff which we've seen recently.  If it's not the former, can you attach the project to the thread?

          • 2. Re: Issue with switchyard.xml generated in SCA editor 0.5.0.beta1
            Gary Brown Master

            Project attached, I got the following:

             

            [ERROR] Failed to execute goal org.switchyard:switchyard-plugin:0.5.0.Beta1:configure (default) on project switchyard-example: Model [org.switchyard.config.model.switchyard.v1.V1SwitchYardModel] is invalid: cvc-complex-type.2.4.a: Invalid content was found starting with element 'sca:interface.wsdl'. 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. -> [Help 1]

             

            I'm using:

             

            Apache Maven 3.0.4 (r1232337; 2012-01-17 08:44:56+0000)

            Java version: 1.7.0_03-icedtea, vendor: Oracle Corporation

             

            Regards

            Gary

            • 3. Re: Issue with switchyard.xml generated in SCA editor 0.5.0.beta1
              Keith Babo Master

              Here's what I get with "mvn clean install" :

               

              [ERROR] COMPILATION ERROR : 
              [INFO] -------------------------------------------------------------
              [ERROR] /private/tmp/switchyard-example/src/main/java/org/savara/examples/logistics/LogisticsService.java:[61,8] cannot find symbol
              symbol  : constructor Service(java.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFeature[])
              location: class javax.xml.ws.Service
              [ERROR] /private/tmp/switchyard-example/src/main/java/org/savara/examples/logistics/LogisticsService.java:[68,8] cannot find symbol
              symbol  : constructor Service(java.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFeature[])
              location: class javax.xml.ws.Service
              [ERROR] /private/tmp/switchyard-example/src/main/java/org/savara/examples/logistics/LogisticsService.java:[75,8] cannot find symbol
              symbol  : constructor Service(java.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFeature[])
              location: class javax.xml.ws.Service
              [ERROR] /private/tmp/switchyard-example/src/main/java/org/savara/examples/creditagency/CreditAgencyService.java:[61,8] cannot find symbol
              symbol  : constructor Service(java.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFeature[])
              location: class javax.xml.ws.Service
              [ERROR] /private/tmp/switchyard-example/src/main/java/org/savara/examples/creditagency/CreditAgencyService.java:[68,8] cannot find symbol
              symbol  : constructor Service(java.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFeature[])
              location: class javax.xml.ws.Service
              [ERROR] /private/tmp/switchyard-example/src/main/java/org/savara/examples/creditagency/CreditAgencyService.java:[75,8] cannot find symbol
              symbol  : constructor Service(java.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFeature[])
              location: class javax.xml.ws.Service
              [ERROR] /private/tmp/switchyard-example/src/main/java/org/savara/examples/store/StoreService.java:[61,8] cannot find symbol
              symbol  : constructor Service(java.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFeature[])
              location: class javax.xml.ws.Service
              [ERROR] /private/tmp/switchyard-example/src/main/java/org/savara/examples/store/StoreService.java:[68,8] cannot find symbol
              symbol  : constructor Service(java.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFeature[])
              location: class javax.xml.ws.Service
              [ERROR] /private/tmp/switchyard-example/src/main/java/org/savara/examples/store/StoreService.java:[75,8] cannot find symbol
              symbol  : constructor Service(java.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFeature[])
              location: class javax.xml.ws.Service
              [INFO] 9 errors 
              [INFO] -------------------------------------------------------------
              [INFO] ------------------------------------------------------------------------
              [INFO] BUILD FAILURE
              [INFO] ------------------------------------------------------------------------
              [INFO] Total time: 12.929s
              [INFO] Finished at: Mon Jul 02 08:49:00 EDT 2012
              [INFO] Final Memory: 25M/81M
              [INFO] ------------------------------------------------------------------------
              
              • 4. Re: Issue with switchyard.xml generated in SCA editor 0.5.0.beta1
                Gary Brown Master

                Hi

                 

                Looks like a jdk 1.7 issue - the javax.xml.ws.Service class has an additional construct which the cxf web service generator must take into account when generating the code.

                 

                If you don't have access to jdk1.7 I can attach a modified version.

                 

                Regards

                Gary

                • 5. Re: Issue with switchyard.xml generated in SCA editor 0.5.0.beta1
                  Keith Babo Master

                  I've been lazy about updating.  I just grabbed the latest JDK, but probably won't get around to upgrading until tonight (just in case things go wonky).  It would be interesting to know whether this is a JDK 6 vs. JDK 7 thing.

                  • 6. Re: Issue with switchyard.xml generated in SCA editor 0.5.0.beta1
                    Keith Babo Master

                    And you should be using @Service with a SOAP gateway binding!  ;-)

                    • 7. Re: Issue with switchyard.xml generated in SCA editor 0.5.0.beta1
                      Gary Brown Master

                      I've attached an updated version with the three classes removed, as they were client side anyway.

                       

                      Which class should have the @Service annotation - the ServiceImpl.java already has this?

                      • 8. Re: Issue with switchyard.xml generated in SCA editor 0.5.0.beta1
                        Keith Babo Master

                        OK, checked out the switchyard.xml and it is indeed schema invalid.  The interface definition for your composite service is after your binding definition.  It needs to be the other way around.  Once I changed that, the project builds fine.

                         

                        Did you hand edit the XML at any point or remove/change the composite service with the editor at some point?  Reason I ask is I just tested promoting a composite service and creating the composite service first and both work.  If you can give me a set of steps to reproduce this behavior in the tooling, that would be great.

                        • 9. Re: Issue with switchyard.xml generated in SCA editor 0.5.0.beta1
                          Keith Babo Master

                          Regarding the @Service comment, the compile error on javax.xml.ws packages got my spidey sense going and I just assumed you were using @WebService in there.  As a general note, we encourage the use of services/references vs. binding-specific annotations so that you have the greatest degree of flexibility at deployment/packaging time.  For references, it also has the additional benefit of tracking the dependency.

                          • 10. Re: Issue with switchyard.xml generated in SCA editor 0.5.0.beta1
                            Gary Brown Master

                            Originally the binding/interface were the other way around, I think I changed it to see if it would make a difference. However I was still getting the schema validation issues before making that change.

                             

                            Have you tried with the binding completely removed, which should be equivalent to the original xml at the start of this thread?

                             

                            Regarding the annotations, the main reason they were there is that I use cxf to generate the classes, and then replace the annotation on the implementation classes with the switchyard @Service.

                             

                            Regards

                            Gary

                            • 11. Re: Issue with switchyard.xml generated in SCA editor 0.5.0.beta1
                              Keith Babo Master

                              Still works without the binding ...

                               

                               

                              <switchyard xmlns="urn:switchyard-config:switchyard:1.0" xmlns:bean="urn:switchyard-component-bean:config:1.0" xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" xmlns:soap="urn:switchyard-component-soap:config:1.0" name="switchyard-example" targetNamespace="urn:com.example.switchyard:switchyard-example:0.0.1-SNAPSHOT">
                                <sca:composite name="switchyard-example" targetNamespace="urn:com.example.switchyard:switchyard-example:0.0.1-SNAPSHOT">
                                  <sca:component name="StoreImpl">
                                    <bean:implementation.bean class="org.savara.examples.store.StoreImpl"/>
                                    <sca:service name="Store">
                                      <sca:interface.java interface="org.savara.examples.store.Store"/>
                                    </sca:service>
                                    <sca:reference name="CreditAgency">
                                      <sca:interface.java interface="org.savara.examples.creditagency.CreditAgency"/>
                                    </sca:reference>
                                    <sca:reference name="Logistics">
                                      <sca:interface.java interface="org.savara.examples.logistics.Logistics"/>
                                    </sca:reference>
                                  </sca:component>
                                  <sca:service name="Store" promote="StoreImpl/Store">
                                    <sca:interface.wsdl interface="wsdl/PurchaseGoods_Store.wsdl#wsdl.porttype(Store)"/>
                                  </sca:service>
                                  <sca:reference name="CreditAgency" multiplicity="0..1" promote="StoreImpl/CreditAgency">
                                    <sca:interface.wsdl interface="wsdl/PurchaseGoods_CreditAgency.wsdl#wsdl.porttype(CreditAgency)"/>
                                  </sca:reference>
                                  <sca:reference name="Logistics" multiplicity="0..1" promote="StoreImpl/Logistics">
                                    <sca:interface.wsdl interface="wsdl/PurchaseGoods_Logistics.wsdl#wsdl.porttype(Logistics)"/>
                                  </sca:reference>
                                </sca:composite>
                              </switchyard>
                              
                              
                              • 12. Re: Issue with switchyard.xml generated in SCA editor 0.5.0.beta1
                                Gary Brown Master

                                Just tried again with the original switchyard.xml, which still has the schema validation errors in Eclipse, but it does build. So probably last time I ran it from maven I had the binding in the wrong location.

                                 

                                Ok, so atleast I know I am generating valid descriptor from savara - but strange why Eclipse is showing the validation errors.

                                • 13. Re: Issue with switchyard.xml generated in SCA editor 0.5.0.beta1
                                  Keith Babo Master

                                  The schema thing in Eclipse might be an Eclipse config setting.  Can you check Preferences -> XML -> XML Files -> Validation -> Honour all XML schema locations ?  The box next to that shoulud be unchecked. 

                                  • 14. Re: Issue with switchyard.xml generated in SCA editor 0.5.0.beta1
                                    Gary Brown Master

                                    Yeah, that sorted it.

                                     

                                    Thanks Keith.

                                    1 2 Previous Next