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 Thu, 12 Jul 2007 11:12:07 GMT

Hi,

I tried with the below urls and got different responses.

http://localhost:8080/axis2/services/WeatherService/Weather/Denmark/Herning
<Exception>org.apache.axis2.AxisFault: The endpoint reference (EPR) for the
Operation not found is
/axis2/services/WeatherService/Weather/Denmark/Herning and the WSA Action =
null at
org.apache.axis2.engine.DispatchPhase.checkPostConditions(DispatchPhase.java:85)
 at org.apache.axis2.engine.Phase.invoke(Phase.java:308) at
org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:212) at
org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:132) at
org.apache.axis2.transport.http.util.RESTUtil.invokeAxisEngine(RESTUtil.java:125)
 at
org.apache.axis2.transport.http.util.RESTUtil.processURLRequest(RESTUtil.java:119)
 at org.apache.axis2.transport.http.HTTPWorker.service(HTTPWorker.java:229)
at
org.apache.axis2.transport.http.server.AxisHttpService.doService(AxisHttpService.java:256)
 at
org.apache.axis2.transport.http.server.AxisHttpService.handleRequest(AxisHttpService.java:163)
 at
org.apache.axis2.transport.http.server.HttpServiceProcessor.run(HttpServiceProcessor.java:85)
 at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
 at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
 at java.lang.Thread.run(Thread.java:803)
</Exception>

http://localhost:8080/axis2/services/WeatherService/getWeather
<Exception>java.lang.StringIndexOutOfBoundsException at
java.lang.StringBuffer.substring(StringBuffer.java:881) at
org.apache.axis2.builder.XFormURLEncodedBuilder.extractParametersUsingHttpLocation(XFormURLEncodedBuilder.java:284)
 at
org.apache.axis2.builder.XFormURLEncodedBuilder.processDocument(XFormURLEncodedBuilder.java:99)
 at
org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:150)
 at
org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:105)
 at
org.apache.axis2.transport.http.util.RESTUtil.processURLRequest(RESTUtil.java:101)
 at org.apache.axis2.transport.http.HTTPWorker.service(HTTPWorker.java:229)
at
org.apache.axis2.transport.http.server.AxisHttpService.doService(AxisHttpService.java:256)
 at
org.apache.axis2.transport.http.server.AxisHttpService.handleRequest(AxisHttpService.java:163)
 at
org.apache.axis2.transport.http.server.HttpServiceProcessor.run(HttpServiceProcessor.java:85)
 at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
 at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
 at java.lang.Thread.run(Thread.java:803)
</Exception>

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             
             12-07-2007 11:31                                           cc 
                                                                           
                                                                   Subject 
             Please respond to         Re: Axis2: RESTful implementation   
             axis-user@ws.apac         with Axis2                          
                  he.org                                                   
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




You should be able to, provided that the system has the relavant data to
return. Did you get back any error or anyhing as such?

Thanks,
Keith.

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

      Hi Keith,

      I tried 1.3 RC1, and with success.
      Axis2 now starts without any errors.

      But I can't activate the REST service from an url.

      Should I not be able to reach it with the following url?
      http://localhost:8080/axis2/services/WeatherService/Weather/Denmark/Herning


      Or have I misunderstood the new HTTPBinding.
            <operation ref="tns:getWeather" whttp:method="GET"
      whttp:location=
      "WeatherServiceHTTPEndpoint/Weather/{country}/{city}"/>

      I have attached my generated code if it can be any help.

      (See attached file: WeatherService.zip)

      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 12:16
      cc


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









      You can even try the 1.3 RCI available here.

      http://people.apache.org/~deepal/axis2/1.3-RC1/

      If you continue to have any problems just post your aar so that I can
      have
      a look.

      Thanks,
      Keith.

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

            Hi Keith,

            I forgot specify the argument (-wv) on wsdl2java.  My mistake.
      :-)
            I can see that eclipse gives another validation, than the one
      from
            Rational
            Application Developer 7. Maybe it just doesn't support WSDL 2.0
            validation....
            But anyway, wsdl2java generates skeleton code without errors
      now.

            But I get another  error during startup of Axis2 now.
            org.apache.axis2.deployment.repository.util.ArchiveReader -
      Trouble
            processing wsdl file :Illegal character in opaque part at index
      2:
            .....\webapps\WeatherService\WEB-INF\services\weather\META-INF

            Should I try the nightly build instead? Right now I'm using
      Axis2
            1.2.

            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 11:08
            cc


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









            Which version of Axis2 are you using?

            I would recoment 1.2 or even a nightly or the 1.3 RC

            Thanks,
            Keith.

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

                  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




            --
            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