REST and Post

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

REST and Post

BrunoBB
Hi,

I have some REST service working ok - all of them <get> services.

Now i want to add a <post> service but is not being recognized.

orbeonSecurityToken: uuidToken
        <get>
    <path: '/sendToken?token={1}'> 
        <produces: 'text/xml'>
        | serviceRegistry serviceValue |
        serviceRegistry := OrbeonTempServiceRegistry default.
        serviceValue := serviceRegistry valueFor: uuidToken.
        serviceValue ifNil: [^self answerXMLErrorWith: uuidToken].
        serviceRegistry unregister: uuidToken. "the token is removed after used (for security reasons)"
       ^serviceValue

This services is working ok, but the following NOT:
newOrbeonForm
        <post>
        <consumes: '*/xml'>
    <path: '/newform'> 
        OrbeonFormPostRegistry default register: self requestContext request rawBody.
         ^ 'OK'

Here i get: /orbeon-api/newform not found from: http://myip:8888/orbeon-api/newform

All services are under "/orbeon-api" and <get> services work very well.

Any idea what is going on ? Can i use <path> pragma with <post> ?

The code is almost the same as in seaside book.
(i tested some other options in the post service but it is never called)

Regards,
Bruno

Reply | Threaded
Open this post in threaded view
|

Re: REST and Post

Paul DeBruicker
Are you caching your routes?  I'm not using the 'consumes' directive but everything else in your method looks OK.





BrunoBB wrote
Hi,

I have some REST service working ok - all of them <get> services.

Now i want to add a <post> service but is not being recognized.

orbeonSecurityToken: uuidToken
        <get>
    <path: '/sendToken?token={1}'> 
        <produces: 'text/xml'>
        | serviceRegistry serviceValue |
        serviceRegistry := OrbeonTempServiceRegistry default.
        serviceValue := serviceRegistry valueFor: uuidToken.
        serviceValue ifNil: [^self answerXMLErrorWith: uuidToken].
        serviceRegistry unregister: uuidToken. "the token is removed after used (for security reasons)"
       ^serviceValue

This services is working ok, but the following NOT:
newOrbeonForm
        <post>
        <consumes: '*/xml'>
    <path: '/newform'> 
        OrbeonFormPostRegistry default register: self requestContext request rawBody.
         ^ 'OK'

Here i get: /orbeon-api/newform not found from: http://myip:8888/orbeon-api/newform

All services are under "/orbeon-api" and <get> services work very well.

Any idea what is going on ? Can i use <path> pragma with <post> ?

The code is almost the same as in seaside book.
(i tested some other options in the post service but it is never called)

Regards,
Bruno
Reply | Threaded
Open this post in threaded view
|

Re: REST and Post

BrunoBB
Hi,

Well i do not know.

How do you enable or disable routes caching ?

Regards,
Bruno
Reply | Threaded
Open this post in threaded view
|

Re: [Glass] REST and Post

Johan Brichau-3
Hi Bruno,

Are you using Seaside 3.1 or 3.0 ?
If you are using 3.0, which version of Seaside-Rest are you using?

A quick check for the caching can be: if you add another get path, does it become available or not?

Johan

On 12 Jun 2014, at 16:08, BrunoBB <[hidden email]> wrote:

> Hi,
>
> Well i do not know.
>
> How do you enable or disable routes caching ?
>
> Regards,
> Bruno
>
>
>
> --
> View this message in context: http://forum.world.st/REST-and-Post-tp4762802p4762813.html
> Sent from the GLASS mailing list archive at Nabble.com.
> _______________________________________________
> Glass mailing list
> [hidden email]
> http://lists.gemtalksystems.com/mailman/listinfo/glass

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: [Glass] REST and Post

BrunoBB
Johan,

Thanks for the answer. I have meeting now i will check versions later.

But if i add a <get> service it become available immediately (after commit the method in gemstone).

Regards,
Bruno
Reply | Threaded
Open this post in threaded view
|

Re: [Glass] REST and Post

BrunoBB
Hi,

Installed versions (i think is seaside 3):

The version of Seaside:
Seaside-GemStone-Core-dkh.63
Seaside-GemStone300-Core-DaleHenrichs.4

The version of REST:
* Seaside-REST-Core-NikhilTayal.40
* Seaside-GemStone-REST-Core-MarcoOrtu.1

Regards,
Bruno
Reply | Threaded
Open this post in threaded view
|

Re: [Glass] REST and Post

BrunoBB
Hi,

I have found something strange, i defined a new service:
newOrbeonForm
        <get>
        <path: ''>

         ^ 'OK'

This service (get) is reached without problems if i change it to:

newOrbeonForm
        <post>
        <path: ''>

         ^ 'OK'

Then (/orbeon-service not found) the service is not reached.

Working on it...

Regards,
Bruno
Reply | Threaded
Open this post in threaded view
|

Re: [Glass] REST and Post

Johan Brichau-3
In reply to this post by BrunoBB
Hi Bruno,

Can you inspect the calculated routes?

(WAAdmin defaultDispatcher handlerAt: '/orbeon-api') routes

Is there a POST route? Can you share the printString of what you see?

> The version of REST:
> * Seaside-REST-Core-NikhilTayal.40
> * Seaside-GemStone-REST-Core-MarcoOrtu.1

I don't recognize the REST-Core package version, it probably does not come from the official repository?
The GemStone package is also not the latest version and is pretty old.
This may are may not influence the problem... to be sure: can you try upgrading to the latest stable version defined in ConfigurationOfSeasideRest found on http://www.smalltalkhub.com/#!/~Seaside/MetacelloConfigurations

Also, did you try removing the consumes declaration, just to see if it matters?

Let's see where all of this leads us...
Johan
_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: [Glass] REST and Post

BrunoBB
Johan,

>> Can you inspect the calculated routes?
Yes.

>> Is there a POST route? Can you share the printString of what you see?
Yes.
 'aWAComplexRoute (method: ''POST'' selector: #''newOrbeonForm'' produces: nil consumes: aWAWildcardMimeTypeMatch (mimeType: aWAMimeType(*/*) priority: 1)) (pathMatches: anOrderedCollection( ) parameterMatches: aDictionary( ) isOverlyComplex: false)'

>> I don't recognize the REST-Core package version, it probably does not come from the official repository?
http://www.squeaksource.com/Seaside30Addons

>>Also, did you try removing the consumes declaration, just to see if it matters?
Yes with no luck, i have tryed a lot of combinations :)
http://www.squeaksource.com/Seaside30Addons

Ok, i will try with this new repository.
By the way i used that repository because i have no idea which one was the lastest.

Regards,
Bruno