axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@multi-support.com
Subject Re: Axis2: RESTful implementation with Axis2
Date Wed, 11 Jul 2007 08:08:10 GMT

Hi Keith,

I have some problems generating stub/skeletons for your wsdl.

My IDE gives the following validation error for WeatherHTTPBinding.

      WSDL: Missing port type for binding {http://example.axis2.apache.org}
WeatherHTTPBinding

What does I miss?

Regards
Multi-Support A/S

Torben Riis
--------------------------------------------------------------------
Phone +45 96 600 600, Fax +45 96 600 601
E-mail: riis@multi-support.com
http://www.multi-support.com


                                                                           
             "keith chapman"                                               
             <keithgchapman@gm                                             
             ail.com>                                                   To 
                                       axis-user@ws.apache.org             
             11-07-2007 09:27                                           cc 
                                                                           
                                                                   Subject 
             Please respond to         Re: Axis2: RESTful implementation   
             axis-user@ws.apac         with Axis2                          
                  he.org                                                   
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




here is a sample Weather.wsdl2. Please let me know if you need any
clarifications.

<description xmlns="http://www.w3.org/ns/wsdl"
             targetNamespace=" http://example.axis2.apache.org"
             xmlns:tns="http://example.axis2.apache.org"
             xmlns:wsoap=" http://www.w3.org/ns/wsdl/soap"
             xmlns:whttp="http://www.w3.org/ns/wsdl/http"
             xmlns:xsd1=" http://example.axis2.apache.org/xsd"
             xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <documentation>
        Just a sample service to explain WSDL 2.0 semantics
    </documentation>

    <types>
        <xs:schema elementFormDefault="qualified"
                   targetNamespace=" http://example.axis2.apache.org/xsd"
                   xmlns:xs="http://www.w3.org/2001/XMLSchema"
                   xmlns:xsd1=" http://example.axis2.apache.org/xsd">

            <xs:element name="weather" type="xsd1:weatherStructType"/>
            <xs:complexType name="weatherStructType">
                <xs:sequence>
                    <xs:element name="temparature" type="xs:int"/>
                    <xs:element name="sky" type="xs:string"/>
                </xs:sequence>
            </xs:complexType>

            <xs:element name="location" type="xsd1:locationStructType"/>
            <xs:complexType name="locationStructType">
                <xs:sequence>
                    <xs:element name="country" type="xs:string"/>
                    <xs:element name="city" type="xs:string"/>
                </xs:sequence>
            </xs:complexType>

            <xs:element name="response" type="xs:string"/>

            <xs:element name="weatherFault"
type="xsd1:weatherFaultStructType"/>
            <xs:complexType name="weatherFaultStructType">
                <xs:sequence>
                    <xs:element name="Fault" type="xs:string"/>
                    <xs:element name="country" type="xs:string"/>
                    <xs:element name="city" type="xs:string"/>
                </xs:sequence>
            </xs:complexType>

            <xs:element name="weatherDetails"
type="xsd1:weatherDetailsStructType"/>
            <xs:complexType name="weatherDetailsStructType">
                <xs:sequence>
                    <xs:element name="weather"
type="xsd1:weatherStructType"/>
                    <xs:element name="location"
type="xsd1:locationStructType"/>
                </xs:sequence>
            </xs:complexType>
        </xs:schema>
    </types>

    <interface name="Weather">
        <documentation>
            This is where the abstract descriptions of the operations are
given. Note that WSDL 2.0
            has the concept of reusing faults, hence they are described at
the interface level.
        </documentation>
        <fault name="weatherFault" element="xsd1:weatherFault"></fault>

        <operation name="getWeather" pattern="
http://www.w3.org/ns/wsdl/in-out">
            <input element="xsd1:location"/>
            <output element="xsd1:weather"/>
            <outfault ref="tns:weatherFault"/>
        </operation>

        <operation name="setWeather" pattern="
http://www.w3.org/ns/wsdl/in-out">
            <input element="xsd1:weatherDetails"/>
            <output element="xsd1:response"/>
            <outfault ref="tns:weatherFault"/>
        </operation>

    </interface>

    <binding name="WeatherHTTPBinding" interface="tns:Weather"
             type="http://www.w3.org/ns/wsdl/http">
        <documentation>
            This binding binds the weather interface to RESTish style
invocations.
            NOTE : The URL for the operation is constracted by resolving
the httplocation against
            the base uri.
            e.g. If the country was srilanka and the city was colombo then
the URL will be

http://example.org/WeatherService/WeatherServiceSOAPEndpoint/Weather/srilanka/colombo

        </documentation>
        <fault ref="tns:weatherFault" whttp:code="402"/>
        <operation ref="tns:getWeather" whttp:method="GET"

whttp:location="WeatherServiceHTTPEndpoint/Weather/{country}/{city}"/>
        <operation ref="tns:setWeather" whttp:method="PUT"

whttp:location="WeatherServiceHTTPEndpoint/Update/{country}/{city}"/>
        <!--Ideally this should be as follows. Will fux it in the trunk-->
        <!--<operation ref="tns:setWeather" whttp:method="POST"
whttp:location="WeatherServiceHTTPEndpoint/Weather/{country}/{city}"/>-->
    </binding>

    <service name="WeatherService" interface="tns:Weather">
        <endpoint name="WeatherServiceHTTPEndpoint"
binding="tns:WeatherHTTPBinding"
                  address="
http://example.org/WeatherService/WeatherServiceHTTPEndpoint/ "/>
    </service>

</description>

Thanks,
Keith.

On 7/11/07, riis@multi-support.com <riis@multi-support.com> wrote:

      Hi Keith,

      An example would be very nice. ;-)
      An example where you format the URL in a RESTish style would be
      perfect.
      Maybe with both GET & POST if it isn't too much trouble.

      Thanks a lot.

      Regards
      Multi-Support A/S

      Torben Riis
      --------------------------------------------------------------------
      Phone +45 96 600 600, Fax +45 96 600 601
      E-mail: riis@multi-support.com
      http://www.multi-support.com



                   "keith chapman"
                   <keithgchapman@gm
                   ail.com >
      To
                                             axis-user@ws.apache.org
                   11-07-2007 07:40
      cc


      Subject
                   Please respond to         Re: Axis2: RESTful
      implementation
                   axis-user@ws.apac          with Axis2
                        he.org









      The WSDL 2.0 primer  is a good starting place. It takes you through
      the
      concepts of WSDL 2.0 very nicely (without making things too complex).
      WSDL
      2.0 is a whole lot clean and easy to understand. If you like I can
      write a
      sample WSDL 2.0 doc for you if you have an example in mind :).

      And yes you can use the http methods GET, POST, PUT & DELETE in the
      same
      service. Its just that you cant use them on the same operation.

      Thanks,
      Keith.

      On 7/11/07, riis@multi-support.com < riis@multi-support.com> wrote:

            Hi Keith,

            Thank you for answering.

            When I earlier talked about using the http methods GET, POST,
      PUT &
            DELETE,
            I actually meant using them in the same service.

            WSDL 2.0 really sounds interesting.

            I have a little knowledge about WSDL 1.1/1.2, because I'm
      studying
            for the
            SCDJWS exam, but I doesn't know anything about WSDL 2.0.
            I guess a lot has changed since it is possible to describe how
      the
            URL
            should be formatted and whether  to use http methods GET, POST,
      PUT
            or
            DELETE.

            Do you have or know a place where I can find simple example
      WSDL
            describing
            such a service?
            Or would it be best just start reading WSDL 2.0 HTTPBinding.


            Regards
            Multi-Support A/S

            Torben Riis

      --------------------------------------------------------------------
            Phone +45 96 600 600, Fax +45 96 600 601
            E-mail: riis@multi-support.com
            http://www.multi-support.com



                         "keith chapman"
                         < keithgchapman@gm
                         ail.com>
            To
                                                   axis-user@ws.apache.org
                         11-07-2007 06:45
            cc


            Subject
                         Please respond to         Re: Axis2: RESTful
            implementation
                         axis-user@ws.apac         with Axis2
                              he.org









            See comments inline.

            On 7/10/07, riis@multi-support.com <riis@multi-support.com >
      wrote:

                  Hi,

                  I have some questions regarding implementing a RESTfull
            service.
                  After
                  reading a lot of previous RESTish threads I got quite
      confused.
                  So I hope someone can help me straightened it out.

                  If I want to create a RESTful service with Axis2 would it
      then
                  require that
                  the service is implemented as RPC, or can other message
            receivers be
                  used?


                  Is it possible to create a RESTful service with Axis2
      that can
            be
                  reached
                  in the following way:
                  http://www.boeing.com/rest/aircraft/747
                  instead of


      http://www.boeing.com/rest/MyAircraftServices/getAircraft?model=747

            Yes this can be done. REST support in Axis2 was achieved  via
      the
            WSDL 2.0
            HTTPBinding (If you are not familiar with WSDL this might sound
      a bit
            strange). The kind of question you asked can easily be done by
            deploying
            your service via a WSDL 2.0 description. Please have a look at
      the
            primer
            it has some easy to understand examples.

                  First i actually thought that a RESTful service should
            implement some
                  sort
                  of interface with methods corresponding to GET, POST, PUT
      &
            DELETE.
                  But I read in some of the other threads that a RESTful
      service
            should
                  only
                  have one method. Isn't that a problem if you try to
      accomplice
            the
                  syntax
                  that the following articles describes.

            Yes you can use all 4 HTTP methods described above, depending
      on your
            requirement. Its all about using the appropriate method (Not
      that you
            must
            use just one method)



      http://www.innoq.com/blog/st/2006/06/30/rest_vs_soap_oh_no_not_again.html



                   http://www.xfront.com/REST-Web-Services.html

                  Where the same url has different functionality depending
      on how
            it is

                  called (GET, POST).
                  GET   /order/{id} Get order details
                  POST  /order/{id} Add item

            the current version of Axis2 does not support this (But it can
      be
            included,
            I will file a JIRA on this and try to get it into the 1.3
      release.)

            Please let us know if you need more help (Can even assist you
      in
            writing
            down the WSDL 2.0 description)

            Thanks,
            Keith.

                  Regards
                  Multi-Support A/S

                  Torben Riis


      --------------------------------------------------------------------
                  Phone +45 96 600 600, Fax +45 96 600 601
                  E-mail: riis@multi-support.com
                  http://www.multi-support.com




      ---------------------------------------------------------------------


                  To unsubscribe, e-mail:
      axis-user-unsubscribe@ws.apache.org
                  For additional commands, e-mail:
      axis-user-help@ws.apache.org




            --
            Keith Chapman
            WSO2 Inc.
            Oxygen for Web Services Developers.
            http://wso2.org/



      ---------------------------------------------------------------------


            To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
            For additional commands, e-mail: axis-user-help@ws.apache.org




      --
      Keith Chapman
      WSO2 Inc.
      Oxygen for Web Services Developers.
      http://wso2.org/


      ---------------------------------------------------------------------

      To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
      For additional commands, e-mail: axis-user-help@ws.apache.org




--
Keith Chapman
WSO2 Inc.
Oxygen for Web Services Developers.
http://wso2.org/


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message