axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sahan Gamage" <sah...@gmail.com>
Subject Re: Strange REST Parsing
Date Thu, 17 Jan 2008 03:28:43 GMT
One question about Senaka's test is that are you using the same echo
sample without modification ? If so I think the behaviour is not
strange, since the echo sample only takes one parameter and parameters
are internally kept in a hash table.
I guess the hash table ordering is done in a way such that the keys
with least hash values come first when you query all the keys (or the
first key). So when the echo sample requests the first parameter
(because it takes only one param) the parameter name which has the
least hash value comes first as the output and hence the three
outputs.
One side-note is that the client-side or the server-side *should not*
depend on the order of the parameters as they can be different for
different client or server sitting in the other end. AFAIK rest (or
HTTP specs) does not impose strict ordering on parameters in the url.
The proper way to get parameter values is use the parameter name as
the key and query for that key to get relevant value.

Thanks
-sahan


On 1/16/08, Samisa Abeysinghe <samisa@wso2.com> wrote:
> This happens because we are using a hash to store the request params,
> and then use a for loop to retrieve the params. The order in which the
> params are retrieved depends on the hashing function in use.
> If we are to solve this, we have to get rid of the has and go for
> another container where the original ordering could be preserved.
>
> Samisa...
>
> Senaka Fernando wrote:
> > Hi Brian,
> > I think this is a bug somewhere or the other. I tried it and was amazed to
> > get another result.
> >
> > try1:
> > http://localhost:8080/axis2/services/echo/echoString?qid=qid1\&hostname=hostname1\&bbpl_id=d6ge5gyrgj4
> >
> > result1:
> > <ns1:echoString>
> > <text>d6ge5gyrgj4</text>
> > </ns1:echoString>
> >
> > try2:
> > http://localhost:8080/axis2/services/echo/echoString?qid=qid1\&hostname=hostname1\&bepl_id=d6ge5gyrgj4
> >
> > result2:
> > <ns1:echoString>
> > <text>qid1\</text>
> > </ns1:echoString>
> >
> > try3:
> > http://localhost:8080/axis2/services/echo/echoString?bid=qid1\&bastname=hostname1\&bipl_id=d6ge5gyrgj4
> >
> > result3:
> > <ns1:echoString>
> > <text>d6ge5gyrgj4</text>
> > </ns1:echoString>
> >
> > I have no idea on what logic takes place. There is no alphabetic sort or
> > node grouping here. It is something I can't logically explain. But, I will
> > look in to this and raise appropriate JIRAs.
> >
> > Regards,
> > Senaka
> >
> > N.B.: I tried this using Mozilla Firefox.
> >
> >
> >
> >
> >> Great - this will be a perfect example  I do this one:
> >>
> >>  curl
> >> http://localhost:9090/axis2/services/echo/echoString?qid=qid1\&hostname=hostname1\&repl_id=d6ge5gyrgj4
> >>
> >> I get:
> >>
> >> <ns1:echoString
> >> xmlns:ns1="http://ws.apache.org/axis2/c/samples"><text>qid1</text></ns1:echoString>
> >>
> >> It echoed the first parameter.
> >>
> >> When I change the last parameter to be alphabetically first:
> >>
> >> curl
> >> http://localhost:9090/axis2/services/echo/echoString?qid=qid1\&hostname=hostname1\&bbbbbbbbb=d6ge5gyrgj4
> >>
> >> Now the last parameter is echoed:
> >>
> >> <ns1:echoString
> >> xmlns:ns1="http://ws.apache.org/axis2/c/samples"><text>d6ge5gyrgj4</text></ns1:echoString>
> >>
> >> Its apparently not a simple an alphabetical sort, but its something
> >> odd.  Why would the name of the parameter effect the ordering of the
> >> nodes as constructed within the server?  I think the server is
> >> converting the REST input into a sequence of nodes somehow, and it is
> >> imposing and order of its own on the nodes.
> >>
> >> Brian
> >>
> >> On Jan 16, 2008 12:56 AM, Dinesh Premalal <xydinesh@gmail.com> wrote:
> >>
> >>> Hi Brain,
> >>>
> >>> "Brian McQueen" <mcqueenorama@gmail.com> writes:
> >>>
> >>>> <soapenv:Envelope
> >>>>
> >>> xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
> >>>
> >>>>   <soapenv:Header/>
> >>>>   <soapenv:Body>
> >>>>     <ns1:replicate
> >>>>
> >>> xmlns:ns1="http://ws.apache.org/axis2/services/replicate">
> >>>
> >>>>       <qid>qid1</qid>
> >>>>       <hostname>hostname1</hostname>
> >>>>       <repl_id>d6ge5gyrgj4</repl_id>
> >>>>     </ns1:replicate>
> >>>>   </soapenv:Body>
> >>>> </soapenv:Envelope>
> >>>>
> >>> I modified echo sample to echo back the node it receives. I used
> >>> following commands
> >>>
> >>> curl
> >>> http://localhost:9090/axis2/services/echo/echoString?qid=qid1\&hostname=hostname1\&repl_id=d6ge5gyrgj4
> >>>
> >>> I got this as the response
> >>>
> >>> <echoString><qid>qid1</qid><hostname>hostname1</hostname><repl_id>d6ge5gyrgj4</repl_id></echoString>
> >>>
> >>>
> >>> then I used following command
> >>>
> >>>  curl
> >>> http://localhost:9090/axis2/services/echo/echoString?qid=qid1\&repl_id=d6ge5gyrgj4\&hostname=hostname1
> >>>
> >>> and response is
> >>>
> >>> <echoString><qid>qid1</qid><repl_id>d6ge5gyrgj4</repl_id><hostname>hostname1</hostname></echoString>
> >>>
> >>> as far as I can see , there is a no such an alphabetical ordering in
> >>> REST parsing or did I miss something here?
> >>>
> >>> thanks,
> >>> Dinesh
> >>>
> >>> --
> >>> http://nethu.org
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
> >>> For additional commands, e-mail: axis-c-user-help@ws.apache.org
> >>>
> >>>
> >>>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
> >> For additional commands, e-mail: axis-c-user-help@ws.apache.org
> >>
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-c-user-help@ws.apache.org
> >
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-c-user-help@ws.apache.org
>
>

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


Mime
View raw message