13 Replies Latest reply on Aug 29, 2012 1:36 AM by mageshbk

    Tooling for RESTEasy Gateway

    mageshbk

      This gateway supports both service and reference bindings. The spec:

      <sequence>
          <element name="interfaces" type="string" minOccurs="1" maxOccurs="1">
              <annotation>
                  <documentation>
                      A comma seperated list of interfaces or abstract/empty classes with REST annotations.
                  </documentation>
              </annotation>
          </element>
          <element name="address" type="string" minOccurs="0" maxOccurs="1">
              <annotation>
              <documentation>
                  A URL that points to the root path of resources. This is only applicable for Reference bindings.
                  It is optional and if not specified will default to http://127.0.0.1:8080/.
              </documentation>
              </annotation>
          </element>
          <element name="contextPath" type="string" minOccurs="0" maxOccurs="1">
              <annotation>
              <documentation>
                  A URI string that represents the root context where this service is hosted. Optional for Reference
                  bindings, but recommend for Service bindings as the default context may not be usable in certain containers.
              </documentation>
              </annotation>
          </element>
      </sequence>
      
      

       

      Sample and schema links coming soon...

        • 1. Re: Tooling for RESTEasy Gateway
          bfitzpat

          Hey Magesh, thanks for getting me started on this...

           

          Using the commits associated with the pull requests for the RESTeasy work you've done, I have implemented the model changes and started the UI for wizard and property sheets.

           

          My questions are as follows:

           

          (1) Though the contextPath element appears to be optional in the schema, the quickstart includes it for both the service and reference binding instances with the text "rest-binding" in it. Is this the default that I should set in the tooling?

           

          (2) Beyond the "address" element being optional and only applicable to reference bindings, are there any additional elements of the binding that need to appear in the UI for RESTeasy bindings? For example, the operation selector seems to pop up quite a bit. Should there be an operation selector combo here as well? Anything only applicable to service bindings vs. reference bindings (or vice versa), beyond the "address" element?

           

          Here are a couple of screen shots of what I have so far.

           

          resteasy_binding_service.png

           

          resteasy_binding_reference.png

          • 2. Re: Tooling for RESTEasy Gateway
            bfitzpat

            Just realized that context path should be removed on the reference side as well (based on comments in the schema).

            • 3. Re: Tooling for RESTEasy Gateway
              rcernich

              Hey Brian,

               

              To be consistent, I think we should use the same default for context-path that we use for SOAP.

               

              Just my $0.02.

               

              Rob

              • 4. Re: Tooling for RESTEasy Gateway
                bfitzpat

                Hey Rob - That's what I'm doing right now (using the application name as the context path default), but wanted to confirm because the RESteasy quickstart doesn't seem to jive that way.

                • 5. Re: Tooling for RESTEasy Gateway
                  bfitzpat

                  Created SWITCHYARD-942 to cover this work, but definitely think we should use the forum for easier communication on the topic!

                  • 6. Re: Tooling for RESTEasy Gateway
                    mageshbk

                    Hi Brian,

                     

                    Nice work on the UI front. The context path is not needed for refernce binding. Say if you have a service hosted in this address http://localhost:8080/rest-binding, in the reference binding it could be declared as

                    <sca:reference name="Warehouse" promote="OrderService/Warehouse" multiplicity="1..1">
                        <rest:binding.rest>
                            <rest:interfaces>org.switchyard.quickstarts.rest.binding.WarehouseResource</rest:interfaces>
                            <rest:contextPath>rest-binding</rest:contextPath>
                        </rest:binding.rest>
                    </sca:reference>
                    

                     

                    or like this

                    <sca:reference name="Warehouse" promote="OrderService/Warehouse" multiplicity="1..1">
                        <rest:binding.rest>
                            <rest:interfaces>org.switchyard.quickstarts.rest.binding.WarehouseResource</rest:interfaces>
                            <rest:address>http://localhost:8080/rest-binding</rest:address>
                        </rest:binding.rest>
                    </sca:reference>
                    

                     

                    An address parameter is required for accessing the hosted service. But it need not be present in the configuration. For local services, the address can be the default address(http://localhost:8080) but a remaining path is needed to reach that service right? Hence the contextPath is filled in the QS for the reference too.

                     

                    Regarding operation selector: I don't think that is really applicable here. Was it there for SOAP too? Keith can help us out in this.

                     

                    No more parameters are needed as of now. Will see what our users say as we progress.

                    • 7. Re: Tooling for RESTEasy Gateway
                      kcbabo

                      Shouldn't be required for REST as the path of the URL is mapped to the service operation via annotations on the service interface.

                      • 8. Re: Tooling for RESTEasy Gateway
                        kcbabo

                        BTW, the same thing is true of SOAP.  The message either contains the operation name already (e.g. doc-lit wrapped) or it can be determined by mapping the root element of the SOAP:Body to a part definition in the WSDL.

                        • 9. Re: Tooling for RESTEasy Gateway
                          bfitzpat

                          Ok, have put up a pull request for SWITCHYARD-942.

                          • 10. Re: Tooling for RESTEasy Gateway
                            scisci

                            Hi everyone,

                            I've downloaded the example and deployed on one server.

                            Which is the address to connect to (in a browser) to call the OrderService?

                            I've tried localhost:8080/switchyard-quickstart-rest-binding/, localhost:8080/rest-binding/ but doesn't work.

                            Thanks

                            • 11. Re: Tooling for RESTEasy Gateway
                              mageshbk

                              That will be http://localhost:8080/rest-binding/order. Have a look at the ReadMe and the RESTEasyBindingClient.java in that quickstart.

                              • 12. Re: Tooling for RESTEasy Gateway
                                scisci

                                I've yust tryed this addres but doesn't work.

                                 

                                this is the image of as7 console.

                                AS7.JPG

                                • 13. Re: Tooling for RESTEasy Gateway
                                  mageshbk

                                  Mirko,

                                   

                                  Could you move your conversation to the user forum here https://community.jboss.org/en/switchyard. The OrderService has only one GET method. So you have to first do a POST for creating new order. Then you can access the order information with http://localhost:8080/rest-binding/order/<orderno>