You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Abhishek Shadangi <sh...@gmail.com> on 2008/09/08 06:48:12 UTC

Re: Complex Types via REST with Axis2

Hi Keith,

So did you get chance to publish articles on How to do REST with  Axis2? I
would really appreciate if you could please send me the link as I want to
learn more on this.

Thanks
-Abhishek.

On Thu, Jun 26, 2008 at 10:50 AM, keith chapman <ke...@gmail.com>wrote:

> Hi Mathew,
>
> Expect some articles on this stuff soon (Within the coming week or so). I'm
> in the process of publishing some articles on how to do REST with Axis2.
> Thanks for your interest.
> This also goes to show limitations in REST.
>
> Thanks,
> Keith.
>
>
> On Thu, Jun 26, 2008 at 6:36 PM, Matthew Beldyk <ma...@beldyk.org> wrote:
>
>> Hi Keith,
>>
>> That does make sense, I couldn't determine how to even represent my
>> complex type of complex types in a uri.  This does explain the lack of
>> documentation on how to do this.
>>
>> Thanks,
>> -Matt
>>
>> On Wed, Jun 25, 2008 at 10:45 PM, keith chapman <ke...@gmail.com>
>> wrote:
>> > Hi Matthew,
>> >
>> > You cannot support such request in a REST invocation. This is a
>> limitation
>> > of REST (Not just in Axis2 but REST as a whole). In order to do a truly
>> > RESTfull service your input message should be a conplexType with a
>> sequence.
>> > And this sequence should be comprised of simple Types (No complexTypes.
>> This
>> > is the issue you are having). The only way you will be able to invoke
>> this
>> > without the use of soap is to do a post with the contentType of
>> > allication/xml (i.e just the payload of the SOAP request).
>> >
>> > Hope I made my point clear to you. Any arbitrary service cannot support
>> > REST. If you want to support both REST and SOAP your messages should be
>> > designed in order to support that.
>> >
>> > Thanks,
>> > Keith.
>> >
>> > On Wed, Jun 25, 2008 at 11:21 PM, Matthew Beldyk <ma...@beldyk.org>
>> wrote:
>> >>
>> >> Thanks Keith,
>> >>
>> >> Here's the schema for this service;  I've also included the
>> >> BoundingRadius from an "imported" namespace I'm using.
>> >> The complex type I'm trying to pass via REST is UNAVCOMonumentSearch.
>> >>
>> >> Best Regards,
>> >> Matt
>> >>
>> >>    <complexType name="BoundingRadius">
>> >>        <sequence>
>> >>            <element name="Lat" type="decimal" minOccurs="1"
>> maxOccurs="1"
>> >> />
>> >>            <element name="Lon" type="decimal" minOccurs="1"
>> maxOccurs="1"
>> >> />
>> >>            <element name="Radius" type="decimal" minOccurs="1"
>> >> maxOccurs="1" />  <!-- in kilometers -->
>> >>        </sequence>
>> >>    </complexType>
>> >>
>> >>
>> >>
>> >> <schema elementFormDefault="unqualified" version="1.0"
>> >>        targetNamespace="http://api.unavco.org/services/monuments"
>> >>        xmlns:ufac="http://api.unavco.org/services"
>> >>        xmlns:mon="http://api.unavco.org/services/monuments"
>> >>        xmlns="http://www.w3.org/2001/XMLSchema">
>> >>
>> >>        <import namespace="http://api.unavco.org/services"
>> >> schemaLocation="http://schemas.unavco.org/facility/GPSSearchTerms.xsd"
>> >> />
>> >>
>> >>        <element name="GPSSearch" type="mon:UNAVCOMonumentSearch" />
>> >>
>> >>        <complexType name="UNAVCOMonumentSearch">
>> >>                <sequence>
>> >>                        <!-- Global search parameters -->
>> >>                        <element name="Scope" type="ufac:SearchScope"
>> >> minOccurs="0" maxOccurs="1" />
>> >>                        <element name="SampleRate"
>> >> type="mon:GPSSampleRate" minOccurs="0" maxOccurs="1" />
>> >>
>> >>                        <!-- Identity search params  -->
>> >>                        <element name="FourCharCode"
>> >> type="ufac:FourCharCodePattern" minOccurs="0" maxOccurs="unbounded"/>
>> >>                        <element name="Set"
>> >> type="ufac:UNAVCOSetPattern" minOccurs="0" maxOccurs="1"/>
>> >>                        <element name="Name"
>> >> type="ufac:UNAVCONamePattern" minOccurs="0" maxOccurs="1" />
>> >>
>> >>                        <!-- Spatial search params -->
>> >>                        <element name="BBox" type="ufac:BoundingBox"
>> >> minOccurs="0" maxOccurs="1" />
>> >>                        <element name="BRadius"
>> >> type="ufac:BoundingRadius" minOccurs="0" maxOccurs="1" />
>> >>                        <!-- Temporal search params -->
>> >>                        <element name="StartTime" type="dateTime"
>> >> minOccurs="0" maxOccurs="1" />
>> >>                        <element name="EndTime" type="dateTime"
>> >> minOccurs="0" maxOccurs="1" />
>> >>
>> >>                        <element name="ArchiveStartBefore"
>> >> type="dateTime" minOccurs="0" maxOccurs="1" />
>> >>                        <element name="ArchiveStartAfter"
>> >> type="dateTime" minOccurs="0" maxOccurs="1" />
>> >>
>> >>                        <!--  Miscellaneous search params -->
>> >>                        <element name="Status"
>> >> type="mon:OperationalStatus" minOccurs="0" maxOccurs="1" />
>> >>                </sequence>
>> >>        </complexType>
>> >>
>> >>        <element name="GPSSearchResponse" type="mon:MonumentResponse" />
>> >>
>> >>        <complexType name="MonumentResponse">
>> >>                <sequence>
>> >>                        <element name="MaxDate" type="dateTime"
>> >> maxOccurs="1" />
>> >>                        <element name="MinDate" type="dateTime"
>> >> maxOccurs="1" />
>> >>                        <element name="Monuments"
>> >> type="mon:UNAVCOMonuments" minOccurs="1" maxOccurs="1" />
>> >>                </sequence>
>> >>        </complexType>
>> >>        <complexType name="UNAVCOMonuments">
>> >>                <sequence>
>> >>                        <element name="Monument"
>> >> type="mon:UNAVCOMonument" minOccurs="0" maxOccurs="unbounded" />
>> >>                </sequence>
>> >>        </complexType>
>> >>        <complexType name="UNAVCOMonument">
>> >>                <sequence>
>> >>                        <element name="MonumentID" type="string"
>> >> minOccurs="1" maxOccurs="1" />
>> >>                        <element name="MonumentName" type="string"
>> >> minOccurs="1" maxOccurs="1" />
>> >>                        <element name="MonumentType" type="string"
>> >> minOccurs="1" maxOccurs="1" />
>> >>                        <element name="FourCharCode" type="string"
>> >> minOccurs="1" maxOccurs="1" />
>> >>                        <element name="Grouping" type="string"
>> >> minOccurs="1" maxOccurs="1" />
>> >>                        <element name="Latitude" type="decimal"
>> >> minOccurs="1" maxOccurs="1" />
>> >>                        <element name="Longitude" type="decimal"
>> >> minOccurs="1" maxOccurs="1" />
>> >>                        <element name="StartTime" type="dateTime"
>> >> minOccurs="1" maxOccurs="1" />
>> >>                        <element name="EndTime" type="dateTime"
>> >> minOccurs="1" maxOccurs="1" />
>> >>                        <element name="Operational" type="string"
>> >> minOccurs="1" maxOccurs="1" />
>> >>                        <element name="ArchiveStart" type="dateTime"
>> >> minOccurs="1" maxOccurs="1" />
>> >>                </sequence>
>> >>        </complexType>
>> >>        <simpleType name="OperationalStatus">
>> >>                <restriction base="string">
>> >>                        <enumeration value="Active" />
>> >>                        <enumeration value="Inactive" />
>> >>                        <enumeration value="Retired" />
>> >>                        <enumeration value="Pending" />
>> >>                        <enumeration value="Intermittent" />
>> >>                </restriction>
>> >>        </simpleType>
>> >>        <simpleType name="GPSSampleRate">
>> >>                <restriction base="string">
>> >>                        <enumeration value="highrate" />
>> >>                        <enumeration value="normal" />
>> >>                </restriction>
>> >>        </simpleType>
>> >>
>> >> </schema>
>> >>
>> >> On Wed, Jun 25, 2008 at 12:02 AM, keith chapman <
>> keithgchapman@gmail.com>
>> >> wrote:
>> >> > Hi,
>> >> >
>> >> > Could you post the schema section for this operation please. I could
>> >> > give
>> >> > you a solution then.
>> >> >
>> >> > Thanks,
>> >> > Keith.
>> >> >
>> >> > On Wed, Jun 25, 2008 at 3:54 AM, Matthew Beldyk <ma...@beldyk.org>
>> wrote:
>> >> >>
>> >> >> Hi, I'm using Axis2 with Tomcat.  I've been using SOAP to talk to my
>> >> >> servlets, but recently the discussion came up wondering if we would
>> >> >> use REST with our services.
>> >> >>
>> >> >> Currently, I send messages to our servlets similar to (headers
>> pulled
>> >> >> out):
>> >> >>      <mon:GPSSearch>
>> >> >>         <BRadius>
>> >> >>            <ser:Lat>59.362584</ser:Lat>
>> >> >>            <ser:Lon>-153.44467</ser:Lon>
>> >> >>            <ser:Radius>10</ser:Radius>
>> >> >>         </BRadius>
>> >> >>        <StartTime>2000-02-02T18:49:00.000-07:00</StartTime>
>> >> >>      </mon:GPSSearch>
>> >> >>
>> >> >> I would like to do something similar to
>> >> >>
>> >> >>
>> >> >> http://
>> *.com:8080/axis2/services/GPSSearch/GPSSearch?ArchiveStartAfter=2008-06-15T00:00:00.000-07:00&BRadius=something
>> >> >> (NOTE:
>> >> >>
>> >> >>  http://
>> *.com:8080/axis2/services/GPSSearch/GPSSearch?ArchiveStartAfter=2008-06-15T00:00:00.000-07:00
>> >> >> behaves as I would expect)
>> >> >>
>> >> >> Unfortunately, I am unable to determine how to represent
>> >> >> "BRadius=something" for any of our complex types.  Initially I
>> tried:
>> >> >>
>> >> >>
>> >> >>
>> "BRadius=<ser:Lat>59.362584</ser:Lat><ser:Lon>-153.44467</ser:Lon><ser:Radius>10</ser:Radius>"
>> >> >> which was passed to my code as
>> >> >>
>> >> >>
>> >> >>
>> "<BRadius><![CDATA[<ser:Lat>59.362584</ser:Lat><ser:Lon>-153.44467</ser:Lon><ser:Radius>10</ser:Radius>]]></BRadius>"
>> >> >>
>> >> >> Is there any way to represent complex types like this?  If so, how?
>> >> >>
>> >> >> Best Regards,
>> >> >> Matt Beldyk
>> >> >>
>> >> >>
>> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> >> >> For additional commands, e-mail: axis-user-help@ws.apache.org
>> >> >>
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > Keith Chapman
>> >> > Senior Software Engineer
>> >> > WSO2 Inc.
>> >> > Oxygenating the Web Service Platform.
>> >> > http://wso2.org/
>> >> >
>> >> > blog: http://www.keith-chapman.org
>> >>
>> >>
>> >>
>> >> --
>> >> Calvin: Know what I pray for?
>> >> Hobbes: What?
>> >> Calvin: The strength to change what I can, the inability to accept
>> >> what I can't, and the incapacity to tell the difference.
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> >> For additional commands, e-mail: axis-user-help@ws.apache.org
>> >>
>> >
>> >
>> >
>> > --
>> > Keith Chapman
>> > Senior Software Engineer
>> > WSO2 Inc.
>> > Oxygenating the Web Service Platform.
>> > http://wso2.org/
>> >
>> > blog: http://www.keith-chapman.org
>>
>>
>>
>> --
>> Calvin: Know what I pray for?
>> Hobbes: What?
>> Calvin: The strength to change what I can, the inability to accept
>> what I can't, and the incapacity to tell the difference.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>>
>
>
> --
> Keith Chapman
> Senior Software Engineer
> WSO2 Inc.
> Oxygenating the Web Service Platform.
> http://wso2.org/
>
> blog: http://www.keith-chapman.org
>