the form-cli was a hack because the ruote-rest was failing if it was
other types of content-types so I needed to put some random content-
type, and the blank pdef argument was required for some reason I never
figured out.
I made an attempt to launch the process as an httparty client. Also I
don't get much of what you mean about your last response, it seems
your recommending using OpenWFE objects to create the xml or json text
on the client and send to the server? My understanding is if you post
to http:<ruote-web2 server>/processes with parameter pdef_url to the
process file and parameter fields with a json representation of the
payload. My issue is getting the authentication to work.
Below is a code snippet of trying to execute a process using ruote-
web2 and httpparty followed by there error on the server. I'm
considering changing the restful client to use either rest-client or
httparty to execute sequence1.rb so I can get something working.
require 'rubygems'
require 'httparty'
require 'json'
class RuoteWeb2
include HTTParty
base_uri 'localhost:3000'
basic_auth 'admin', 'admin'
end
params = {:svn => true}
payload = { :pdef_url => "public/defs/phases/init_phase.rb"}
payload[:fields] = params.to_json
p payload.to_s
RuoteWeb2.post('/processes', :query => payload).inspect
the server is still throwing the following error.
franci...@ubuntu:~/realtravel/rtsite/branches/dev/bi/ruote-web2$ ./
script/server
=> Booting Mongrel
=> Rails 2.3.0 application starting on http://0.0.0.0:3000
.. Ruote workflow/BPM engine started (ruote_plugin)
.. found lib/ruote.rb
=> Call with -d to detach
=> Ctrl-C to shutdown server
SQL (0.2ms) SET client_min_messages TO 'panic'
SQL (0.1ms) SET client_min_messages TO 'notice'
Processing ProcessesController#create (for 127.0.0.1 at 2009-03-01
23:49:54) [POST]
Parameters: {"fields"=>"{\"svn\":true}", "pdef_url"=>"public/defs/
phases/init_phase.rb"}
ActionController::InvalidAuthenticityToken
(ActionController::InvalidAuthenticityToken):
/home/francisco/.gem/ruby/1.8/gems/actionpack-2.3.0/lib/
action_controller/request_forgery_protection.rb:79:in
`verify_authenticity_token'
activesupport (2.3.0) lib/active_support/callbacks.rb:178:in `send'
activesupport (2.3.0) lib/active_support/callbacks.rb:178:in
`evaluate_method'
activesupport (2.3.0) lib/active_support/callbacks.rb:166:in `call'
/home/francisco/.gem/ruby/1.8/gems/actionpack-2.3.0/lib/
action_controller/filters.rb:225:in `call'
/home/francisco/.gem/ruby/1.8/gems/actionpack-2.3.0/lib/
action_controller/filters.rb:629:in `run_before_filters'
/home/francisco/.gem/ruby/1.8/gems/actionpack-2.3.0/lib/
action_controller/filters.rb:615:in `call_filters'
/home/francisco/.gem/ruby/1.8/gems/actionpack-2.3.0/lib/
action_controller/filters.rb:610:in `perform_action_without_benchmark'
/home/francisco/.gem/ruby/1.8/gems/actionpack-2.3.0/lib/
action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'
/home/francisco/.gem/ruby/1.8/gems/actionpack-2.3.0/lib/
action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'
/home/francisco/.gem/ruby/1.8/gems/actionpack-2.3.0/lib/
action_controller/rescue.rb:154:in `perform_action_without_flash'
/home/francisco/.gem/ruby/1.8/gems/actionpack-2.3.0/lib/
action_controller/flash.rb:141:in `perform_action'
/home/francisco/.gem/ruby/1.8/gems/actionpack-2.3.0/lib/
action_controller/base.rb:523:in `send'
/home/francisco/.gem/ruby/1.8/gems/actionpack-2.3.0/lib/
action_controller/base.rb:523:in `process_without_filters'
/home/francisco/.gem/ruby/1.8/gems/actionpack-2.3.0/lib/
action_controller/filters.rb:606:in `process'
/home/francisco/.gem/ruby/1.8/gems/actionpack-2.3.0/lib/
action_controller/base.rb:391:in `process'
/home/francisco/.gem/ruby/1.8/gems/actionpack-2.3.0/lib/
action_controller/base.rb:386:in `call'
/home/francisco/.gem/ruby/1.8/gems/actionpack-2.3.0/lib/
action_controller/routing/route_set.rb:433:in `call'
/home/francisco/.gem/ruby/1.8/gems/actionpack-2.3.0/lib/
action_controller/dispatcher.rb:65:in `dispatch'
/home/francisco/.gem/ruby/1.8/gems/actionpack-2.3.0/lib/
action_controller/dispatcher.rb:88:in `_call'
/home/francisco/.gem/ruby/1.8/gems/actionpack-2.3.0/lib/
action_controller/dispatcher.rb:59:in `initialize'
activerecord (2.3.0) lib/active_record/query_cache.rb:29:in `call'
activerecord (2.3.0) lib/active_record/query_cache.rb:29:in `call'
activerecord (2.3.0) lib/active_record/connection_adapters/abstract/
query_cache.rb:34:in `cache'
activerecord (2.3.0) lib/active_record/query_cache.rb:9:in `cache'
activerecord (2.3.0) lib/active_record/query_cache.rb:28:in `call'
/home/francisco/.gem/ruby/1.8/gems/actionpack-2.3.0/lib/
action_controller/params_parser.rb:15:in `call'
/home/francisco/.gem/ruby/1.8/gems/actionpack-2.3.0/lib/
action_controller/rewindable_input.rb:25:in `call'
/home/francisco/.gem/ruby/1.8/gems/actionpack-2.3.0/lib/
action_controller/session/cookie_store.rb:93:in `call'
/home/francisco/.gem/ruby/1.8/gems/actionpack-2.3.0/lib/
action_controller/failsafe.rb:11:in `call'
/home/francisco/.gem/ruby/1.8/gems/actionpack-2.3.0/lib/
action_controller/rack_ext/lock.rb:15:in `call'
/home/francisco/.gem/ruby/1.8/gems/actionpack-2.3.0/lib/
action_controller/rack_ext/lock.rb:15:in `synchronize'
/home/francisco/.gem/ruby/1.8/gems/actionpack-2.3.0/lib/
action_controller/rack_ext/lock.rb:15:in `call'
/home/francisco/.gem/ruby/1.8/gems/actionpack-2.3.0/lib/
action_controller/dispatcher.rb:83:in `call'
/home/francisco/.gem/ruby/1.8/gems/rails-2.3.0/lib/rails/rack/
static.rb:27:in `call'
/home/francisco/.gem/ruby/1.8/gems/rails-2.3.0/lib/rails/rack/
log_tailer.rb:17:in `call'
/home/francisco/.gem/ruby/1.8/gems/rails-2.3.0/lib/commands/
server.rb:100
Rendered rescues/_trace (21.2ms)
Rendered rescues/_request_and_response (0.5ms)
Rendering rescues/layout (unprocessable_entity)
SQL (0.2ms) SET client_min_messages TO 'panic'
SQL (0.2ms) SET client_min_messages TO 'notice'
On Feb 22, 10:19 pm, John Mettraux <[email protected]> wrote:
> On Mon, Feb 23, 2009 at 1:04 PM, kiko <[email protected]> wrote:
>
> > So I made the changes to use the http authentication essentially
> >http://admin:ad...@localhost:3000and I'm getting a different
> > authenticity error. The first request is a ping to make sure the
> > server is up and as you can see the server successfully authenticates
> > the admin user and returns a 200, but then when I post the request to
> > start the init process I get InvalidAuthenticityToken with a http
> > status code of 422. I haven't made any changes to the default data
> > that is created when installing ruote-web2. Thanks again for any
> > tips.
>
> > Server error:
>
> > Processing ProcessesController#index (for 127.0.0.1 at 2009-02-22
> > 20:03:53) [GET]
> > User Load (1.1ms) SELECT * FROM "users" WHERE ("users"."login" =
> > E'admin') LIMIT 1
> > Completed in 129ms (View: 20, DB: 1) | 200 OK [http://localhost/
> > processes]
> > SQL (0.4ms) SET client_min_messages TO 'panic'
> > SQL (0.3ms) SET client_min_messages TO 'notice'
>
> > Processing ProcessesController#create (for 127.0.0.1 at 2009-02-22
> > 20:03:55) [POST]
> > Parameters: {"pdef"=>"", "fields"=>"{\"svn\":true}",
> > "pdef_url"=>"public/defs/phases/init_phase.rb"}
>
> > ActionController::InvalidAuthenticityToken
> > (ActionController::InvalidAuthenticityToken):
> > /var/lib/gems/1.8/gems/actionpack-2.3.0/lib/action_controller/
> > request_forgery_protection.rb:79:in `verify_authenticity_token'
>
> ruote-web2 is not happy with a content-type set to "form-cli", it's
> verifying the authenticity_token because it thinks it's a regular HTML
> form.
>
> It'd be better to pass a launchitem formatted as XML or JSON in the
> body of your post (and set the content type to application/xml or
> application/json).
>
> You can take inspiration for those launch operations at
> :http://bit.ly/qO1agbut unfortunately those examples only show how to
> embed a process definition in the post body.
>
> This might then help :
>
> ---8<---
> li = OpenWFE::LaunchItem.new(definition_url)
> li.attributes = { 'field0' => 'value0' }
>
> # ...
>
> xml = OpenWFE::Xml::launchitem_to_xml(li, :indent => 2)
>
> # ...
>
> require 'json'
> json = li.to_h.to_json
> --->8---
>
> ruote-rest is a bit more relaxed than ruote-web2 when it comes to user input.
>
> Whenever you see this verify_authenticity_token thing, it means Rails
> thinks it is a regular HTML form.
>
> Best regards,
>
> --
> John Mettraux - http://jmettraux.wordpress.com
--~--~---------~--~----~------------~-------~--~----~
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en
-~----------~----~----~----~------~----~------~--~---